rettiwt-api 1.0.2 → 1.0.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/README.md +1 -1
- package/dist/resolvers/TweetResolver.js +24 -20
- package/dist/resolvers/TweetResolver.js.map +1 -1
- package/dist/resolvers/UserResolver.d.ts +0 -9
- package/dist/resolvers/UserResolver.js +18 -67
- package/dist/resolvers/UserResolver.js.map +1 -1
- package/dist/services/AuthService.d.ts +1 -0
- package/dist/services/AuthService.js +2 -0
- package/dist/services/AuthService.js.map +1 -1
- package/dist/services/FetcherService.d.ts +1 -0
- package/dist/services/FetcherService.js +2 -1
- package/dist/services/FetcherService.js.map +1 -1
- package/dist/services/data/TweetService.js +19 -4
- package/dist/services/data/TweetService.js.map +1 -1
- package/dist/services/data/UserAccountService.d.ts +0 -7
- package/dist/services/data/UserAccountService.js +18 -29
- package/dist/services/data/UserAccountService.js.map +1 -1
- package/dist/services/helper/Extractors.js +1 -1
- package/dist/services/helper/Extractors.js.map +1 -1
- package/dist/services/helper/Urls.js +8 -8
- package/dist/services/helper/Urls.js.map +1 -1
- package/dist/types/Service.d.ts +3 -2
- package/dist/types/raw/tweet/Tweet.d.ts +2 -2
- package/package.json +1 -1
- package/src/resolvers/TweetResolver.ts +8 -8
- package/src/resolvers/UserResolver.ts +6 -57
- package/src/services/AuthService.ts +4 -0
- package/src/services/FetcherService.ts +3 -1
- package/src/services/data/TweetService.ts +16 -1
- package/src/services/data/UserAccountService.ts +15 -26
- package/src/services/helper/Extractors.ts +1 -1
- package/src/services/helper/Urls.ts +8 -8
- package/src/types/Service.ts +3 -2
- package/src/types/raw/tweet/Tweet.ts +2 -2
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ If you wan't full functionality, you need to use the cookie of a logged in Twitt
|
|
|
39
39
|
- For GraphQL Server mode, pass the cookie-string in the header while making a request to the graphql server
|
|
40
40
|
- For npm library mode, pass the cookie-string to the constructor while creating instance of Rettiwt
|
|
41
41
|
|
|
42
|
-
### **If you don't want to risk
|
|
42
|
+
### **If you don't want to risk your twitter account getting banned, using cookies is completely optional and you can omit passing cookie and use the API as guest**
|
|
43
43
|
### **No likes, followers, followings, retweets, replies, tweet likes, quotes can be fetched without using cookie!**
|
|
44
44
|
### **It's completely safe to use the API as a guest and not using cookies, since that way, no form of authentication is used**
|
|
45
45
|
### **If you decide to use cookies for full functionality, I'M NOT RESPONSIBLE IF YOU GET YOU TWITTER ACCOUNT BANNED!**
|
|
@@ -90,10 +90,11 @@ var TweetResolver = /** @class */ (function (_super) {
|
|
|
90
90
|
* @param cursor The cursor to the batch of tweets to fetch
|
|
91
91
|
*/
|
|
92
92
|
TweetResolver.prototype.resolveTweets = function (filter, count, cursor) {
|
|
93
|
+
var _a;
|
|
93
94
|
return __awaiter(this, void 0, void 0, function () {
|
|
94
95
|
var tweets, next, total, batchSize, res;
|
|
95
|
-
return __generator(this, function (
|
|
96
|
-
switch (
|
|
96
|
+
return __generator(this, function (_b) {
|
|
97
|
+
switch (_b.label) {
|
|
97
98
|
case 0:
|
|
98
99
|
tweets = [];
|
|
99
100
|
next = new Service_1.Cursor(cursor);
|
|
@@ -105,16 +106,16 @@ var TweetResolver = /** @class */ (function (_super) {
|
|
|
105
106
|
}
|
|
106
107
|
// If required count less than batch size, setting batch size to required count
|
|
107
108
|
batchSize = (count < batchSize) ? count : batchSize;
|
|
108
|
-
|
|
109
|
+
_b.label = 1;
|
|
109
110
|
case 1:
|
|
110
111
|
if (!(total < count)) return [3 /*break*/, 3];
|
|
111
112
|
// If this is the last batch, change batch size to number of remaining tweets
|
|
112
113
|
batchSize = ((count - total) < batchSize) ? (count - total) : batchSize;
|
|
113
114
|
return [4 /*yield*/, this.context.tweets.getTweets(filter, count, next.value)];
|
|
114
115
|
case 2:
|
|
115
|
-
res =
|
|
116
|
+
res = _b.sent();
|
|
116
117
|
// If data is available
|
|
117
|
-
if (res.list.length) {
|
|
118
|
+
if ((_a = res.list) === null || _a === void 0 ? void 0 : _a.length) {
|
|
118
119
|
// Adding fetched tweets to list of tweets
|
|
119
120
|
tweets = tweets.concat(res.list);
|
|
120
121
|
// Updating total tweets fetched
|
|
@@ -180,10 +181,11 @@ var TweetResolver = /** @class */ (function (_super) {
|
|
|
180
181
|
* @param likesCount The total number of like of the tweet
|
|
181
182
|
*/
|
|
182
183
|
TweetResolver.prototype.resolveTweetLikers = function (id, count, all, cursor, likesCount) {
|
|
184
|
+
var _a;
|
|
183
185
|
return __awaiter(this, void 0, void 0, function () {
|
|
184
186
|
var likers, next, total, batchSize, res;
|
|
185
|
-
return __generator(this, function (
|
|
186
|
-
switch (
|
|
187
|
+
return __generator(this, function (_b) {
|
|
188
|
+
switch (_b.label) {
|
|
187
189
|
case 0:
|
|
188
190
|
likers = [];
|
|
189
191
|
next = new Service_1.Cursor(cursor);
|
|
@@ -193,16 +195,16 @@ var TweetResolver = /** @class */ (function (_super) {
|
|
|
193
195
|
count = (all || count > likesCount) ? likesCount : count;
|
|
194
196
|
// If required count less than batch size, setting batch size to required count
|
|
195
197
|
batchSize = (count < batchSize) ? count : batchSize;
|
|
196
|
-
|
|
198
|
+
_b.label = 1;
|
|
197
199
|
case 1:
|
|
198
200
|
if (!(total < count)) return [3 /*break*/, 3];
|
|
199
201
|
// If this is the last batch, change batch size to number of remaining likers
|
|
200
202
|
batchSize = ((count - total) < batchSize) ? (count - total) : batchSize;
|
|
201
203
|
return [4 /*yield*/, this.context.tweets.getTweetLikers(id, count, next.value)];
|
|
202
204
|
case 2:
|
|
203
|
-
res =
|
|
205
|
+
res = _b.sent();
|
|
204
206
|
// If data is available
|
|
205
|
-
if (res.list.length) {
|
|
207
|
+
if ((_a = res.list) === null || _a === void 0 ? void 0 : _a.length) {
|
|
206
208
|
// Adding fetched likers to list of likers
|
|
207
209
|
likers = likers.concat(res.list);
|
|
208
210
|
// Updating total likers fetched
|
|
@@ -232,10 +234,11 @@ var TweetResolver = /** @class */ (function (_super) {
|
|
|
232
234
|
* @param retweetsCount The total number of retweets of the
|
|
233
235
|
*/
|
|
234
236
|
TweetResolver.prototype.resolveTweetRetweeters = function (id, count, all, cursor, retweetsCount) {
|
|
237
|
+
var _a;
|
|
235
238
|
return __awaiter(this, void 0, void 0, function () {
|
|
236
239
|
var retweeters, next, total, batchSize, res;
|
|
237
|
-
return __generator(this, function (
|
|
238
|
-
switch (
|
|
240
|
+
return __generator(this, function (_b) {
|
|
241
|
+
switch (_b.label) {
|
|
239
242
|
case 0:
|
|
240
243
|
retweeters = [];
|
|
241
244
|
next = new Service_1.Cursor(cursor);
|
|
@@ -245,16 +248,16 @@ var TweetResolver = /** @class */ (function (_super) {
|
|
|
245
248
|
count = (all || count > retweetsCount) ? retweetsCount : count;
|
|
246
249
|
// If required count less than batch size, setting batch size to required count
|
|
247
250
|
batchSize = (count < batchSize) ? count : batchSize;
|
|
248
|
-
|
|
251
|
+
_b.label = 1;
|
|
249
252
|
case 1:
|
|
250
253
|
if (!(total < count)) return [3 /*break*/, 3];
|
|
251
254
|
// If this is the last batch, change batch size to number of remaining retweeters
|
|
252
255
|
batchSize = ((count - total) < batchSize) ? (count - total) : batchSize;
|
|
253
256
|
return [4 /*yield*/, this.context.tweets.getTweetRetweeters(id, count, next.value)];
|
|
254
257
|
case 2:
|
|
255
|
-
res =
|
|
258
|
+
res = _b.sent();
|
|
256
259
|
// If data is available
|
|
257
|
-
if (res.list.length) {
|
|
260
|
+
if ((_a = res.list) === null || _a === void 0 ? void 0 : _a.length) {
|
|
258
261
|
// Adding fetched retweeters to list of retweeters
|
|
259
262
|
retweeters = retweeters.concat(res.list);
|
|
260
263
|
// Updating total retweeters fetched
|
|
@@ -284,24 +287,25 @@ var TweetResolver = /** @class */ (function (_super) {
|
|
|
284
287
|
* @param repliesCount The total number of replies to the target tweet
|
|
285
288
|
*/
|
|
286
289
|
TweetResolver.prototype.resolveTweetReplies = function (id, count, all, cursor, repliesCount) {
|
|
290
|
+
var _a;
|
|
287
291
|
return __awaiter(this, void 0, void 0, function () {
|
|
288
292
|
var replies, next, total, res;
|
|
289
|
-
return __generator(this, function (
|
|
290
|
-
switch (
|
|
293
|
+
return __generator(this, function (_b) {
|
|
294
|
+
switch (_b.label) {
|
|
291
295
|
case 0:
|
|
292
296
|
replies = [];
|
|
293
297
|
next = new Service_1.Cursor(cursor);
|
|
294
298
|
total = 0;
|
|
295
299
|
// If all replies are to be fetched
|
|
296
300
|
count = (all || count > repliesCount) ? repliesCount : count;
|
|
297
|
-
|
|
301
|
+
_b.label = 1;
|
|
298
302
|
case 1:
|
|
299
303
|
if (!(total < count)) return [3 /*break*/, 3];
|
|
300
304
|
return [4 /*yield*/, this.context.tweets.getTweetReplies(id, next.value)];
|
|
301
305
|
case 2:
|
|
302
|
-
res =
|
|
306
|
+
res = _b.sent();
|
|
303
307
|
// If data is available
|
|
304
|
-
if (res.list.length) {
|
|
308
|
+
if ((_a = res.list) === null || _a === void 0 ? void 0 : _a.length) {
|
|
305
309
|
// Adding fetched replies to list of replies
|
|
306
310
|
replies = replies.concat(res.list);
|
|
307
311
|
// Updating total replies fetched
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TweetResolver.js","sourceRoot":"","sources":["../../src/resolvers/TweetResolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAY;AACZ,gEAA0C;AAI1C,4CAAuD;AAEvD,UAAU;AACV,kDAA2D;AAE3D;IAA2C,iCAAY;IACnD,iBAAiB;IACjB,uBAAY,OAAoB;eAC5B,kBAAM,OAAO,CAAC;IAClB,CAAC;IAED;;;OAGG;IACG,oCAAY,GAAlB,UAAmB,EAAU;;;;;4BAEf,qBAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,EAAA;;wBAAhD,GAAG,GAAG,SAA0C;wBAEpD,sBAAsB;wBACtB,sBAAO,GAAG,EAAC;;;;KACd;IAED;;;;;OAKG;I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;;;wBAGL,+CAA+C;wBAC/C,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;wBAEnB,sBAAO,OAAO,EAAC;;;;KAClB;IACL,oBAAC;AAAD,CAAC,AAtPD,CAA2C,yBAAY,GAsPtD"}
|
|
@@ -35,13 +35,4 @@ export default class UserResolver extends ResolverBase {
|
|
|
35
35
|
* @param followingsCount The total number of followings of the target user
|
|
36
36
|
*/
|
|
37
37
|
resolveUserFollowing(id: string, count: number, all: boolean, cursor: string, followingsCount: number): Promise<any>;
|
|
38
|
-
/**
|
|
39
|
-
* @returns The list of tweets made by the given user
|
|
40
|
-
* @param id The id of the user whose tweets are to be fetched
|
|
41
|
-
* @param count The number of tweets to fetch
|
|
42
|
-
* @param all Whether to fetch list of all tweets made by user
|
|
43
|
-
* @param cursor The cursor to the batch of tweets to fetch
|
|
44
|
-
* @param statusesCount The total number of tweets made by target user
|
|
45
|
-
*/
|
|
46
|
-
resolveUserTweets(id: string, count: number, all: boolean, cursor: string, statusesCount: number): Promise<any>;
|
|
47
38
|
}
|
|
@@ -97,10 +97,11 @@ var UserResolver = /** @class */ (function (_super) {
|
|
|
97
97
|
* @param favouritesCount The total number of tweets liked by target user
|
|
98
98
|
*/
|
|
99
99
|
UserResolver.prototype.resolveUserLikes = function (id, count, all, cursor, favouritesCount) {
|
|
100
|
+
var _a;
|
|
100
101
|
return __awaiter(this, void 0, void 0, function () {
|
|
101
102
|
var likes, next, total, batchSize, res;
|
|
102
|
-
return __generator(this, function (
|
|
103
|
-
switch (
|
|
103
|
+
return __generator(this, function (_b) {
|
|
104
|
+
switch (_b.label) {
|
|
104
105
|
case 0:
|
|
105
106
|
likes = [];
|
|
106
107
|
next = new Service_1.Cursor(cursor);
|
|
@@ -110,16 +111,16 @@ var UserResolver = /** @class */ (function (_super) {
|
|
|
110
111
|
count = all ? favouritesCount : count;
|
|
111
112
|
// If required count less than batch size, setting batch size to required count
|
|
112
113
|
batchSize = (count < batchSize) ? count : batchSize;
|
|
113
|
-
|
|
114
|
+
_b.label = 1;
|
|
114
115
|
case 1:
|
|
115
116
|
if (!(total < count)) return [3 /*break*/, 3];
|
|
116
117
|
// If this is the last batch, change batch size to number of remaining tweets
|
|
117
118
|
batchSize = ((count - total) < batchSize) ? (count - total) : batchSize;
|
|
118
119
|
return [4 /*yield*/, this.context.users.getUserLikes(id, count, next.value)];
|
|
119
120
|
case 2:
|
|
120
|
-
res =
|
|
121
|
+
res = _b.sent();
|
|
121
122
|
// If data is available
|
|
122
|
-
if (res.list.length) {
|
|
123
|
+
if ((_a = res.list) === null || _a === void 0 ? void 0 : _a.length) {
|
|
123
124
|
// Adding fetched tweets to list of tweets
|
|
124
125
|
likes = likes.concat(res.list);
|
|
125
126
|
// Updating total tweets fetched
|
|
@@ -149,10 +150,11 @@ var UserResolver = /** @class */ (function (_super) {
|
|
|
149
150
|
* @param followerCount The total number of followers of the target user
|
|
150
151
|
*/
|
|
151
152
|
UserResolver.prototype.resolveUserFollowers = function (id, count, all, cursor, followersCount) {
|
|
153
|
+
var _a;
|
|
152
154
|
return __awaiter(this, void 0, void 0, function () {
|
|
153
155
|
var followers, next, total, batchSize, res;
|
|
154
|
-
return __generator(this, function (
|
|
155
|
-
switch (
|
|
156
|
+
return __generator(this, function (_b) {
|
|
157
|
+
switch (_b.label) {
|
|
156
158
|
case 0:
|
|
157
159
|
followers = [];
|
|
158
160
|
next = new Service_1.Cursor(cursor);
|
|
@@ -162,16 +164,16 @@ var UserResolver = /** @class */ (function (_super) {
|
|
|
162
164
|
count = (all || count > followersCount) ? followersCount : count;
|
|
163
165
|
// If required count less than batch size, setting batch size to required count
|
|
164
166
|
batchSize = (count < batchSize) ? count : batchSize;
|
|
165
|
-
|
|
167
|
+
_b.label = 1;
|
|
166
168
|
case 1:
|
|
167
169
|
if (!(total < count)) return [3 /*break*/, 3];
|
|
168
170
|
// If this is the last batch, change batch size to number of remaining followers
|
|
169
171
|
batchSize = ((count - total) < batchSize) ? (count - total) : batchSize;
|
|
170
172
|
return [4 /*yield*/, this.context.users.getUserFollowers(id, count, next.value)];
|
|
171
173
|
case 2:
|
|
172
|
-
res =
|
|
174
|
+
res = _b.sent();
|
|
173
175
|
// If data is available
|
|
174
|
-
if (res.list.length) {
|
|
176
|
+
if ((_a = res.list) === null || _a === void 0 ? void 0 : _a.length) {
|
|
175
177
|
// Adding fetched followers to list of followers
|
|
176
178
|
followers = followers.concat(res.list);
|
|
177
179
|
// Updating total followers fetched
|
|
@@ -201,10 +203,11 @@ var UserResolver = /** @class */ (function (_super) {
|
|
|
201
203
|
* @param followingsCount The total number of followings of the target user
|
|
202
204
|
*/
|
|
203
205
|
UserResolver.prototype.resolveUserFollowing = function (id, count, all, cursor, followingsCount) {
|
|
206
|
+
var _a;
|
|
204
207
|
return __awaiter(this, void 0, void 0, function () {
|
|
205
208
|
var following, next, total, batchSize, res;
|
|
206
|
-
return __generator(this, function (
|
|
207
|
-
switch (
|
|
209
|
+
return __generator(this, function (_b) {
|
|
210
|
+
switch (_b.label) {
|
|
208
211
|
case 0:
|
|
209
212
|
following = [];
|
|
210
213
|
next = new Service_1.Cursor(cursor);
|
|
@@ -214,16 +217,16 @@ var UserResolver = /** @class */ (function (_super) {
|
|
|
214
217
|
count = (all || count > followingsCount) ? followingsCount : count;
|
|
215
218
|
// If required count less than batch size, setting batch size to required count
|
|
216
219
|
batchSize = (count < batchSize) ? count : batchSize;
|
|
217
|
-
|
|
220
|
+
_b.label = 1;
|
|
218
221
|
case 1:
|
|
219
222
|
if (!(total < count)) return [3 /*break*/, 3];
|
|
220
223
|
// If this is the last batch, change batch size to number of remaining following
|
|
221
224
|
batchSize = ((count - total) < batchSize) ? (count - total) : batchSize;
|
|
222
225
|
return [4 /*yield*/, this.context.users.getUserFollowing(id, count, next.value)];
|
|
223
226
|
case 2:
|
|
224
|
-
res =
|
|
227
|
+
res = _b.sent();
|
|
225
228
|
// If data is available
|
|
226
|
-
if (res.list.length) {
|
|
229
|
+
if ((_a = res.list) === null || _a === void 0 ? void 0 : _a.length) {
|
|
227
230
|
// Adding fetched following to list of following
|
|
228
231
|
following = following.concat(res.list);
|
|
229
232
|
// Updating total following fetched
|
|
@@ -244,58 +247,6 @@ var UserResolver = /** @class */ (function (_super) {
|
|
|
244
247
|
});
|
|
245
248
|
});
|
|
246
249
|
};
|
|
247
|
-
/**
|
|
248
|
-
* @returns The list of tweets made by the given user
|
|
249
|
-
* @param id The id of the user whose tweets are to be fetched
|
|
250
|
-
* @param count The number of tweets to fetch
|
|
251
|
-
* @param all Whether to fetch list of all tweets made by user
|
|
252
|
-
* @param cursor The cursor to the batch of tweets to fetch
|
|
253
|
-
* @param statusesCount The total number of tweets made by target user
|
|
254
|
-
*/
|
|
255
|
-
UserResolver.prototype.resolveUserTweets = function (id, count, all, cursor, statusesCount) {
|
|
256
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
257
|
-
var tweets, next, total, batchSize, res;
|
|
258
|
-
return __generator(this, function (_a) {
|
|
259
|
-
switch (_a.label) {
|
|
260
|
-
case 0:
|
|
261
|
-
tweets = [];
|
|
262
|
-
next = new Service_1.Cursor(cursor);
|
|
263
|
-
total = 0;
|
|
264
|
-
batchSize = 20;
|
|
265
|
-
// If all tweets are to be fetched
|
|
266
|
-
count = all ? statusesCount : count;
|
|
267
|
-
// If required count less than batch size, setting batch size to required count
|
|
268
|
-
batchSize = (count < batchSize) ? count : batchSize;
|
|
269
|
-
_a.label = 1;
|
|
270
|
-
case 1:
|
|
271
|
-
if (!(total < count)) return [3 /*break*/, 3];
|
|
272
|
-
// If this is the last batch, change batch size to number of remaining tweets
|
|
273
|
-
batchSize = ((count - total) < batchSize) ? (count - total) : batchSize;
|
|
274
|
-
return [4 /*yield*/, this.context.users.getUserTweets(id, count, next.value)];
|
|
275
|
-
case 2:
|
|
276
|
-
res = _a.sent();
|
|
277
|
-
// If data is available
|
|
278
|
-
if (res.list.length) {
|
|
279
|
-
// Adding fetched tweets to list of tweets
|
|
280
|
-
tweets = tweets.concat(res.list);
|
|
281
|
-
// Updating total tweets fetched
|
|
282
|
-
total = tweets.length;
|
|
283
|
-
// Getting cursor to next batch
|
|
284
|
-
next = res.next;
|
|
285
|
-
}
|
|
286
|
-
// If no more data is available
|
|
287
|
-
else {
|
|
288
|
-
return [3 /*break*/, 3];
|
|
289
|
-
}
|
|
290
|
-
return [3 /*break*/, 1];
|
|
291
|
-
case 3:
|
|
292
|
-
// Adding the cursor to the end of list of data
|
|
293
|
-
tweets.push(next);
|
|
294
|
-
return [2 /*return*/, tweets];
|
|
295
|
-
}
|
|
296
|
-
});
|
|
297
|
-
});
|
|
298
|
-
};
|
|
299
250
|
return UserResolver;
|
|
300
251
|
}(ResolverBase_1["default"]));
|
|
301
252
|
exports["default"] = UserResolver;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserResolver.js","sourceRoot":"","sources":["../../src/resolvers/UserResolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAY;AACZ,gEAA0C;AAE1C,QAAQ;AACR,4CAAuD;AAEvD,UAAU;AACV,kDAA2D;AAE3D;IAA0C,gCAAY;IAClD,iBAAiB;IACjB,sBAAY,OAAoB;eAC5B,kBAAM,OAAO,CAAC;IAClB,CAAC;IAED;;;;OAIG;IACG,yCAAkB,GAAxB,UAAyB,QAAgB,EAAE,EAAU;;;;;6BAE7C,QAAQ,EAAR,wBAAQ;wBACD,qBAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,QAAQ,CAAC,EAAA;4BAA/D,sBAAO,SAAwD,EAAC;;6BAG3D,EAAE,EAAF,wBAAE;wBACA,qBAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,yBAAyB,CAAC,EAAE,CAAC,EAAA;4BAA7D,sBAAO,SAAsD,EAAC;4BAI9D,MAAM,IAAI,KAAK,CAAC,yBAAgB,CAAC,oBAAoB,CAAC,CAAC;;;;K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AAC;wBAE3B,sCAAsC;wBACtC,KAAK,GAAG,CAAC,GAAG,IAAI,KAAK,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC;wBAEnE,+EAA+E;wBAC/E,SAAS,GAAG,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;;;6BAG7C,CAAA,KAAK,GAAG,KAAK,CAAA;wBAChB,gFAAgF;wBAChF,SAAS,GAAG,CAAC,CAAC,KAAK,GAAG,KAAK,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;wBAG5D,qBAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,EAAA;;wBAAtE,GAAG,GAAG,SAAgE;wBAE5E,uBAAuB;wBACvB,IAAI,MAAA,GAAG,CAAC,IAAI,0CAAE,MAAM,EAAE;4BAClB,gDAAgD;4BAChD,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;4BAEvC,mCAAmC;4BACnC,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC;4BAEzB,+BAA+B;4BAC/B,IAAI,GAAG,GAAG,CAAC,IAAc,CAAC;yBAC7B;wBACD,+BAA+B;6BAC1B;4BACD,wBAAM;yBACT;;;wBAGL,+CAA+C;wBAC/C,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;wBAErB,sBAAO,SAAS,EAAC;;;;KACpB;IACL,mBAAC;AAAD,CAAC,AAlLD,CAA0C,yBAAY,GAkLrD"}
|
|
@@ -5,6 +5,7 @@ import { GuestCredentials, AuthCredentials } from '../types/Authentication';
|
|
|
5
5
|
export declare class AuthService {
|
|
6
6
|
private authToken;
|
|
7
7
|
private credentials;
|
|
8
|
+
isAuthenticated: boolean;
|
|
8
9
|
constructor(cookie?: string);
|
|
9
10
|
/**
|
|
10
11
|
* @returns The current authentication credentials. A different credential is returned each time this is invoked
|
|
@@ -55,6 +55,8 @@ var AuthService = /** @class */ (function () {
|
|
|
55
55
|
if (cookie === void 0) { cookie = ''; }
|
|
56
56
|
// Reading the auth token from the config, since it's always the same
|
|
57
57
|
this.authToken = env_1.config.twitter_auth_token;
|
|
58
|
+
// Setting authentication status
|
|
59
|
+
this.isAuthenticated = cookie != '';
|
|
58
60
|
// Setting up the authenticated credentials
|
|
59
61
|
/**
|
|
60
62
|
* The following regex pattern is used to extract the csrfToken from the cookie string.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthService.js","sourceRoot":"","sources":["../../src/services/AuthService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,UAAU;AACV,gDAA0B;AAE1B,OAAO;AACP,sCAA8C;AAK9C,UAAU;AACV,qCAAuC;AAEvC;;GAEG;AACH;
|
|
1
|
+
{"version":3,"file":"AuthService.js","sourceRoot":"","sources":["../../src/services/AuthService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,UAAU;AACV,gDAA0B;AAE1B,OAAO;AACP,sCAA8C;AAK9C,UAAU;AACV,qCAAuC;AAEvC;;GAEG;AACH;IAMI,iBAAiB;IACjB,qBAAY,MAAmB;QAAnB,uBAAA,EAAA,WAAmB;QAC3B,qEAAqE;QACrE,IAAI,CAAC,SAAS,GAAG,YAAM,CAAC,kBAAkB,CAAC;QAE3C,gCAAgC;QAChC,IAAI,CAAC,eAAe,GAAG,MAAM,IAAI,EAAE,CAAC;QAEpC,2CAA2C;QAC3C;;;;;WAKG;QACH,IAAI,CAAC,WAAW,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,MAAM,EAAC,CAAC;IAEvH,CAAC;IAED;;OAEG;IACG,wCAAkB,GAAxB;;;gBACI,sBAAO,IAAI,CAAC,WAAW,EAAC;;;KAC3B;IAED;;OAEG;IACG,yCAAmB,GAAzB;;;;;4BAEW,qBAAM,kBAAK,CAAC,IAAI,CAA0B,IAAA,oBAAa,GAAE,EAAE,IAAI,EAAE;4BACpE,OAAO,EAAE;gCACL,eAAe,EAAE,IAAI,CAAC,SAAS;6BAClC;yBACJ,CAAC,CAAC,IAAI,CAAC,UAAA,GAAG,IAAI,OAAA,CAAC;4BACZ,SAAS,EAAE,KAAI,CAAC,SAAS;4BACzB,UAAU,EAAE,GAAG,CAAC,IAAI,CAAC,WAAW;yBACnC,CAAC,EAHa,CAGb,CAAC,EAAA;;oBARH,6CAA6C;oBAC7C,sBAAO,SAOJ,EAAC;;;;KACP;IACL,kBAAC;AAAD,CAAC,AA9CD,IA8CC;AA9CY,kCAAW"}
|
|
@@ -5,6 +5,7 @@ import { AuthService } from './AuthService';
|
|
|
5
5
|
*/
|
|
6
6
|
export declare class FetcherService {
|
|
7
7
|
private auth;
|
|
8
|
+
protected isAuthenticated: boolean;
|
|
8
9
|
constructor(auth: AuthService);
|
|
9
10
|
/**
|
|
10
11
|
* @summary Throws the appropriate http error after evaluation of the status code of reponse
|
|
@@ -75,6 +75,7 @@ var FetcherService = /** @class */ (function () {
|
|
|
75
75
|
// MEMBER METHODS
|
|
76
76
|
function FetcherService(auth) {
|
|
77
77
|
this.auth = auth;
|
|
78
|
+
this.isAuthenticated = this.auth.isAuthenticated;
|
|
78
79
|
}
|
|
79
80
|
/**
|
|
80
81
|
* @summary Throws the appropriate http error after evaluation of the status code of reponse
|
|
@@ -92,7 +93,7 @@ var FetcherService = /** @class */ (function () {
|
|
|
92
93
|
* @param authenticated Whether to authenticate requests or not
|
|
93
94
|
*/
|
|
94
95
|
FetcherService.prototype.request = function (url, authenticated) {
|
|
95
|
-
if (authenticated === void 0) { authenticated =
|
|
96
|
+
if (authenticated === void 0) { authenticated = true; }
|
|
96
97
|
return __awaiter(this, void 0, void 0, function () {
|
|
97
98
|
var res, _a, _b, _c, _d, _e, _f, _g, _h;
|
|
98
99
|
var _j;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FetcherService.js","sourceRoot":"","sources":["../../src/services/FetcherService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,WAAW;AACX,6CAAkD;AAIlD,+CAA8C;AAE9C,QAAQ;AACR,sCAA2C;AAI3C,UAAU;AACV,wDAA2C;AAC3C,oEAAwD;AAExD;;GAEG;AACH;
|
|
1
|
+
{"version":3,"file":"FetcherService.js","sourceRoot":"","sources":["../../src/services/FetcherService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,WAAW;AACX,6CAAkD;AAIlD,+CAA8C;AAE9C,QAAQ;AACR,sCAA2C;AAI3C,UAAU;AACV,wDAA2C;AAC3C,oEAAwD;AAExD;;GAEG;AACH;IAKI,iBAAiB;IACjB,wBAAY,IAAiB;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC;IACrD,CAAC;IAED;;;MAGE;IACM,wCAAe,GAAvB,UAAwB,GAAgB;QACpC,IAAI,GAAG,CAAC,UAAU,IAAI,GAAG,IAAI,GAAG,CAAC,UAAU,IAAI,iBAAU,EAAE;YACvD,MAAM,IAAI,KAAK,CAAC,iBAAU,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAA;SAC9C;QAED,OAAO,GAAG,CAAC;IACf,CAAC;IAED;;;;OAIG;IACa,gCAAO,GAAvB,UAAkC,GAAW,EAAE,a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ACvB;IAED;;;OAGG;IACa,iCAAQ,GAAxB,UAAyB,EAAU;;;;;4BAEnB,qBAAM,2BAAY,CAAC,WAAW,EAAE,EAAA;;wBAAxC,KAAK,GAAG,SAAgC;wBAE5C,0BAA0B;wBAC1B,sBAAO,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,EAAC;;;;KACzB;IACL,qBAAC;AAAD,CAAC,AAlED,IAkEC;AAlEY,wCAAc"}
|
|
@@ -134,7 +134,7 @@ var TweetService = /** @class */ (function (_super) {
|
|
|
134
134
|
cachedData = _a.sent();
|
|
135
135
|
if (!cachedData) return [3 /*break*/, 2];
|
|
136
136
|
return [2 /*return*/, cachedData];
|
|
137
|
-
case 2: return [4 /*yield*/, this.request(Urls.tweetDetailsUrl(tweetId)).then(function (res) { return res.data; })];
|
|
137
|
+
case 2: return [4 /*yield*/, this.request(Urls.tweetDetailsUrl(tweetId), false).then(function (res) { return res.data; })];
|
|
138
138
|
case 3:
|
|
139
139
|
res = _a.sent();
|
|
140
140
|
data = Extractors.extractTweet(res, tweetId);
|
|
@@ -157,7 +157,12 @@ var TweetService = /** @class */ (function (_super) {
|
|
|
157
157
|
var res, data, users;
|
|
158
158
|
return __generator(this, function (_a) {
|
|
159
159
|
switch (_a.label) {
|
|
160
|
-
case 0:
|
|
160
|
+
case 0:
|
|
161
|
+
// If user is not authenticated, abort
|
|
162
|
+
if (!this.isAuthenticated) {
|
|
163
|
+
return [2 /*return*/, { error: new Error('Cannot fetch tweet likes without authentication!') }];
|
|
164
|
+
}
|
|
165
|
+
return [4 /*yield*/, this.request(Urls.tweetLikesUrl(tweetId, count, cursor)).then(function (res) { return res.data; })];
|
|
161
166
|
case 1:
|
|
162
167
|
res = _a.sent();
|
|
163
168
|
data = Extractors.extractTweetLikers(res);
|
|
@@ -183,7 +188,12 @@ var TweetService = /** @class */ (function (_super) {
|
|
|
183
188
|
var res, data, users;
|
|
184
189
|
return __generator(this, function (_a) {
|
|
185
190
|
switch (_a.label) {
|
|
186
|
-
case 0:
|
|
191
|
+
case 0:
|
|
192
|
+
// If user is not authenticated, abort
|
|
193
|
+
if (!this.isAuthenticated) {
|
|
194
|
+
return [2 /*return*/, { error: new Error('Cannot fetch tweet retweeters without authentication!') }];
|
|
195
|
+
}
|
|
196
|
+
return [4 /*yield*/, this.request(Urls.tweetRetweetUrl(tweetId, count, cursor)).then(function (res) { return res.data; })];
|
|
187
197
|
case 1:
|
|
188
198
|
res = _a.sent();
|
|
189
199
|
data = Extractors.extractTweetRetweeters(res);
|
|
@@ -208,7 +218,12 @@ var TweetService = /** @class */ (function (_super) {
|
|
|
208
218
|
var res, data, tweets;
|
|
209
219
|
return __generator(this, function (_a) {
|
|
210
220
|
switch (_a.label) {
|
|
211
|
-
case 0:
|
|
221
|
+
case 0:
|
|
222
|
+
// If user is not authenticated, abort
|
|
223
|
+
if (!this.isAuthenticated) {
|
|
224
|
+
return [2 /*return*/, { error: new Error('Cannot fetch tweet replies without authentication!') }];
|
|
225
|
+
}
|
|
226
|
+
return [4 /*yield*/, this.request(Urls.tweetRepliesUrl(tweetId, cursor)).then(function (res) { return res.data; })];
|
|
212
227
|
case 1:
|
|
213
228
|
res = _a.sent();
|
|
214
229
|
data = Extractors.extractTweetReplies(res, tweetId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TweetService.js","sourceRoot":"","sources":["../../../src/services/data/TweetService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,WAAW;AACX,oDAAmD;AAYnD,OAAO;AACP,mDAAuC;AAEvC,aAAa;AACb,+DAAmD;AAEnD,gBAAgB;AAChB,qEAAyD;AAEzD,UAAU;AACV,2CAAiD;AAEjD;;GAEG;AACH;IAAkC,gCAAc;IAC5C,iBAAiB;IACjB,sBAAY,IAAiB;eACzB,kBAAM,IAAI,CAAC;IACf,CAAC;IAED;;;;;OAKG;IACG,g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wBAA/F,GAAG,GAAG,SAAyF;wBAG/F,IAAI,GAAG,UAAU,CAAC,mBAAmB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;wBAExD,eAAe;wBACf,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;wBAGjB,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAA,IAAI,IAAI,OAAA,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,EAA3B,CAA2B,CAAC,CAAC;wBAEpE,sBAAO;gCACH,IAAI,EAAE,MAAM;gCACZ,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE;6BAC/B,EAAC;;;;KACL;IACL,mBAAC;AAAD,CAAC,AArJD,CAAkC,+BAAc,GAqJ/C;AArJY,oCAAY"}
|
|
@@ -39,11 +39,4 @@ export declare class UserAccountService extends FetcherService {
|
|
|
39
39
|
* @param cursor The cursor to next batch. If blank, first batch is fetched
|
|
40
40
|
*/
|
|
41
41
|
getUserLikes(userId: string, count: number, cursor: string): Promise<CursoredData<Tweet>>;
|
|
42
|
-
/**
|
|
43
|
-
* @returns The list of tweets made by the target user
|
|
44
|
-
* @param userId The rest id of the target user
|
|
45
|
-
* @param count The batch size of the list
|
|
46
|
-
* @param cursor The cursor to next batch. If blank, first batch is fetched
|
|
47
|
-
*/
|
|
48
|
-
getUserTweets(userId: string, count: number, cursor: string): Promise<CursoredData<Tweet>>;
|
|
49
42
|
}
|
|
@@ -150,7 +150,12 @@ var UserAccountService = /** @class */ (function (_super) {
|
|
|
150
150
|
var res, data, users;
|
|
151
151
|
return __generator(this, function (_a) {
|
|
152
152
|
switch (_a.label) {
|
|
153
|
-
case 0:
|
|
153
|
+
case 0:
|
|
154
|
+
// If user is not authenticated, abort
|
|
155
|
+
if (!this.isAuthenticated) {
|
|
156
|
+
return [2 /*return*/, { error: new Error('Cannot fetch user following without authentication!') }];
|
|
157
|
+
}
|
|
158
|
+
return [4 /*yield*/, this.request(Urls.userFollowingUrl(userId, count, cursor)).then(function (res) { return res.data; })];
|
|
154
159
|
case 1:
|
|
155
160
|
res = _a.sent();
|
|
156
161
|
data = Extractors.extractUserFollow(res);
|
|
@@ -176,7 +181,12 @@ var UserAccountService = /** @class */ (function (_super) {
|
|
|
176
181
|
var res, data, users;
|
|
177
182
|
return __generator(this, function (_a) {
|
|
178
183
|
switch (_a.label) {
|
|
179
|
-
case 0:
|
|
184
|
+
case 0:
|
|
185
|
+
// If user is not authenticated, abort
|
|
186
|
+
if (!this.isAuthenticated) {
|
|
187
|
+
return [2 /*return*/, { error: new Error('Cannot fetch user followers without authentication!') }];
|
|
188
|
+
}
|
|
189
|
+
return [4 /*yield*/, this.request(Urls.userFollowersUrl(userId, (count > 20) ? (count - 20) : count, cursor)).then(function (res) { return res.data; })];
|
|
180
190
|
case 1:
|
|
181
191
|
res = _a.sent();
|
|
182
192
|
data = Extractors.extractUserFollow(res);
|
|
@@ -202,7 +212,12 @@ var UserAccountService = /** @class */ (function (_super) {
|
|
|
202
212
|
var res, data, tweets;
|
|
203
213
|
return __generator(this, function (_a) {
|
|
204
214
|
switch (_a.label) {
|
|
205
|
-
case 0:
|
|
215
|
+
case 0:
|
|
216
|
+
// If user is not authenticated, abort
|
|
217
|
+
if (!this.isAuthenticated) {
|
|
218
|
+
return [2 /*return*/, { error: new Error('Cannot fetch user likes without authentication!') }];
|
|
219
|
+
}
|
|
220
|
+
return [4 /*yield*/, this.request(Urls.userLikesUrl(userId, count, cursor)).then(function (res) { return res.data; })];
|
|
206
221
|
case 1:
|
|
207
222
|
res = _a.sent();
|
|
208
223
|
data = Extractors.extractUserLikes(res);
|
|
@@ -217,32 +232,6 @@ var UserAccountService = /** @class */ (function (_super) {
|
|
|
217
232
|
});
|
|
218
233
|
});
|
|
219
234
|
};
|
|
220
|
-
/**
|
|
221
|
-
* @returns The list of tweets made by the target user
|
|
222
|
-
* @param userId The rest id of the target user
|
|
223
|
-
* @param count The batch size of the list
|
|
224
|
-
* @param cursor The cursor to next batch. If blank, first batch is fetched
|
|
225
|
-
*/
|
|
226
|
-
UserAccountService.prototype.getUserTweets = function (userId, count, cursor) {
|
|
227
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
228
|
-
var res, data, tweets;
|
|
229
|
-
return __generator(this, function (_a) {
|
|
230
|
-
switch (_a.label) {
|
|
231
|
-
case 0: return [4 /*yield*/, this.request(Urls.userTweetsUrl(userId, count, cursor)).then(function (res) { return res.data; })];
|
|
232
|
-
case 1:
|
|
233
|
-
res = _a.sent();
|
|
234
|
-
data = Extractors.extractUserTweets(res);
|
|
235
|
-
// Caching data
|
|
236
|
-
this.cacheData(data);
|
|
237
|
-
tweets = data.required.map(function (item) { return Deserializers.toTweet(item); });
|
|
238
|
-
return [2 /*return*/, {
|
|
239
|
-
list: tweets,
|
|
240
|
-
next: { value: data.cursor }
|
|
241
|
-
}];
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
});
|
|
245
|
-
};
|
|
246
235
|
return UserAccountService;
|
|
247
236
|
}(FetcherService_1.FetcherService));
|
|
248
237
|
exports.UserAccountService = UserAccountService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserAccountService.js","sourceRoot":"","sources":["../../../src/services/data/UserAccountService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,WAAW;AACX,oDAAmD;
|
|
1
|
+
{"version":3,"file":"UserAccountService.js","sourceRoot":"","sources":["../../../src/services/data/UserAccountService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,WAAW;AACX,oDAAmD;AAYnD,OAAO;AACP,mDAAuC;AAEvC,aAAa;AACb,+DAAmD;AAEnD,gBAAgB;AAChB,qEAAyD;AAEzD;;GAEG;AACH;IA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