@pipedream/twitter 0.3.11 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -71
- package/dist/actions/add-user-to-list/add-user-to-list.d.ts +194 -0
- package/dist/actions/add-user-to-list/add-user-to-list.mjs +44 -0
- package/dist/actions/create-tweet/create-tweet.d.ts +101 -0
- package/dist/actions/create-tweet/create-tweet.mjs +78 -0
- package/dist/actions/delete-tweet/delete-tweet.d.ts +128 -0
- package/dist/actions/delete-tweet/delete-tweet.mjs +29 -0
- package/dist/actions/follow-user/follow-user.d.ts +131 -0
- package/dist/actions/follow-user/follow-user.mjs +37 -0
- package/dist/actions/get-tweet/get-tweet.d.ts +132 -0
- package/dist/actions/get-tweet/get-tweet.mjs +34 -0
- package/dist/actions/get-user/get-user.d.ts +133 -0
- package/dist/actions/get-user/get-user.mjs +40 -0
- package/dist/actions/like-tweet/like-tweet.d.ts +128 -0
- package/dist/actions/like-tweet/like-tweet.mjs +31 -0
- package/dist/actions/list-favorites/list-favorites.d.ts +202 -0
- package/dist/actions/list-favorites/list-favorites.mjs +50 -0
- package/dist/actions/list-followers/list-followers.d.ts +202 -0
- package/dist/actions/list-followers/list-followers.mjs +50 -0
- package/dist/actions/list-lists/list-lists.d.ts +200 -0
- package/dist/actions/list-lists/list-lists.mjs +50 -0
- package/dist/actions/list-mentions/list-mentions.d.ts +200 -0
- package/dist/actions/list-mentions/list-mentions.mjs +50 -0
- package/dist/actions/list-user-tweets/list-user-tweets.d.ts +202 -0
- package/dist/actions/list-user-tweets/list-user-tweets.mjs +50 -0
- package/dist/actions/retweet/retweet.d.ts +128 -0
- package/dist/actions/retweet/retweet.mjs +34 -0
- package/dist/actions/simple-search/simple-search.d.ts +201 -0
- package/dist/actions/simple-search/simple-search.mjs +50 -0
- package/dist/actions/simple-search-in-list/simple-search-in-list.d.ts +206 -0
- package/dist/actions/simple-search-in-list/simple-search-in-list.mjs +58 -0
- package/dist/actions/unfollow-user/unfollow-user.d.ts +131 -0
- package/dist/actions/unfollow-user/unfollow-user.mjs +33 -0
- package/dist/actions/unlike-tweet/unlike-tweet.d.ts +128 -0
- package/dist/actions/unlike-tweet/unlike-tweet.mjs +29 -0
- package/dist/app/twitter.app.d.ts +65 -0
- package/dist/app/twitter.app.mjs +291 -0
- package/dist/common/additionalProps.d.ts +0 -0
- package/dist/common/additionalProps.mjs +138 -0
- package/dist/common/dataFields.d.ts +6 -0
- package/dist/common/dataFields.mjs +80 -0
- package/dist/common/expansions.d.ts +3 -0
- package/dist/common/expansions.mjs +17 -0
- package/dist/common/methods.d.ts +20 -0
- package/dist/common/methods.mjs +69 -0
- package/dist/common/types/fields.d.ts +18 -0
- package/dist/common/types/fields.mjs +1 -0
- package/dist/common/types/requestParams.d.ts +105 -0
- package/dist/common/types/requestParams.mjs +1 -0
- package/dist/common/types/responseSchemas.d.ts +42 -0
- package/dist/common/types/responseSchemas.mjs +1 -0
- package/dist/sources/common/base.d.ts +87 -0
- package/dist/sources/common/base.mjs +60 -0
- package/dist/sources/common/cacheUserId.d.ts +7 -0
- package/dist/sources/common/cacheUserId.mjs +18 -0
- package/dist/sources/common/getItemSummary.d.ts +4 -0
- package/dist/sources/common/getItemSummary.mjs +12 -0
- package/dist/sources/new-follower-of-user/new-follower-of-user.d.ts +149 -0
- package/dist/sources/new-follower-of-user/new-follower-of-user.mjs +45 -0
- package/dist/sources/new-list-followed/new-list-followed.d.ts +149 -0
- package/dist/sources/new-list-followed/new-list-followed.mjs +46 -0
- package/dist/sources/new-tweet-in-list/new-tweet-in-list.d.ts +147 -0
- package/dist/sources/new-tweet-in-list/new-tweet-in-list.mjs +42 -0
- package/dist/sources/new-tweet-liked-by-user/new-tweet-liked-by-user.d.ts +149 -0
- package/dist/sources/new-tweet-liked-by-user/new-tweet-liked-by-user.mjs +45 -0
- package/dist/sources/new-tweet-posted-by-user/new-tweet-posted-by-user.d.ts +149 -0
- package/dist/sources/new-tweet-posted-by-user/new-tweet-posted-by-user.mjs +45 -0
- package/dist/sources/new-tweet-posted-matching-query/new-tweet-posted-matching-query.d.ts +147 -0
- package/dist/sources/new-tweet-posted-matching-query/new-tweet-posted-matching-query.mjs +44 -0
- package/dist/sources/new-unfollower-of-user/new-unfollower-of-user.d.ts +149 -0
- package/dist/sources/new-unfollower-of-user/new-unfollower-of-user.mjs +75 -0
- package/dist/sources/new-user-followed/new-user-followed.d.ts +148 -0
- package/dist/sources/new-user-followed/new-user-followed.mjs +46 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +10 -14
- package/actions/add-user-to-list/add-user-to-list.mjs +0 -62
- package/actions/advanced-search/advanced-search.mjs +0 -113
- package/actions/common.mjs +0 -29
- package/actions/create-tweet/create-tweet.mjs +0 -146
- package/actions/delete-tweet/delete-tweet.mjs +0 -42
- package/actions/follow-user/follow-user.mjs +0 -48
- package/actions/get-tweet/get-tweet.mjs +0 -42
- package/actions/get-user/get-user.mjs +0 -50
- package/actions/like-tweet/like-tweet.mjs +0 -42
- package/actions/list-favorites/list-favorites.mjs +0 -63
- package/actions/list-followers/list-followers.mjs +0 -67
- package/actions/list-lists/list-lists.mjs +0 -69
- package/actions/list-mentions/list-mentions.mjs +0 -55
- package/actions/list-pending-followers/list-pending-followers.mjs +0 -32
- package/actions/list-retweets/list-retweets.mjs +0 -54
- package/actions/list-user-tweets/list-user-tweets.mjs +0 -80
- package/actions/retweet/retweet.mjs +0 -27
- package/actions/simple-search/simple-search.mjs +0 -62
- package/actions/simple-search-in-list/simple-search-in-list.mjs +0 -48
- package/actions/unfollow-user/unfollow-user.mjs +0 -48
- package/actions/unlike-tweet/unlike-tweet.mjs +0 -40
- package/actions/upload-media/upload-media.mjs +0 -122
- package/old.md +0 -169
- package/sources/common/followed.mjs +0 -38
- package/sources/common/followers.mjs +0 -159
- package/sources/common/tweets.mjs +0 -155
- package/sources/language-codes.mjs +0 -742
- package/sources/my-liked-tweets/my-liked-tweets.mjs +0 -30
- package/sources/my-tweets/my-tweets.mjs +0 -48
- package/sources/new-follower-of-me/new-follower-of-me.mjs +0 -69
- package/sources/new-follower-of-user/new-follower-of-user.mjs +0 -25
- package/sources/new-list-followed/new-list-followed.mjs +0 -24
- package/sources/new-trends-by-geo/new-trends-by-geo.mjs +0 -40
- package/sources/new-tweet-in-list/new-tweet-in-list.mjs +0 -49
- package/sources/new-unfollower-of-me/new-unfollower-of-me.mjs +0 -16
- package/sources/new-unfollower-of-user/new-unfollower-of-user.mjs +0 -25
- package/sources/new-user-followed/new-user-followed.mjs +0 -25
- package/sources/search-mentions/search-mentions.mjs +0 -144
- package/sources/tweets-liked-by-user/tweets-liked-by-user.mjs +0 -38
- package/sources/user-tweets/user-tweets.mjs +0 -49
- package/sources/watch-retweets-of-me/watch-retweets-of-me.mjs +0 -36
- package/sources/watch-retweets-of-my-tweet/watch-retweets-of-my-tweet.mjs +0 -44
- package/sources/watch-retweets-of-user-tweet/watch-retweets-of-user-tweet.mjs +0 -34
- package/twitter.app.mjs +0 -1161
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import twitter from "../../twitter.app.mjs";
|
|
2
|
-
import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
key: "twitter-my-liked-tweets",
|
|
6
|
-
name: "My Liked Tweets",
|
|
7
|
-
description: "Emit new Tweets you like on Twitter",
|
|
8
|
-
version: "0.0.10",
|
|
9
|
-
type: "source",
|
|
10
|
-
props: {
|
|
11
|
-
twitter,
|
|
12
|
-
timer: {
|
|
13
|
-
label: "Polling interval",
|
|
14
|
-
description: "Pipedream will poll the Twitter API on this schedule",
|
|
15
|
-
type: "$.interface.timer",
|
|
16
|
-
default: {
|
|
17
|
-
intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
dedupe: "unique",
|
|
22
|
-
async run() {
|
|
23
|
-
(await this.twitter.getLikedTweets()).reverse().forEach((tweet) => {
|
|
24
|
-
this.$emit(this.twitter.enrichTweet(tweet), {
|
|
25
|
-
id: tweet.id_str,
|
|
26
|
-
summary: tweet.full_text,
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
},
|
|
30
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import base from "../common/tweets.mjs";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
...base,
|
|
5
|
-
key: "twitter-my-tweets",
|
|
6
|
-
name: "My Tweets",
|
|
7
|
-
description: "Emit new Tweets you post to Twitter",
|
|
8
|
-
version: "0.0.12",
|
|
9
|
-
type: "source",
|
|
10
|
-
props: {
|
|
11
|
-
...base.props,
|
|
12
|
-
includeRetweets: {
|
|
13
|
-
propDefinition: [
|
|
14
|
-
base.props.twitter,
|
|
15
|
-
"includeRetweets",
|
|
16
|
-
],
|
|
17
|
-
},
|
|
18
|
-
includeReplies: {
|
|
19
|
-
propDefinition: [
|
|
20
|
-
base.props.twitter,
|
|
21
|
-
"includeReplies",
|
|
22
|
-
],
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
methods: {
|
|
26
|
-
...base.methods,
|
|
27
|
-
shouldExcludeReplies() {
|
|
28
|
-
return this.includeReplies === "exclude";
|
|
29
|
-
},
|
|
30
|
-
shouldIncludeRetweets() {
|
|
31
|
-
return this.includeRetweets !== "exclude";
|
|
32
|
-
},
|
|
33
|
-
async getScreenName() {
|
|
34
|
-
const { screen_name: screenName } = await this.twitter.verifyCredentials();
|
|
35
|
-
return screenName;
|
|
36
|
-
},
|
|
37
|
-
async retrieveTweets() {
|
|
38
|
-
const screenName = await this.getScreenName();
|
|
39
|
-
return this.twitter.getUserTimeline({
|
|
40
|
-
screenName,
|
|
41
|
-
count: this.count,
|
|
42
|
-
sinceId: this.getSinceId(),
|
|
43
|
-
excludeReplies: this.shouldExcludeReplies(),
|
|
44
|
-
includeRts: this.shouldIncludeRetweets(),
|
|
45
|
-
});
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
};
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import common from "../common/followers.mjs";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
...common,
|
|
5
|
-
key: "twitter-new-follower-of-me",
|
|
6
|
-
name: "New Follower of Me",
|
|
7
|
-
description: "Emit new event when a user follows you on Twitter",
|
|
8
|
-
version: "0.0.12",
|
|
9
|
-
type: "source",
|
|
10
|
-
props: {
|
|
11
|
-
...common.props,
|
|
12
|
-
followersCacheSize: {
|
|
13
|
-
type: "integer",
|
|
14
|
-
label: "Followers Cache Size",
|
|
15
|
-
description: "The maximum amount of follower ID's that will be cached at any given time",
|
|
16
|
-
min: 10,
|
|
17
|
-
max: 100,
|
|
18
|
-
default: 100,
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
methods: {
|
|
22
|
-
...common.methods,
|
|
23
|
-
_getHasExecuted() {
|
|
24
|
-
return this.db.get("hasExecuted");
|
|
25
|
-
},
|
|
26
|
-
_setHasExecuted(hasExecuted) {
|
|
27
|
-
this.db.set("hasExecuted", hasExecuted);
|
|
28
|
-
},
|
|
29
|
-
_wasComponentExecuted() {
|
|
30
|
-
return !!this._getHasExecuted();
|
|
31
|
-
},
|
|
32
|
-
_markComponentAsExecuted() {
|
|
33
|
-
this._setHasExecuted(true);
|
|
34
|
-
},
|
|
35
|
-
getFollowersCacheSize() {
|
|
36
|
-
return this.followersCacheSize;
|
|
37
|
-
},
|
|
38
|
-
async getRelevantIds() {
|
|
39
|
-
const mostRecentFollowers = this.getFollowersCache();
|
|
40
|
-
if (!this._wasComponentExecuted()) {
|
|
41
|
-
this._markComponentAsExecuted();
|
|
42
|
-
|
|
43
|
-
// The first time this event source is executed, it will emit an event
|
|
44
|
-
// for the most recent followers.
|
|
45
|
-
// We reverse the list of new followers so that the event source emits the
|
|
46
|
-
// events for each follower in the same order that the followers followed
|
|
47
|
-
// the account, from least to most recent.
|
|
48
|
-
return mostRecentFollowers.reverse();
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const newFollowersGen = this.scanNewFollowers(mostRecentFollowers);
|
|
52
|
-
const newFollowers = [];
|
|
53
|
-
for await (const id of newFollowersGen) {
|
|
54
|
-
newFollowers.push(id);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const followersCache = [
|
|
58
|
-
...newFollowers,
|
|
59
|
-
...mostRecentFollowers,
|
|
60
|
-
];
|
|
61
|
-
this.setFollowersCache(followersCache);
|
|
62
|
-
|
|
63
|
-
// We reverse the list of new followers so that the event source emits the
|
|
64
|
-
// events for each follower in the same order that the followers followed
|
|
65
|
-
// the account, from least to most recent.
|
|
66
|
-
return newFollowers.reverse();
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import base from "../new-follower-of-me/new-follower-of-me.mjs";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
...base,
|
|
5
|
-
key: "twitter-new-follower-of-user",
|
|
6
|
-
name: "New Follower of User",
|
|
7
|
-
description: "Emit new event when a specific user gains a follower",
|
|
8
|
-
version: "0.0.12",
|
|
9
|
-
type: "source",
|
|
10
|
-
props: {
|
|
11
|
-
...base.props,
|
|
12
|
-
screenName: {
|
|
13
|
-
propDefinition: [
|
|
14
|
-
base.props.twitter,
|
|
15
|
-
"screenName",
|
|
16
|
-
],
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
methods: {
|
|
20
|
-
...base.methods,
|
|
21
|
-
getScreenName() {
|
|
22
|
-
return this.screenName;
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import common from "../common/followed.mjs";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
...common,
|
|
5
|
-
key: "twitter-new-list-followed",
|
|
6
|
-
name: "New List Followed",
|
|
7
|
-
description: "Emit new event when the authenticated user follows a List",
|
|
8
|
-
version: "0.0.4",
|
|
9
|
-
type: "source",
|
|
10
|
-
dedupe: "unique",
|
|
11
|
-
methods: {
|
|
12
|
-
...common.methods,
|
|
13
|
-
async getFollowed() {
|
|
14
|
-
return this.twitter.getLists({});
|
|
15
|
-
},
|
|
16
|
-
generateMeta(list) {
|
|
17
|
-
return {
|
|
18
|
-
id: list.id,
|
|
19
|
-
summary: list.name,
|
|
20
|
-
ts: Date.now(),
|
|
21
|
-
};
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import twitter from "../../twitter.app.mjs";
|
|
2
|
-
import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
key: "twitter-new-trends-by-geo",
|
|
6
|
-
name: "New Trends by Geo",
|
|
7
|
-
description: "Emit new event when a new topic is trending on Twitter in a specific geographic location",
|
|
8
|
-
version: "0.0.10",
|
|
9
|
-
type: "source",
|
|
10
|
-
props: {
|
|
11
|
-
twitter,
|
|
12
|
-
trendLocation: {
|
|
13
|
-
propDefinition: [
|
|
14
|
-
twitter,
|
|
15
|
-
"trendLocation",
|
|
16
|
-
],
|
|
17
|
-
},
|
|
18
|
-
timer: {
|
|
19
|
-
label: "Polling interval",
|
|
20
|
-
description: "Pipedream will poll the Twitter API on this schedule",
|
|
21
|
-
type: "$.interface.timer",
|
|
22
|
-
default: {
|
|
23
|
-
intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
dedupe: "unique",
|
|
28
|
-
async run() {
|
|
29
|
-
(await this.twitter.getTrends({
|
|
30
|
-
id: this.trendLocation,
|
|
31
|
-
})).forEach((geo) => {
|
|
32
|
-
geo.trends.reverse().forEach((trend) => {
|
|
33
|
-
this.$emit(trend, {
|
|
34
|
-
id: trend.query,
|
|
35
|
-
summary: trend.name,
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
},
|
|
40
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import base from "../common/tweets.mjs";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
...base,
|
|
5
|
-
key: "twitter-new-tweet-in-list",
|
|
6
|
-
name: "New Tweet in List",
|
|
7
|
-
description: "Emit new Tweets posted by members of a list",
|
|
8
|
-
version: "0.0.8",
|
|
9
|
-
type: "source",
|
|
10
|
-
props: {
|
|
11
|
-
...base.props,
|
|
12
|
-
includeRetweets: {
|
|
13
|
-
propDefinition: [
|
|
14
|
-
base.props.twitter,
|
|
15
|
-
"includeRetweets",
|
|
16
|
-
],
|
|
17
|
-
},
|
|
18
|
-
list: {
|
|
19
|
-
propDefinition: [
|
|
20
|
-
base.props.twitter,
|
|
21
|
-
"list",
|
|
22
|
-
],
|
|
23
|
-
},
|
|
24
|
-
includeEntities: {
|
|
25
|
-
type: "boolean",
|
|
26
|
-
label: "Entities",
|
|
27
|
-
description: `
|
|
28
|
-
Include the 'entities' node, which offers a variety of metadata about the
|
|
29
|
-
tweet in a discreet structure, including: user_mentions, urls, and hashtags
|
|
30
|
-
`,
|
|
31
|
-
default: false,
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
methods: {
|
|
35
|
-
...base.methods,
|
|
36
|
-
shouldIncludeRetweets() {
|
|
37
|
-
return this.includeRetweets !== "exclude";
|
|
38
|
-
},
|
|
39
|
-
retrieveTweets() {
|
|
40
|
-
return this.twitter.getListTweets({
|
|
41
|
-
listId: this.list,
|
|
42
|
-
count: this.count,
|
|
43
|
-
sinceId: this.getSinceId(),
|
|
44
|
-
includeEntities: this.includeEntities,
|
|
45
|
-
includeRetweets: this.shouldIncludeRetweets(),
|
|
46
|
-
});
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import common from "../common/followers.mjs";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
...common,
|
|
5
|
-
key: "twitter-new-unfollower-of-me",
|
|
6
|
-
name: "New Unfollower of Me",
|
|
7
|
-
description: "Emit new event when a user unfollows you on Twitter",
|
|
8
|
-
version: "0.0.13",
|
|
9
|
-
type: "source",
|
|
10
|
-
methods: {
|
|
11
|
-
...common.methods,
|
|
12
|
-
getRelevantIds() {
|
|
13
|
-
return this.getUnfollowers();
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import base from "../new-unfollower-of-me/new-unfollower-of-me.mjs";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
...base,
|
|
5
|
-
key: "twitter-new-unfollower-of-user",
|
|
6
|
-
name: "New Unfollower of User",
|
|
7
|
-
description: "Emit new event when a specific user loses a follower on Twitter",
|
|
8
|
-
version: "0.0.11",
|
|
9
|
-
type: "source",
|
|
10
|
-
props: {
|
|
11
|
-
...base.props,
|
|
12
|
-
screenName: {
|
|
13
|
-
propDefinition: [
|
|
14
|
-
base.props.twitter,
|
|
15
|
-
"screenName",
|
|
16
|
-
],
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
methods: {
|
|
20
|
-
...base.methods,
|
|
21
|
-
getScreenName() {
|
|
22
|
-
return this.screenName;
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import common from "../common/followed.mjs";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
...common,
|
|
5
|
-
key: "twitter-new-user-followed",
|
|
6
|
-
name: "New User Followed",
|
|
7
|
-
description: "Emit new event when the authenticated user follows a User",
|
|
8
|
-
version: "0.0.4",
|
|
9
|
-
type: "source",
|
|
10
|
-
dedupe: "unique",
|
|
11
|
-
methods: {
|
|
12
|
-
...common.methods,
|
|
13
|
-
async getFollowed() {
|
|
14
|
-
const { users } = await this.twitter.getUserFollows({});
|
|
15
|
-
return users;
|
|
16
|
-
},
|
|
17
|
-
generateMeta(user) {
|
|
18
|
-
return {
|
|
19
|
-
id: user.id,
|
|
20
|
-
summary: user.name,
|
|
21
|
-
ts: Date.now(),
|
|
22
|
-
};
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
};
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import twitter from "../../twitter.app.mjs";
|
|
2
|
-
import moment from "moment";
|
|
3
|
-
import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
key: "twitter-search-mentions",
|
|
7
|
-
name: "Search Mentions",
|
|
8
|
-
description: "Emit new Tweets that match your search criteria",
|
|
9
|
-
version: "0.0.10",
|
|
10
|
-
type: "source",
|
|
11
|
-
props: {
|
|
12
|
-
db: "$.service.db",
|
|
13
|
-
twitter,
|
|
14
|
-
q: {
|
|
15
|
-
propDefinition: [
|
|
16
|
-
twitter,
|
|
17
|
-
"q",
|
|
18
|
-
],
|
|
19
|
-
},
|
|
20
|
-
resultType: {
|
|
21
|
-
propDefinition: [
|
|
22
|
-
twitter,
|
|
23
|
-
"resultType",
|
|
24
|
-
],
|
|
25
|
-
},
|
|
26
|
-
includeRetweets: {
|
|
27
|
-
propDefinition: [
|
|
28
|
-
twitter,
|
|
29
|
-
"includeRetweets",
|
|
30
|
-
],
|
|
31
|
-
},
|
|
32
|
-
includeReplies: {
|
|
33
|
-
propDefinition: [
|
|
34
|
-
twitter,
|
|
35
|
-
"includeReplies",
|
|
36
|
-
],
|
|
37
|
-
},
|
|
38
|
-
lang: {
|
|
39
|
-
propDefinition: [
|
|
40
|
-
twitter,
|
|
41
|
-
"lang",
|
|
42
|
-
],
|
|
43
|
-
},
|
|
44
|
-
locale: {
|
|
45
|
-
propDefinition: [
|
|
46
|
-
twitter,
|
|
47
|
-
"locale",
|
|
48
|
-
],
|
|
49
|
-
},
|
|
50
|
-
geocode: {
|
|
51
|
-
propDefinition: [
|
|
52
|
-
twitter,
|
|
53
|
-
"geocode",
|
|
54
|
-
],
|
|
55
|
-
},
|
|
56
|
-
enrichTweets: {
|
|
57
|
-
propDefinition: [
|
|
58
|
-
twitter,
|
|
59
|
-
"enrichTweets",
|
|
60
|
-
],
|
|
61
|
-
},
|
|
62
|
-
count: {
|
|
63
|
-
propDefinition: [
|
|
64
|
-
twitter,
|
|
65
|
-
"count",
|
|
66
|
-
],
|
|
67
|
-
},
|
|
68
|
-
maxRequests: {
|
|
69
|
-
propDefinition: [
|
|
70
|
-
twitter,
|
|
71
|
-
"maxRequests",
|
|
72
|
-
],
|
|
73
|
-
},
|
|
74
|
-
timer: {
|
|
75
|
-
label: "Polling interval",
|
|
76
|
-
description: "Pipedream will poll the Twitter API on this schedule",
|
|
77
|
-
type: "$.interface.timer",
|
|
78
|
-
default: {
|
|
79
|
-
intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
methods: {
|
|
84
|
-
_getSinceId() {
|
|
85
|
-
return this.db.get("sinceId");
|
|
86
|
-
},
|
|
87
|
-
_setSinceId(sinceId) {
|
|
88
|
-
this.db.set("sinceId", sinceId);
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
async run() {
|
|
92
|
-
const sinceId = this._getSinceId();
|
|
93
|
-
const {
|
|
94
|
-
lang,
|
|
95
|
-
locale,
|
|
96
|
-
geocode,
|
|
97
|
-
resultType,
|
|
98
|
-
enrichTweets,
|
|
99
|
-
includeReplies,
|
|
100
|
-
includeRetweets,
|
|
101
|
-
maxRequests,
|
|
102
|
-
count,
|
|
103
|
-
q,
|
|
104
|
-
} = this;
|
|
105
|
-
let maxId;
|
|
106
|
-
const limitFirstPage = !sinceId;
|
|
107
|
-
|
|
108
|
-
// run paginated search
|
|
109
|
-
const tweets = await this.twitter.paginatedSearch({
|
|
110
|
-
q,
|
|
111
|
-
sinceId,
|
|
112
|
-
lang,
|
|
113
|
-
locale,
|
|
114
|
-
geocode,
|
|
115
|
-
resultType,
|
|
116
|
-
enrichTweets,
|
|
117
|
-
includeReplies,
|
|
118
|
-
includeRetweets,
|
|
119
|
-
maxRequests,
|
|
120
|
-
count,
|
|
121
|
-
limitFirstPage,
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
// emit array of tweet objects
|
|
125
|
-
if (tweets.length > 0) {
|
|
126
|
-
tweets.sort(function (a, b) { return a.id - b.id; });
|
|
127
|
-
|
|
128
|
-
tweets.forEach((tweet) => {
|
|
129
|
-
this.$emit(tweet, {
|
|
130
|
-
ts: moment(tweet.created_at, "ddd MMM DD HH:mm:ss Z YYYY").valueOf(),
|
|
131
|
-
summary: tweet.full_text || tweet.text,
|
|
132
|
-
id: tweet.id_str,
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
if (tweet.id_str > maxId || !maxId) {
|
|
136
|
-
maxId = tweet.id_str;
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
if (maxId) {
|
|
141
|
-
this._setSinceId(maxId);
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import twitter from "../../twitter.app.mjs";
|
|
2
|
-
import { DEFAULT_POLLING_SOURCE_TIMER_INTERVAL } from "@pipedream/platform";
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
key: "twitter-tweets-liked-by-user",
|
|
6
|
-
name: "Tweet Liked by User",
|
|
7
|
-
description: "Emit new Tweets liked by a specific user on Twitter",
|
|
8
|
-
version: "0.0.10",
|
|
9
|
-
type: "source",
|
|
10
|
-
props: {
|
|
11
|
-
twitter,
|
|
12
|
-
screenName: {
|
|
13
|
-
propDefinition: [
|
|
14
|
-
twitter,
|
|
15
|
-
"screenName",
|
|
16
|
-
],
|
|
17
|
-
},
|
|
18
|
-
timer: {
|
|
19
|
-
label: "Polling interval",
|
|
20
|
-
description: "Pipedream will poll the Twitter API on this schedule",
|
|
21
|
-
type: "$.interface.timer",
|
|
22
|
-
default: {
|
|
23
|
-
intervalSeconds: DEFAULT_POLLING_SOURCE_TIMER_INTERVAL,
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
dedupe: "unique",
|
|
28
|
-
async run() {
|
|
29
|
-
(await this.twitter.getLikedTweets({
|
|
30
|
-
screenName: this.screen_name,
|
|
31
|
-
})).reverse().forEach((tweet) => {
|
|
32
|
-
this.$emit(this.twitter.enrichTweet(tweet), {
|
|
33
|
-
id: tweet.id_str,
|
|
34
|
-
summary: tweet.full_text,
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
},
|
|
38
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import base from "../common/tweets.mjs";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
...base,
|
|
5
|
-
key: "twitter-user-tweets",
|
|
6
|
-
name: "User Tweets",
|
|
7
|
-
description: "Emit new Tweets posted by a user",
|
|
8
|
-
version: "0.0.12",
|
|
9
|
-
type: "source",
|
|
10
|
-
props: {
|
|
11
|
-
...base.props,
|
|
12
|
-
screenName: {
|
|
13
|
-
propDefinition: [
|
|
14
|
-
base.props.twitter,
|
|
15
|
-
"screenName",
|
|
16
|
-
],
|
|
17
|
-
},
|
|
18
|
-
includeRetweets: {
|
|
19
|
-
propDefinition: [
|
|
20
|
-
base.props.twitter,
|
|
21
|
-
"includeRetweets",
|
|
22
|
-
],
|
|
23
|
-
},
|
|
24
|
-
includeReplies: {
|
|
25
|
-
propDefinition: [
|
|
26
|
-
base.props.twitter,
|
|
27
|
-
"includeReplies",
|
|
28
|
-
],
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
methods: {
|
|
32
|
-
...base.methods,
|
|
33
|
-
shouldExcludeReplies() {
|
|
34
|
-
return this.includeReplies === "exclude";
|
|
35
|
-
},
|
|
36
|
-
shouldIncludeRetweets() {
|
|
37
|
-
return this.includeRetweets !== "exclude";
|
|
38
|
-
},
|
|
39
|
-
retrieveTweets() {
|
|
40
|
-
return this.twitter.getUserTimeline({
|
|
41
|
-
screenName: this.screenName,
|
|
42
|
-
count: this.count,
|
|
43
|
-
sinceId: this.getSinceId(),
|
|
44
|
-
excludeReplies: this.shouldExcludeReplies(),
|
|
45
|
-
includeRts: this.shouldIncludeRetweets(),
|
|
46
|
-
});
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import base from "../common/tweets.mjs";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
...base,
|
|
5
|
-
key: "twitter-watch-retweets-of-me",
|
|
6
|
-
name: "Watch Retweets of Me",
|
|
7
|
-
version: "0.0.8",
|
|
8
|
-
description: "Emit new event when recent Tweets authored by the authenticating user that have been retweeted by others",
|
|
9
|
-
type: "source",
|
|
10
|
-
props: {
|
|
11
|
-
...base.props,
|
|
12
|
-
includeEntities: {
|
|
13
|
-
propDefinition: [
|
|
14
|
-
base.props.twitter,
|
|
15
|
-
"includeEntities",
|
|
16
|
-
],
|
|
17
|
-
},
|
|
18
|
-
includeUserEntities: {
|
|
19
|
-
propDefinition: [
|
|
20
|
-
base.props.twitter,
|
|
21
|
-
"includeUserEntities",
|
|
22
|
-
],
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
methods: {
|
|
26
|
-
...base.methods,
|
|
27
|
-
retrieveTweets() {
|
|
28
|
-
return this.twitter.getRetweetsOfMe({
|
|
29
|
-
count: this.count,
|
|
30
|
-
sinceId: this.getSinceId(),
|
|
31
|
-
includeEntities: this.includeEntities,
|
|
32
|
-
includeUserEntities: this.includeUserEntities,
|
|
33
|
-
});
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import base from "../common/tweets.mjs";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
...base,
|
|
5
|
-
key: "twitter-watch-retweets-of-my-tweet",
|
|
6
|
-
name: "Watch Retweets of My Tweet",
|
|
7
|
-
description: "Emit new event when a specific Tweet from the authenticated user is retweeted",
|
|
8
|
-
version: "0.0.7",
|
|
9
|
-
type: "source",
|
|
10
|
-
props: {
|
|
11
|
-
...base.props,
|
|
12
|
-
tweetId: {
|
|
13
|
-
type: "string",
|
|
14
|
-
label: "Tweet",
|
|
15
|
-
description: "The Tweet to watch for retweets",
|
|
16
|
-
options(context) {
|
|
17
|
-
return this.tweetIdOptions(context);
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
methods: {
|
|
22
|
-
...base.methods,
|
|
23
|
-
async getScreenName() {
|
|
24
|
-
const { screen_name: screenName } = await this.twitter.verifyCredentials();
|
|
25
|
-
return screenName;
|
|
26
|
-
},
|
|
27
|
-
generateMeta(tweet) {
|
|
28
|
-
const baseMeta = base.methods.generateMeta.bind(this)(tweet);
|
|
29
|
-
const { screen_name: screenName = "N/A" } = tweet.user;
|
|
30
|
-
const summary = `Retweet by @${screenName}`;
|
|
31
|
-
return {
|
|
32
|
-
...baseMeta,
|
|
33
|
-
summary,
|
|
34
|
-
};
|
|
35
|
-
},
|
|
36
|
-
retrieveTweets() {
|
|
37
|
-
return this.twitter.getRetweets({
|
|
38
|
-
id: this.tweetId,
|
|
39
|
-
count: this.count,
|
|
40
|
-
sinceId: this.getSinceId(),
|
|
41
|
-
});
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
};
|