rettiwt-api 4.2.0-alpha.1 → 4.2.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/.eslintrc.js +35 -0
- package/.github/workflows/documentation.yml +1 -4
- package/.github/workflows/publish-alpha.yml +1 -4
- package/.github/workflows/publish.yml +1 -4
- package/.tool-versions +1 -1
- package/README.md +14 -8
- package/dist/Rettiwt.d.ts +3 -0
- package/dist/Rettiwt.js +2 -0
- package/dist/Rettiwt.js.map +1 -1
- package/dist/cli.js +2 -0
- package/dist/cli.js.map +1 -1
- package/dist/collections/Extractors.d.ts +3 -1
- package/dist/collections/Extractors.js +6 -0
- package/dist/collections/Extractors.js.map +1 -1
- package/dist/collections/Groups.js +2 -0
- package/dist/collections/Groups.js.map +1 -1
- package/dist/collections/Requests.js +3 -1
- package/dist/collections/Requests.js.map +1 -1
- package/dist/commands/List.d.ts +10 -0
- package/dist/commands/List.js +104 -0
- package/dist/commands/List.js.map +1 -0
- package/dist/commands/Tweet.js +2 -1
- package/dist/commands/Tweet.js.map +1 -1
- package/dist/commands/User.js +62 -39
- package/dist/commands/User.js.map +1 -1
- package/dist/enums/Resource.d.ts +2 -0
- package/dist/enums/Resource.js +2 -0
- package/dist/enums/Resource.js.map +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.js +0 -3
- package/dist/index.js.map +1 -1
- package/dist/models/args/FetchArgs.d.ts +6 -0
- package/dist/models/args/FetchArgs.js +24 -2
- package/dist/models/args/FetchArgs.js.map +1 -1
- package/dist/models/data/Tweet.d.ts +18 -0
- package/dist/models/data/Tweet.js +62 -7
- package/dist/models/data/Tweet.js.map +1 -1
- package/dist/models/data/User.js +1 -1
- package/dist/models/data/User.js.map +1 -1
- package/dist/services/public/AuthService.js +1 -1
- package/dist/services/public/AuthService.js.map +1 -1
- package/dist/services/public/FetcherService.d.ts +5 -5
- package/dist/services/public/FetcherService.js +12 -12
- package/dist/services/public/FetcherService.js.map +1 -1
- package/dist/services/public/ListService.d.ts +71 -0
- package/dist/services/public/ListService.js +169 -0
- package/dist/services/public/ListService.js.map +1 -0
- package/dist/services/public/UserService.d.ts +26 -0
- package/dist/services/public/UserService.js +44 -0
- package/dist/services/public/UserService.js.map +1 -1
- package/package.json +3 -4
- package/src/Rettiwt.ts +5 -0
- package/src/cli.ts +2 -0
- package/src/collections/Extractors.ts +7 -1
- package/src/collections/Groups.ts +2 -0
- package/src/collections/Requests.ts +3 -1
- package/src/commands/List.ts +49 -0
- package/src/commands/Tweet.ts +2 -2
- package/src/commands/User.ts +13 -0
- package/src/enums/Resource.ts +2 -0
- package/src/index.ts +3 -1
- package/src/models/args/FetchArgs.ts +28 -1
- package/src/models/data/Notification.ts +1 -1
- package/src/models/data/Tweet.ts +75 -8
- package/src/models/data/User.ts +1 -1
- package/src/services/public/AuthService.ts +3 -1
- package/src/services/public/FetcherService.ts +17 -17
- package/src/services/public/ListService.ts +112 -0
- package/src/services/public/UserService.ts +42 -1
- package/.yarnrc.yml +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserService.js","sourceRoot":"","sources":["../../../src/services/public/UserService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"UserService.js","sourceRoot":"","sources":["../../../src/services/public/UserService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,2DAA0D;AAC1D,iDAAqD;AAOrD,mDAAkD;AAElD;;;;GAIG;AACH;IAAiC,+BAAc;IAC9C;;;;OAIG;IACH,qBAAmB,MAAuB;eACzC,kBAAM,MAAM,CAAC;IACd,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACU,+BAAS,GAAtB,UAAuB,KAAc,EAAE,MAAe;;;;;;wBAC/C,QAAQ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AI,EAAC;;;;KACZ;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACU,8BAAQ,GAArB,UAAsB,EAAU,EAAE,KAAc,EAAE,MAAe;;;;;;wBAC1D,QAAQ,GAAG,wBAAa,CAAC,aAAa,CAAC;wBAG5B,qBAAM,IAAI,CAAC,OAAO,CAAsB,QAAQ,EAAE;gCAClE,EAAE,EAAE,EAAE;gCACN,KAAK,EAAE,KAAK;gCACZ,MAAM,EAAE,MAAM;6BACd,CAAC,EAAA;;wBAJI,QAAQ,GAAG,SAIf;wBAGI,IAAI,GAAG,uBAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC;wBAE5C,sBAAO,IAAI,EAAC;;;;KACZ;IAED;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACU,8BAAQ,GAArB,UAAsB,EAAU;;;;;;;wBACzB,QAAQ,GAAG,wBAAa,CAAC,aAAa,CAAC;wBAG5B,qBAAM,IAAI,CAAC,OAAO,CAAwB,wBAAa,CAAC,aAAa,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAA;;wBAA7F,QAAQ,GAAG,SAAkF;wBAG7F,IAAI,GAAG,MAAA,uBAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,mCAAI,KAAK,CAAC;wBAErD,sBAAO,IAAI,EAAC;;;;KACZ;IACF,kBAAC;AAAD,CAAC,AA5qBD,CAAiC,+BAAc,GA4qB9C;AA5qBY,kCAAW"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rettiwt-api",
|
|
3
|
-
"version": "4.2.0
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"description": "An API for fetching data from TwitterAPI, without any rate limits!",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"build": "tsc",
|
|
12
12
|
"prepare": "tsc",
|
|
13
13
|
"format": "prettier --write .",
|
|
14
|
-
"lint": "eslint --max-warnings 0 .",
|
|
14
|
+
"lint": "eslint --max-warnings 0 --fix .",
|
|
15
15
|
"docs": "typedoc --excludePrivate --excludeProtected --excludeInternal src/index.ts",
|
|
16
16
|
"debug": "nodemon ./dist/index.js --inspect=0.0.0.0:9229"
|
|
17
17
|
},
|
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
"url": "https://github.com/Rishikant181/Rettiwt-API/issues"
|
|
29
29
|
},
|
|
30
30
|
"homepage": "https://rishikant181.github.io/Rettiwt-API/",
|
|
31
|
-
"packageManager": "yarn@4.4.0",
|
|
32
31
|
"dependencies": {
|
|
33
32
|
"axios": "1.6.3",
|
|
34
33
|
"chalk": "4.1.2",
|
|
@@ -36,7 +35,7 @@
|
|
|
36
35
|
"commander": "11.1.0",
|
|
37
36
|
"https-proxy-agent": "7.0.2",
|
|
38
37
|
"rettiwt-auth": "2.1.0",
|
|
39
|
-
"rettiwt-core": "4.4.0
|
|
38
|
+
"rettiwt-core": "4.4.0"
|
|
40
39
|
},
|
|
41
40
|
"devDependencies": {
|
|
42
41
|
"@types/node": "20.4.1",
|
package/src/Rettiwt.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AuthService } from './services/public/AuthService';
|
|
2
|
+
import { ListService } from './services/public/ListService';
|
|
2
3
|
import { TweetService } from './services/public/TweetService';
|
|
3
4
|
import { UserService } from './services/public/UserService';
|
|
4
5
|
import { IRettiwtConfig } from './types/RettiwtConfig';
|
|
@@ -48,6 +49,9 @@ export class Rettiwt {
|
|
|
48
49
|
/** The instance used to authenticate. */
|
|
49
50
|
public auth: AuthService;
|
|
50
51
|
|
|
52
|
+
/** The instance used to fetch data related to lists. */
|
|
53
|
+
public list: ListService;
|
|
54
|
+
|
|
51
55
|
/** The instance used to fetch data related to tweets. */
|
|
52
56
|
public tweet: TweetService;
|
|
53
57
|
|
|
@@ -61,6 +65,7 @@ export class Rettiwt {
|
|
|
61
65
|
*/
|
|
62
66
|
public constructor(config?: IRettiwtConfig) {
|
|
63
67
|
this.auth = new AuthService(config);
|
|
68
|
+
this.list = new ListService(config);
|
|
64
69
|
this.tweet = new TweetService(config);
|
|
65
70
|
this.user = new UserService(config);
|
|
66
71
|
}
|
package/src/cli.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { createCommand } from 'commander';
|
|
4
4
|
|
|
5
5
|
import auth from './commands/Auth';
|
|
6
|
+
import list from './commands/List';
|
|
6
7
|
import tweet from './commands/Tweet';
|
|
7
8
|
import user from './commands/User';
|
|
8
9
|
import { Rettiwt } from './Rettiwt';
|
|
@@ -32,6 +33,7 @@ const rettiwt: Rettiwt = new Rettiwt({
|
|
|
32
33
|
});
|
|
33
34
|
|
|
34
35
|
// Adding sub-commands
|
|
36
|
+
program.addCommand(list(rettiwt));
|
|
35
37
|
program.addCommand(tweet(rettiwt));
|
|
36
38
|
program.addCommand(user(rettiwt));
|
|
37
39
|
program.addCommand(auth(rettiwt));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
IInitializeMediaUploadResponse,
|
|
3
|
+
IListMembersResponse,
|
|
3
4
|
IListTweetsResponse,
|
|
4
5
|
ITweetDetailsResponse,
|
|
5
6
|
ITweetLikeResponse,
|
|
@@ -13,6 +14,7 @@ import {
|
|
|
13
14
|
ITweetUnpostResponse,
|
|
14
15
|
ITweetUnretweetResponse,
|
|
15
16
|
ITweetUnscheduleResponse,
|
|
17
|
+
IUserBookmarksResponse,
|
|
16
18
|
IUserDetailsResponse,
|
|
17
19
|
IUserFollowedResponse,
|
|
18
20
|
IUserFollowersResponse,
|
|
@@ -21,7 +23,7 @@ import {
|
|
|
21
23
|
IUserHighlightsResponse,
|
|
22
24
|
IUserLikesResponse,
|
|
23
25
|
IUserMediaResponse,
|
|
24
|
-
|
|
26
|
+
IUserNotificationsResponse,
|
|
25
27
|
IUserRecommendedResponse,
|
|
26
28
|
IUserSubscriptionsResponse,
|
|
27
29
|
IUserTweetsAndRepliesResponse,
|
|
@@ -42,6 +44,8 @@ import { User } from '../models/data/User';
|
|
|
42
44
|
*/
|
|
43
45
|
export const extractors = {
|
|
44
46
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
47
|
+
LIST_MEMBERS: (response: IListMembersResponse): CursoredData<User> =>
|
|
48
|
+
new CursoredData<User>(response, EBaseType.USER),
|
|
45
49
|
LIST_TWEETS: (response: IListTweetsResponse): CursoredData<Tweet> =>
|
|
46
50
|
new CursoredData<Tweet>(response, EBaseType.TWEET),
|
|
47
51
|
|
|
@@ -67,6 +71,8 @@ export const extractors = {
|
|
|
67
71
|
response?.data?.unretweet?.source_tweet_results?.result ? true : false,
|
|
68
72
|
TWEET_UNSCHEDULE: (response: ITweetUnscheduleResponse): boolean => response?.data?.scheduledtweet_delete == 'Done',
|
|
69
73
|
|
|
74
|
+
USER_BOOKMARKS: (response: IUserBookmarksResponse): CursoredData<Tweet> =>
|
|
75
|
+
new CursoredData<Tweet>(response, EBaseType.TWEET),
|
|
70
76
|
USER_DETAILS_BY_USERNAME: (response: IUserDetailsResponse): User | undefined => User.single(response),
|
|
71
77
|
USER_DETAILS_BY_ID: (response: IUserDetailsResponse): User | undefined => User.single(response),
|
|
72
78
|
USER_FEED_FOLLOWED: (response: IUserFollowedResponse): CursoredData<Tweet> =>
|
|
@@ -17,11 +17,13 @@ export const allowGuestAuthentication = [
|
|
|
17
17
|
* @internal
|
|
18
18
|
*/
|
|
19
19
|
export const fetchResources = [
|
|
20
|
+
EResourceType.LIST_MEMBERS,
|
|
20
21
|
EResourceType.LIST_TWEETS,
|
|
21
22
|
EResourceType.TWEET_DETAILS,
|
|
22
23
|
EResourceType.TWEET_DETAILS_ALT,
|
|
23
24
|
EResourceType.TWEET_RETWEETERS,
|
|
24
25
|
EResourceType.TWEET_SEARCH,
|
|
26
|
+
EResourceType.USER_BOOKMARKS,
|
|
25
27
|
EResourceType.USER_DETAILS_BY_USERNAME,
|
|
26
28
|
EResourceType.USER_DETAILS_BY_ID,
|
|
27
29
|
EResourceType.USER_FEED_FOLLOWED,
|
|
@@ -19,6 +19,7 @@ const request = new Request();
|
|
|
19
19
|
*/
|
|
20
20
|
export const requests: { [key in keyof typeof EResourceType]: (args: FetchArgs | PostArgs) => AxiosRequestConfig } = {
|
|
21
21
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
22
|
+
LIST_MEMBERS: (args: FetchArgs) => request.list.members(args.id!, args.count, args.cursor),
|
|
22
23
|
LIST_TWEETS: (args: FetchArgs) => request.list.tweets(args.id!, args.count, args.cursor),
|
|
23
24
|
|
|
24
25
|
MEDIA_UPLOAD_APPEND: (args: PostArgs) => request.media.appendUpload(args.upload!.id!, args.upload!.media!),
|
|
@@ -32,12 +33,13 @@ export const requests: { [key in keyof typeof EResourceType]: (args: FetchArgs |
|
|
|
32
33
|
TWEET_RETWEET: (args: PostArgs) => request.tweet.retweet(args.id!),
|
|
33
34
|
TWEET_RETWEETERS: (args: FetchArgs) => request.tweet.retweeters(args.id!, args.count, args.cursor),
|
|
34
35
|
TWEET_SCHEDULE: (args: PostArgs) => request.tweet.schedule(args.tweet!, args.tweet!.scheduleFor!),
|
|
35
|
-
TWEET_SEARCH: (args: FetchArgs) => request.tweet.search(args.filter!, args.count, args.cursor
|
|
36
|
+
TWEET_SEARCH: (args: FetchArgs) => request.tweet.search(args.filter!, args.count, args.cursor),
|
|
36
37
|
TWEET_UNLIKE: (args: PostArgs) => request.tweet.unlike(args.id!),
|
|
37
38
|
TWEET_UNPOST: (args: PostArgs) => request.tweet.unpost(args.id!),
|
|
38
39
|
TWEET_UNRETWEET: (args: PostArgs) => request.tweet.unretweet(args.id!),
|
|
39
40
|
TWEET_UNSCHEDULE: (args: PostArgs) => request.tweet.unschedule(args.id!),
|
|
40
41
|
|
|
42
|
+
USER_BOOKMARKS: (args: FetchArgs) => request.user.bookmarks(args.count, args.cursor),
|
|
41
43
|
USER_DETAILS_BY_USERNAME: (args: FetchArgs) => request.user.detailsByUsername(args.id!),
|
|
42
44
|
USER_DETAILS_BY_ID: (args: FetchArgs) => request.user.detailsById(args.id!),
|
|
43
45
|
USER_FEED_FOLLOWED: (args: FetchArgs) => request.user.followed(args.count, args.cursor),
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Command, createCommand } from 'commander';
|
|
2
|
+
|
|
3
|
+
import { output } from '../helper/CliUtils';
|
|
4
|
+
import { Rettiwt } from '../Rettiwt';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Creates a new 'list' command which uses the given Rettiwt instance.
|
|
8
|
+
*
|
|
9
|
+
* @param rettiwt - The Rettiwt instance to use.
|
|
10
|
+
* @returns The created 'list' command.
|
|
11
|
+
*/
|
|
12
|
+
function createListCommand(rettiwt: Rettiwt): Command {
|
|
13
|
+
// Creating the 'list' command
|
|
14
|
+
const list = createCommand('list').description('Access resources releated to lists');
|
|
15
|
+
|
|
16
|
+
// Members
|
|
17
|
+
list.command('members')
|
|
18
|
+
.description('Fetch the list of members of the given tweet list')
|
|
19
|
+
.argument('<id>', 'The id of the tweet list')
|
|
20
|
+
.argument('[count]', 'The number of members to fetch')
|
|
21
|
+
.argument('[cursor]', 'The cursor to the batch of members to fetch')
|
|
22
|
+
.action(async (id: string, count?: string, cursor?: string) => {
|
|
23
|
+
try {
|
|
24
|
+
const members = await rettiwt.list.members(id, count ? parseInt(count) : undefined, cursor);
|
|
25
|
+
output(members);
|
|
26
|
+
} catch (error) {
|
|
27
|
+
output(error);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Tweets
|
|
32
|
+
list.command('tweets')
|
|
33
|
+
.description('Fetch the list of tweets in the tweet list with the given id')
|
|
34
|
+
.argument('<id>', 'The id of the tweet list')
|
|
35
|
+
.argument('[count]', 'The number of tweets to fetch')
|
|
36
|
+
.argument('[cursor]', 'The cursor to the batch of tweets to fetch')
|
|
37
|
+
.action(async (id: string, count?: string, cursor?: string) => {
|
|
38
|
+
try {
|
|
39
|
+
const tweets = await rettiwt.list.tweets(id, count ? parseInt(count) : undefined, cursor);
|
|
40
|
+
output(tweets);
|
|
41
|
+
} catch (error) {
|
|
42
|
+
output(error);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
return list;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export default createListCommand;
|
package/src/commands/Tweet.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Command, createCommand } from 'commander';
|
|
2
|
-
import {
|
|
2
|
+
import { TweetFilter } from 'rettiwt-core';
|
|
3
3
|
|
|
4
4
|
import { output } from '../helper/CliUtils';
|
|
5
5
|
import { Rettiwt } from '../Rettiwt';
|
|
@@ -192,7 +192,6 @@ function createTweetCommand(rettiwt: Rettiwt): Command {
|
|
|
192
192
|
new TweetSearchOptions(options).toTweetFilter(),
|
|
193
193
|
count ? parseInt(count) : undefined,
|
|
194
194
|
cursor,
|
|
195
|
-
options?.top ? ESearchResultType.TOP : ESearchResultType.LATEST,
|
|
196
195
|
);
|
|
197
196
|
output(tweets);
|
|
198
197
|
}
|
|
@@ -352,6 +351,7 @@ class TweetSearchOptions {
|
|
|
352
351
|
links: !this.excludeLinks,
|
|
353
352
|
replies: !this.excludeReplies,
|
|
354
353
|
startDate: this.start ? new Date(this.start) : undefined,
|
|
354
|
+
top: this.top,
|
|
355
355
|
endDate: this.end ? new Date(this.end) : undefined,
|
|
356
356
|
});
|
|
357
357
|
}
|
package/src/commands/User.ts
CHANGED
|
@@ -13,6 +13,19 @@ function createUserCommand(rettiwt: Rettiwt): Command {
|
|
|
13
13
|
// Creating the 'user' command
|
|
14
14
|
const user = createCommand('user').description('Access resources releated to users');
|
|
15
15
|
|
|
16
|
+
user.command('bookmarks')
|
|
17
|
+
.description('Fetch your list of bookmarks')
|
|
18
|
+
.argument('[count]', 'The number of bookmarks to fetch')
|
|
19
|
+
.argument('[cursor]', 'The cursor to the batch of bookmarks to fetch')
|
|
20
|
+
.action(async (count?: string, cursor?: string) => {
|
|
21
|
+
try {
|
|
22
|
+
const bookmarks = await rettiwt.user.bookmarks(count ? parseInt(count) : undefined, cursor);
|
|
23
|
+
output(bookmarks);
|
|
24
|
+
} catch (error) {
|
|
25
|
+
output(error);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
|
|
16
29
|
// Details
|
|
17
30
|
user.command('details')
|
|
18
31
|
.description('Fetch the details of the user with the given id/username')
|
package/src/enums/Resource.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export enum EResourceType {
|
|
7
7
|
// LIST
|
|
8
|
+
LIST_MEMBERS = 'LIST_MEMBERS',
|
|
8
9
|
LIST_TWEETS = 'LIST_TWEETS',
|
|
9
10
|
|
|
10
11
|
// MEDIA
|
|
@@ -27,6 +28,7 @@ export enum EResourceType {
|
|
|
27
28
|
TWEET_UNSCHEDULE = 'TWEET_UNSCHEDULE',
|
|
28
29
|
|
|
29
30
|
// USER
|
|
31
|
+
USER_BOOKMARKS = 'USER_BOOKMARKS',
|
|
30
32
|
USER_DETAILS_BY_USERNAME = 'USER_DETAILS_BY_USERNAME',
|
|
31
33
|
USER_DETAILS_BY_ID = 'USER_DETAILS_BY_ID',
|
|
32
34
|
USER_FEED_FOLLOWED = 'USER_FEED_FOLLOWED',
|
package/src/index.ts
CHANGED
|
@@ -5,7 +5,6 @@ export * from './Rettiwt';
|
|
|
5
5
|
export * from './enums/Api';
|
|
6
6
|
export * from './enums/Http';
|
|
7
7
|
export * from './enums/Resource';
|
|
8
|
-
export { ESearchResultType } from 'rettiwt-core';
|
|
9
8
|
|
|
10
9
|
// ARG MODELS
|
|
11
10
|
export * from './models/args/FetchArgs';
|
|
@@ -38,6 +37,7 @@ export * from './types/ErrorHandler';
|
|
|
38
37
|
// RAW TYPES
|
|
39
38
|
export {
|
|
40
39
|
IInitializeMediaUploadResponse,
|
|
40
|
+
IListMembersResponse,
|
|
41
41
|
IListTweetsResponse,
|
|
42
42
|
ITweetDetailsResponse,
|
|
43
43
|
ITweetLikeResponse,
|
|
@@ -53,6 +53,7 @@ export {
|
|
|
53
53
|
ITweetUnretweetResponse,
|
|
54
54
|
} from 'rettiwt-core';
|
|
55
55
|
export {
|
|
56
|
+
IUserBookmarksResponse,
|
|
56
57
|
IUserDetailsResponse,
|
|
57
58
|
IUserFollowedResponse,
|
|
58
59
|
IUserFollowersResponse,
|
|
@@ -61,6 +62,7 @@ export {
|
|
|
61
62
|
IUserHighlightsResponse,
|
|
62
63
|
IUserLikesResponse,
|
|
63
64
|
IUserMediaResponse,
|
|
65
|
+
IUserNotificationsResponse,
|
|
64
66
|
IUserRecommendedResponse,
|
|
65
67
|
IUserSubscriptionsResponse,
|
|
66
68
|
IUserTweetsAndRepliesResponse,
|
|
@@ -52,9 +52,11 @@ export class FetchArgs {
|
|
|
52
52
|
})
|
|
53
53
|
@IsOptional({
|
|
54
54
|
groups: [
|
|
55
|
+
EResourceType.LIST_MEMBERS,
|
|
55
56
|
EResourceType.LIST_TWEETS,
|
|
56
57
|
EResourceType.TWEET_RETWEETERS,
|
|
57
58
|
EResourceType.TWEET_SEARCH,
|
|
59
|
+
EResourceType.USER_BOOKMARKS,
|
|
58
60
|
EResourceType.USER_FOLLOWERS,
|
|
59
61
|
EResourceType.USER_FOLLOWING,
|
|
60
62
|
EResourceType.USER_HIGHLIGHTS,
|
|
@@ -68,9 +70,11 @@ export class FetchArgs {
|
|
|
68
70
|
})
|
|
69
71
|
@Min(1, {
|
|
70
72
|
groups: [
|
|
73
|
+
EResourceType.LIST_MEMBERS,
|
|
71
74
|
EResourceType.LIST_TWEETS,
|
|
72
75
|
EResourceType.TWEET_RETWEETERS,
|
|
73
76
|
EResourceType.TWEET_SEARCH,
|
|
77
|
+
EResourceType.USER_BOOKMARKS,
|
|
74
78
|
EResourceType.USER_FOLLOWERS,
|
|
75
79
|
EResourceType.USER_FOLLOWING,
|
|
76
80
|
EResourceType.USER_HIGHLIGHTS,
|
|
@@ -84,8 +88,10 @@ export class FetchArgs {
|
|
|
84
88
|
})
|
|
85
89
|
@Max(100, {
|
|
86
90
|
groups: [
|
|
91
|
+
EResourceType.LIST_MEMBERS,
|
|
87
92
|
EResourceType.LIST_TWEETS,
|
|
88
93
|
EResourceType.TWEET_RETWEETERS,
|
|
94
|
+
EResourceType.USER_BOOKMARKS,
|
|
89
95
|
EResourceType.USER_FOLLOWERS,
|
|
90
96
|
EResourceType.USER_FOLLOWING,
|
|
91
97
|
EResourceType.USER_HIGHLIGHTS,
|
|
@@ -119,9 +125,11 @@ export class FetchArgs {
|
|
|
119
125
|
})
|
|
120
126
|
@IsOptional({
|
|
121
127
|
groups: [
|
|
128
|
+
EResourceType.LIST_MEMBERS,
|
|
122
129
|
EResourceType.LIST_TWEETS,
|
|
123
130
|
EResourceType.TWEET_RETWEETERS,
|
|
124
131
|
EResourceType.TWEET_SEARCH,
|
|
132
|
+
EResourceType.USER_BOOKMARKS,
|
|
125
133
|
EResourceType.USER_FEED_FOLLOWED,
|
|
126
134
|
EResourceType.USER_FEED_RECOMMENDED,
|
|
127
135
|
EResourceType.USER_FOLLOWING,
|
|
@@ -137,9 +145,11 @@ export class FetchArgs {
|
|
|
137
145
|
})
|
|
138
146
|
@IsString({
|
|
139
147
|
groups: [
|
|
148
|
+
EResourceType.LIST_MEMBERS,
|
|
140
149
|
EResourceType.LIST_TWEETS,
|
|
141
150
|
EResourceType.TWEET_RETWEETERS,
|
|
142
151
|
EResourceType.TWEET_SEARCH,
|
|
152
|
+
EResourceType.USER_BOOKMARKS,
|
|
143
153
|
EResourceType.USER_FEED_FOLLOWED,
|
|
144
154
|
EResourceType.USER_FEED_RECOMMENDED,
|
|
145
155
|
EResourceType.USER_FOLLOWING,
|
|
@@ -163,10 +173,12 @@ export class FetchArgs {
|
|
|
163
173
|
*/
|
|
164
174
|
@IsEmpty({
|
|
165
175
|
groups: [
|
|
176
|
+
EResourceType.LIST_MEMBERS,
|
|
166
177
|
EResourceType.LIST_TWEETS,
|
|
167
178
|
EResourceType.TWEET_DETAILS,
|
|
168
179
|
EResourceType.TWEET_DETAILS_ALT,
|
|
169
180
|
EResourceType.TWEET_RETWEETERS,
|
|
181
|
+
EResourceType.USER_BOOKMARKS,
|
|
170
182
|
EResourceType.USER_DETAILS_BY_USERNAME,
|
|
171
183
|
EResourceType.USER_DETAILS_BY_ID,
|
|
172
184
|
EResourceType.USER_FEED_FOLLOWED,
|
|
@@ -195,6 +207,7 @@ export class FetchArgs {
|
|
|
195
207
|
*/
|
|
196
208
|
@IsEmpty({
|
|
197
209
|
groups: [
|
|
210
|
+
EResourceType.USER_BOOKMARKS,
|
|
198
211
|
EResourceType.USER_FEED_FOLLOWED,
|
|
199
212
|
EResourceType.USER_FEED_RECOMMENDED,
|
|
200
213
|
EResourceType.USER_NOTIFICATIONS,
|
|
@@ -202,6 +215,7 @@ export class FetchArgs {
|
|
|
202
215
|
})
|
|
203
216
|
@IsNotEmpty({
|
|
204
217
|
groups: [
|
|
218
|
+
EResourceType.LIST_MEMBERS,
|
|
205
219
|
EResourceType.LIST_TWEETS,
|
|
206
220
|
EResourceType.TWEET_DETAILS,
|
|
207
221
|
EResourceType.TWEET_DETAILS_ALT,
|
|
@@ -220,6 +234,7 @@ export class FetchArgs {
|
|
|
220
234
|
})
|
|
221
235
|
@IsString({
|
|
222
236
|
groups: [
|
|
237
|
+
EResourceType.LIST_MEMBERS,
|
|
223
238
|
EResourceType.LIST_TWEETS,
|
|
224
239
|
EResourceType.TWEET_DETAILS,
|
|
225
240
|
EResourceType.TWEET_DETAILS_ALT,
|
|
@@ -238,6 +253,7 @@ export class FetchArgs {
|
|
|
238
253
|
})
|
|
239
254
|
@IsNumberString(undefined, {
|
|
240
255
|
groups: [
|
|
256
|
+
EResourceType.LIST_MEMBERS,
|
|
241
257
|
EResourceType.LIST_TWEETS,
|
|
242
258
|
EResourceType.TWEET_DETAILS,
|
|
243
259
|
EResourceType.TWEET_DETAILS_ALT,
|
|
@@ -267,10 +283,12 @@ export class FetchArgs {
|
|
|
267
283
|
*/
|
|
268
284
|
@IsEmpty({
|
|
269
285
|
groups: [
|
|
286
|
+
EResourceType.LIST_MEMBERS,
|
|
270
287
|
EResourceType.LIST_TWEETS,
|
|
271
288
|
EResourceType.TWEET_DETAILS,
|
|
272
289
|
EResourceType.TWEET_DETAILS_ALT,
|
|
273
290
|
EResourceType.TWEET_RETWEETERS,
|
|
291
|
+
EResourceType.USER_BOOKMARKS,
|
|
274
292
|
EResourceType.USER_DETAILS_BY_USERNAME,
|
|
275
293
|
EResourceType.USER_DETAILS_BY_ID,
|
|
276
294
|
EResourceType.USER_FEED_FOLLOWED,
|
|
@@ -298,7 +316,7 @@ export class FetchArgs {
|
|
|
298
316
|
this.count = args.count;
|
|
299
317
|
this.cursor = args.cursor;
|
|
300
318
|
this.filter = args.filter ? new TweetFilter(args.filter) : undefined;
|
|
301
|
-
this.results = args.results
|
|
319
|
+
this.results = args.results;
|
|
302
320
|
|
|
303
321
|
// Validating this object
|
|
304
322
|
const validationResult = validateSync(this, { groups: [resource] });
|
|
@@ -451,6 +469,15 @@ export class TweetFilter extends TweetFilterCore {
|
|
|
451
469
|
@IsString({ each: true })
|
|
452
470
|
public toUsers?: string[];
|
|
453
471
|
|
|
472
|
+
/**
|
|
473
|
+
* Whether to fetch top or not.
|
|
474
|
+
*
|
|
475
|
+
* @defaultValue true
|
|
476
|
+
*/
|
|
477
|
+
@IsOptional()
|
|
478
|
+
@IsBoolean()
|
|
479
|
+
public top?: boolean;
|
|
480
|
+
|
|
454
481
|
/**
|
|
455
482
|
* @param filter - The filter to use for searching tweets.
|
|
456
483
|
*/
|
package/src/models/data/Tweet.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EMediaType,
|
|
3
|
+
ILimitedVisibilityTweet,
|
|
3
4
|
IExtendedMedia as IRawExtendedMedia,
|
|
4
5
|
ITweet as IRawTweet,
|
|
5
6
|
IEntities as IRawTweetEntities,
|
|
@@ -77,7 +78,7 @@ export class Tweet {
|
|
|
77
78
|
this.tweetBy = new User(tweet.core.user_results.result);
|
|
78
79
|
this.entities = new TweetEntities(tweet.legacy.entities);
|
|
79
80
|
this.media = tweet.legacy.extended_entities?.media?.map((media) => new TweetMedia(media));
|
|
80
|
-
this.quoted =
|
|
81
|
+
this.quoted = this.getQuotedTweet(tweet);
|
|
81
82
|
this.fullText = tweet.note_tweet ? tweet.note_tweet.note_tweet_results.result.text : tweet.legacy.full_text;
|
|
82
83
|
this.replyTo = tweet.legacy.in_reply_to_status_id_str;
|
|
83
84
|
this.lang = tweet.legacy.lang;
|
|
@@ -87,9 +88,59 @@ export class Tweet {
|
|
|
87
88
|
this.likeCount = tweet.legacy.favorite_count;
|
|
88
89
|
this.viewCount = tweet.views.count ? parseInt(tweet.views.count) : 0;
|
|
89
90
|
this.bookmarkCount = tweet.legacy.bookmark_count;
|
|
90
|
-
this.retweetedTweet = tweet
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
this.retweetedTweet = this.getRetweetedTweet(tweet);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Extract and deserialize the original quoted tweet from the given raw tweet.
|
|
96
|
+
*
|
|
97
|
+
* @param tweet - The raw tweet.
|
|
98
|
+
*
|
|
99
|
+
* @returns - The deserialized original quoted tweet.
|
|
100
|
+
*/
|
|
101
|
+
private getQuotedTweet(tweet: IRawTweet): Tweet | undefined {
|
|
102
|
+
// If tweet with limited visibility
|
|
103
|
+
if (
|
|
104
|
+
tweet.quoted_status_result &&
|
|
105
|
+
tweet.quoted_status_result?.result?.__typename == 'TweetWithVisibilityResults' &&
|
|
106
|
+
(tweet.quoted_status_result.result as ILimitedVisibilityTweet)?.tweet?.legacy
|
|
107
|
+
) {
|
|
108
|
+
return new Tweet((tweet.quoted_status_result.result as ILimitedVisibilityTweet).tweet);
|
|
109
|
+
}
|
|
110
|
+
// If normal tweet
|
|
111
|
+
else if ((tweet.quoted_status_result?.result as ITweet)?.rest_id) {
|
|
112
|
+
return new Tweet(tweet.quoted_status_result.result as ITweet);
|
|
113
|
+
}
|
|
114
|
+
// Else, skip
|
|
115
|
+
else {
|
|
116
|
+
return undefined;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Extract and deserialize the original retweeted tweet from the given raw tweet.
|
|
122
|
+
*
|
|
123
|
+
* @param tweet - The raw tweet.
|
|
124
|
+
*
|
|
125
|
+
* @returns - The deserialized original retweeted tweet.
|
|
126
|
+
*/
|
|
127
|
+
private getRetweetedTweet(tweet: IRawTweet): Tweet | undefined {
|
|
128
|
+
// If retweet with limited visibility
|
|
129
|
+
if (
|
|
130
|
+
tweet.legacy?.retweeted_status_result &&
|
|
131
|
+
tweet.legacy?.retweeted_status_result?.result?.__typename == 'TweetWithVisibilityResults' &&
|
|
132
|
+
(tweet.legacy?.retweeted_status_result?.result as ILimitedVisibilityTweet)?.tweet?.legacy
|
|
133
|
+
) {
|
|
134
|
+
return new Tweet((tweet.legacy.retweeted_status_result.result as ILimitedVisibilityTweet).tweet);
|
|
135
|
+
}
|
|
136
|
+
// If normal tweet
|
|
137
|
+
else if ((tweet.legacy?.retweeted_status_result?.result as ITweet)?.rest_id) {
|
|
138
|
+
return new Tweet(tweet.legacy.retweeted_status_result.result as ITweet);
|
|
139
|
+
}
|
|
140
|
+
// Else, skip
|
|
141
|
+
else {
|
|
142
|
+
return undefined;
|
|
143
|
+
}
|
|
93
144
|
}
|
|
94
145
|
|
|
95
146
|
/**
|
|
@@ -109,12 +160,23 @@ export class Tweet {
|
|
|
109
160
|
|
|
110
161
|
// Deserializing valid data
|
|
111
162
|
for (const item of extract) {
|
|
112
|
-
|
|
163
|
+
// If tweet with limited visibility
|
|
164
|
+
if (
|
|
165
|
+
item.tweet_results?.result &&
|
|
166
|
+
item.tweet_results?.result?.__typename == 'TweetWithVisibilityResults' &&
|
|
167
|
+
(item.tweet_results?.result as ILimitedVisibilityTweet)?.tweet?.legacy
|
|
168
|
+
) {
|
|
169
|
+
tweets.push(new Tweet((item.tweet_results.result as ILimitedVisibilityTweet).tweet));
|
|
170
|
+
}
|
|
171
|
+
// If normal tweet
|
|
172
|
+
else if ((item.tweet_results?.result as ITweet)?.legacy) {
|
|
113
173
|
// Logging
|
|
114
|
-
LogService.log(ELogActions.DESERIALIZE, { id: item.tweet_results.result.rest_id });
|
|
174
|
+
LogService.log(ELogActions.DESERIALIZE, { id: (item.tweet_results.result as ITweet).rest_id });
|
|
115
175
|
|
|
116
|
-
tweets.push(new Tweet(item.tweet_results.result));
|
|
117
|
-
}
|
|
176
|
+
tweets.push(new Tweet(item.tweet_results.result as ITweet));
|
|
177
|
+
}
|
|
178
|
+
// If invalid/unrecognized tweet
|
|
179
|
+
else {
|
|
118
180
|
// Logging
|
|
119
181
|
LogService.log(ELogActions.WARNING, {
|
|
120
182
|
action: ELogActions.DESERIALIZE,
|
|
@@ -210,6 +272,9 @@ export class TweetEntities {
|
|
|
210
272
|
* @public
|
|
211
273
|
*/
|
|
212
274
|
export class TweetMedia {
|
|
275
|
+
/** The thumbnail URL for the video content of the tweet. */
|
|
276
|
+
public thumbnailUrl?: string;
|
|
277
|
+
|
|
213
278
|
/** The type of media. */
|
|
214
279
|
public type: EMediaType;
|
|
215
280
|
|
|
@@ -232,6 +297,8 @@ export class TweetMedia {
|
|
|
232
297
|
}
|
|
233
298
|
// If the media is a video
|
|
234
299
|
else {
|
|
300
|
+
this.thumbnailUrl = media.media_url_https;
|
|
301
|
+
|
|
235
302
|
/** The highest bitrate of all variants. */
|
|
236
303
|
let highestRate: number = 0;
|
|
237
304
|
|
package/src/models/data/User.ts
CHANGED
|
@@ -57,7 +57,9 @@ export class AuthService extends FetcherService {
|
|
|
57
57
|
const cookieString: string = AuthService.decodeCookie(apiKey);
|
|
58
58
|
|
|
59
59
|
// Searching for the user id in the cookie string
|
|
60
|
-
const searchResults: string[] | null = cookieString.match(
|
|
60
|
+
const searchResults: string[] | null = cookieString.match(
|
|
61
|
+
/((?<=twid="u=)(\d+)(?="))|((?<=twid=u%3D)(\d+)(?=;))/,
|
|
62
|
+
);
|
|
61
63
|
|
|
62
64
|
// If user id was found
|
|
63
65
|
if (searchResults) {
|