@pipedream/twitter 0.3.2 → 0.3.5
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/actions/add-user-to-list/add-user-to-list.mjs +62 -0
- package/actions/advanced-search/advanced-search.mjs +113 -0
- package/actions/common.mjs +29 -0
- package/actions/create-tweet/create-tweet.mjs +146 -0
- package/actions/delete-tweet/delete-tweet.mjs +42 -0
- package/actions/follow-user/follow-user.mjs +48 -0
- package/actions/get-tweet/get-tweet.mjs +42 -0
- package/actions/get-user/get-user.mjs +50 -0
- package/actions/like-tweet/like-tweet.mjs +42 -0
- package/actions/list-favorites/list-favorites.mjs +63 -0
- package/actions/list-followers/list-followers.mjs +67 -0
- package/actions/list-lists/list-lists.mjs +69 -0
- package/actions/list-mentions/list-mentions.mjs +55 -0
- package/actions/list-pending-followers/list-pending-followers.mjs +32 -0
- package/actions/list-retweets/list-retweets.mjs +54 -0
- package/actions/list-user-tweets/list-user-tweets.mjs +80 -0
- package/actions/retweet/retweet.mjs +27 -0
- package/actions/simple-search/simple-search.mjs +62 -0
- package/actions/simple-search-in-list/simple-search-in-list.mjs +48 -0
- package/actions/unfollow-user/unfollow-user.mjs +48 -0
- package/actions/unlike-tweet/unlike-tweet.mjs +40 -0
- package/package.json +21 -21
- package/readme.md +0 -4
- package/sources/common/followed.mjs +37 -0
- package/sources/common/followers.mjs +158 -0
- package/sources/common/tweets.mjs +154 -0
- package/sources/{language-codes.js → language-codes.mjs} +6 -2
- package/sources/my-liked-tweets/my-liked-tweets.mjs +29 -0
- package/sources/my-tweets/my-tweets.mjs +48 -0
- package/sources/new-follower-of-me/new-follower-of-me.mjs +69 -0
- package/sources/new-follower-of-user/new-follower-of-user.mjs +25 -0
- package/sources/new-list-followed/new-list-followed.mjs +24 -0
- package/sources/new-trends-by-geo/new-trends-by-geo.mjs +39 -0
- package/sources/new-tweet-in-list/new-tweet-in-list.mjs +49 -0
- package/sources/new-unfollower-of-me/{new-unfollower-of-me.js → new-unfollower-of-me.mjs} +5 -4
- package/sources/new-unfollower-of-user/new-unfollower-of-user.mjs +25 -0
- package/sources/new-user-followed/new-user-followed.mjs +25 -0
- package/sources/search-mentions/search-mentions.mjs +143 -0
- package/sources/tweets-liked-by-user/tweets-liked-by-user.mjs +37 -0
- package/sources/user-tweets/user-tweets.mjs +49 -0
- package/sources/watch-retweets-of-me/watch-retweets-of-me.mjs +36 -0
- package/sources/watch-retweets-of-my-tweet/watch-retweets-of-my-tweet.mjs +44 -0
- package/sources/watch-retweets-of-user-tweet/watch-retweets-of-user-tweet.mjs +34 -0
- package/twitter.app.mjs +1149 -0
- package/sources/common-followers.js +0 -99
- package/sources/my-liked-tweets/my-liked-tweets.js +0 -26
- package/sources/my-tweets/my-tweets.js +0 -83
- package/sources/new-follower-of-me/new-follower-of-me.js +0 -68
- package/sources/new-follower-of-user/new-follower-of-user.js +0 -69
- package/sources/new-trends-by-geo/new-trends-by-geo.js +0 -29
- package/sources/new-unfollower-of-user/new-unfollower-of-user.js +0 -22
- package/sources/search-mentions/search-mentions.js +0 -76
- package/sources/tweets-liked-by-user/tweets-liked-by-user.js +0 -27
- package/sources/user-tweets/user-tweets.js +0 -66
- package/twitter.app.js +0 -461
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import twitter from "../../twitter.app.mjs";
|
|
2
|
+
import moment from "moment";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
key: "twitter-search-mentions",
|
|
6
|
+
name: "Search Mentions",
|
|
7
|
+
description: "Emit new Tweets that match your search criteria",
|
|
8
|
+
version: "0.0.7",
|
|
9
|
+
type: "source",
|
|
10
|
+
props: {
|
|
11
|
+
db: "$.service.db",
|
|
12
|
+
twitter,
|
|
13
|
+
q: {
|
|
14
|
+
propDefinition: [
|
|
15
|
+
twitter,
|
|
16
|
+
"q",
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
resultType: {
|
|
20
|
+
propDefinition: [
|
|
21
|
+
twitter,
|
|
22
|
+
"resultType",
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
includeRetweets: {
|
|
26
|
+
propDefinition: [
|
|
27
|
+
twitter,
|
|
28
|
+
"includeRetweets",
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
includeReplies: {
|
|
32
|
+
propDefinition: [
|
|
33
|
+
twitter,
|
|
34
|
+
"includeReplies",
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
lang: {
|
|
38
|
+
propDefinition: [
|
|
39
|
+
twitter,
|
|
40
|
+
"lang",
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
locale: {
|
|
44
|
+
propDefinition: [
|
|
45
|
+
twitter,
|
|
46
|
+
"locale",
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
geocode: {
|
|
50
|
+
propDefinition: [
|
|
51
|
+
twitter,
|
|
52
|
+
"geocode",
|
|
53
|
+
],
|
|
54
|
+
},
|
|
55
|
+
enrichTweets: {
|
|
56
|
+
propDefinition: [
|
|
57
|
+
twitter,
|
|
58
|
+
"enrichTweets",
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
count: {
|
|
62
|
+
propDefinition: [
|
|
63
|
+
twitter,
|
|
64
|
+
"count",
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
maxRequests: {
|
|
68
|
+
propDefinition: [
|
|
69
|
+
twitter,
|
|
70
|
+
"maxRequests",
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
timer: {
|
|
74
|
+
label: "Polling interval",
|
|
75
|
+
description: "Pipedream will poll the Twitter API on this schedule",
|
|
76
|
+
type: "$.interface.timer",
|
|
77
|
+
default: {
|
|
78
|
+
intervalSeconds: 60 * 15,
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
methods: {
|
|
83
|
+
_getSinceId() {
|
|
84
|
+
return this.db.get("sinceId");
|
|
85
|
+
},
|
|
86
|
+
_setSinceId(sinceId) {
|
|
87
|
+
this.db.set("sinceId", sinceId);
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
async run() {
|
|
91
|
+
const sinceId = this._getSinceId();
|
|
92
|
+
const {
|
|
93
|
+
lang,
|
|
94
|
+
locale,
|
|
95
|
+
geocode,
|
|
96
|
+
resultType,
|
|
97
|
+
enrichTweets,
|
|
98
|
+
includeReplies,
|
|
99
|
+
includeRetweets,
|
|
100
|
+
maxRequests,
|
|
101
|
+
count,
|
|
102
|
+
q,
|
|
103
|
+
} = this;
|
|
104
|
+
let maxId;
|
|
105
|
+
const limitFirstPage = !sinceId;
|
|
106
|
+
|
|
107
|
+
// run paginated search
|
|
108
|
+
const tweets = await this.twitter.paginatedSearch({
|
|
109
|
+
q,
|
|
110
|
+
sinceId,
|
|
111
|
+
lang,
|
|
112
|
+
locale,
|
|
113
|
+
geocode,
|
|
114
|
+
resultType,
|
|
115
|
+
enrichTweets,
|
|
116
|
+
includeReplies,
|
|
117
|
+
includeRetweets,
|
|
118
|
+
maxRequests,
|
|
119
|
+
count,
|
|
120
|
+
limitFirstPage,
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
// emit array of tweet objects
|
|
124
|
+
if (tweets.length > 0) {
|
|
125
|
+
tweets.sort(function(a, b) {return a.id - b.id;});
|
|
126
|
+
|
|
127
|
+
tweets.forEach((tweet) => {
|
|
128
|
+
this.$emit(tweet, {
|
|
129
|
+
ts: moment(tweet.created_at, "ddd MMM DD HH:mm:ss Z YYYY").valueOf(),
|
|
130
|
+
summary: tweet.full_text || tweet.text,
|
|
131
|
+
id: tweet.id_str,
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
if (tweet.id_str > maxId || !maxId) {
|
|
135
|
+
maxId = tweet.id_str;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
if (maxId) {
|
|
140
|
+
this._setSinceId(maxId);
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import twitter from "../../twitter.app.mjs";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
key: "twitter-tweet-liked-by-user",
|
|
5
|
+
name: "Tweet Liked by User",
|
|
6
|
+
description: "Emit new Tweets liked by a specific user on Twitter",
|
|
7
|
+
version: "0.0.7",
|
|
8
|
+
type: "source",
|
|
9
|
+
props: {
|
|
10
|
+
twitter,
|
|
11
|
+
screenName: {
|
|
12
|
+
propDefinition: [
|
|
13
|
+
twitter,
|
|
14
|
+
"screenName",
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
timer: {
|
|
18
|
+
label: "Polling interval",
|
|
19
|
+
description: "Pipedream will poll the Twitter API on this schedule",
|
|
20
|
+
type: "$.interface.timer",
|
|
21
|
+
default: {
|
|
22
|
+
intervalSeconds: 60 * 15,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
dedupe: "unique",
|
|
27
|
+
async run() {
|
|
28
|
+
(await this.twitter.getLikedTweets({
|
|
29
|
+
screenName: this.screen_name,
|
|
30
|
+
})).reverse().forEach((tweet) => {
|
|
31
|
+
this.$emit(this.twitter.enrichTweet(tweet), {
|
|
32
|
+
id: tweet.id_str,
|
|
33
|
+
summary: tweet.full_text,
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
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.9",
|
|
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
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
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.5",
|
|
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
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
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.4",
|
|
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
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import base from "../common/tweets.mjs";
|
|
2
|
+
import baseRetweets from "../watch-retweets-of-my-tweet/watch-retweets-of-my-tweet.mjs";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
...baseRetweets,
|
|
6
|
+
key: "twitter-watch-retweets-of-user-tweet",
|
|
7
|
+
name: "Watch Retweets of User Tweet",
|
|
8
|
+
description: "Emit new event when a specific Tweet from a user is retweeted",
|
|
9
|
+
version: "0.0.4",
|
|
10
|
+
type: "source",
|
|
11
|
+
props: {
|
|
12
|
+
...base.props,
|
|
13
|
+
screenName: {
|
|
14
|
+
propDefinition: [
|
|
15
|
+
base.props.twitter,
|
|
16
|
+
"screenName",
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
tweetId: {
|
|
20
|
+
type: "string",
|
|
21
|
+
label: "Tweet",
|
|
22
|
+
description: "The Tweet to watch for retweets",
|
|
23
|
+
options(context) {
|
|
24
|
+
return this.tweetIdOptions(context);
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
methods: {
|
|
29
|
+
...baseRetweets.methods,
|
|
30
|
+
getScreenName() {
|
|
31
|
+
return this.screenName;
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|