twitter-openapi-typescript 0.0.5 → 0.0.7
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 +38 -17
- package/dist/src/api.d.ts +41 -33
- package/dist/src/api.d.ts.map +1 -1
- package/dist/src/api.js +239 -151
- package/dist/src/api.js.map +1 -1
- package/dist/src/apis/defaultApi.d.ts +15 -17
- package/dist/src/apis/defaultApi.d.ts.map +1 -1
- package/dist/src/apis/defaultApi.js +106 -106
- package/dist/src/apis/defaultApi.js.map +1 -1
- package/dist/src/apis/index.d.ts +9 -9
- package/dist/src/apis/index.js +21 -21
- package/dist/src/apis/initialStateApi.d.ts +2 -2
- package/dist/src/apis/initialStateApi.js +9 -9
- package/dist/src/apis/postApi.d.ts +51 -51
- package/dist/src/apis/postApi.d.ts.map +1 -1
- package/dist/src/apis/postApi.js +236 -236
- package/dist/src/apis/postApi.js.map +1 -1
- package/dist/src/apis/tweetApi.d.ts +87 -88
- package/dist/src/apis/tweetApi.d.ts.map +1 -1
- package/dist/src/apis/tweetApi.js +277 -277
- package/dist/src/apis/tweetApi.js.map +1 -1
- package/dist/src/apis/userApi.d.ts +16 -17
- package/dist/src/apis/userApi.d.ts.map +1 -1
- package/dist/src/apis/userApi.js +101 -101
- package/dist/src/apis/userApi.js.map +1 -1
- package/dist/src/apis/userListApi.d.ts +27 -28
- package/dist/src/apis/userListApi.d.ts.map +1 -1
- package/dist/src/apis/userListApi.js +135 -135
- package/dist/src/apis/userListApi.js.map +1 -1
- package/dist/src/apis/v11GetApi.d.ts +7 -7
- package/dist/src/apis/v11GetApi.d.ts.map +1 -1
- package/dist/src/apis/v11GetApi.js +11 -11
- package/dist/src/apis/v11PostApi.d.ts +22 -22
- package/dist/src/apis/v11PostApi.d.ts.map +1 -1
- package/dist/src/apis/v11PostApi.js +93 -93
- package/dist/src/apis/v11PostApi.js.map +1 -1
- package/dist/src/apis/v20GetApi.d.ts +7 -7
- package/dist/src/apis/v20GetApi.d.ts.map +1 -1
- package/dist/src/apis/v20GetApi.js +11 -11
- package/dist/src/index.d.ts +4 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +20 -20
- package/dist/src/index.js.map +1 -1
- package/dist/src/{types → models}/flag.d.ts +5 -5
- package/dist/src/models/flag.d.ts.map +1 -0
- package/dist/src/{types → models}/flag.js +2 -2
- package/dist/src/{types → models}/flag.js.map +1 -1
- package/dist/src/{types → models}/header.d.ts +14 -14
- package/dist/src/models/header.d.ts.map +1 -0
- package/dist/src/models/{type.js → header.js} +3 -3
- package/dist/src/{types → models}/header.js.map +1 -1
- package/dist/src/models/index.d.ts +8 -2
- package/dist/src/models/index.d.ts.map +1 -1
- package/dist/src/models/index.js +24 -18
- package/dist/src/models/index.js.map +1 -1
- package/dist/src/{types → models}/response.d.ts +9 -9
- package/dist/src/models/response.d.ts.map +1 -0
- package/dist/src/{types/header.js → models/response.js} +3 -3
- package/dist/src/{types → models}/response.js.map +1 -1
- package/dist/src/{types → models}/timeline.d.ts +10 -10
- package/dist/src/models/timeline.d.ts.map +1 -0
- package/dist/src/models/timeline.js +3 -0
- package/dist/src/{types → models}/timeline.js.map +1 -1
- package/dist/src/{types → models}/tweet.d.ts +17 -17
- package/dist/src/models/tweet.d.ts.map +1 -0
- package/dist/src/{types → models}/tweet.js +2 -2
- package/dist/src/{types → models}/tweet.js.map +1 -1
- package/dist/src/{types → models}/user.d.ts +10 -10
- package/dist/src/models/user.d.ts.map +1 -0
- package/dist/src/{types → models}/user.js +2 -2
- package/dist/src/{types → models}/user.js.map +1 -1
- package/dist/src/{types → models}/user_list.d.ts +12 -12
- package/dist/src/models/user_list.d.ts.map +1 -0
- package/dist/src/models/user_list.js +3 -0
- package/dist/src/{types → models}/user_list.js.map +1 -1
- package/dist/src/models/{type.d.ts → utils.d.ts} +16 -16
- package/dist/src/models/utils.d.ts.map +1 -0
- package/dist/src/models/utils.js +3 -0
- package/dist/src/models/utils.js.map +1 -0
- package/dist/src/{models → utils}/api.d.ts +17 -17
- package/dist/src/utils/api.d.ts.map +1 -0
- package/dist/src/{models → utils}/api.js +130 -130
- package/dist/src/utils/api.js.map +1 -0
- package/dist/src/utils/index.d.ts +2 -0
- package/dist/src/utils/index.d.ts.map +1 -0
- package/dist/src/{types → utils}/index.js +17 -23
- package/dist/src/utils/index.js.map +1 -0
- package/package.json +4 -4
- package/src/api.ts +92 -36
- package/src/apis/defaultApi.ts +2 -3
- package/src/apis/postApi.ts +3 -3
- package/src/apis/tweetApi.ts +2 -2
- package/src/apis/userApi.ts +2 -2
- package/src/apis/userListApi.ts +2 -9
- package/src/apis/v11GetApi.ts +1 -1
- package/src/apis/v11PostApi.ts +2 -2
- package/src/apis/v20GetApi.ts +1 -1
- package/src/index.ts +1 -1
- package/src/models/index.ts +8 -2
- package/src/{types → models}/response.ts +1 -1
- package/src/{types → models}/tweet.ts +1 -1
- package/src/{types → models}/user.ts +1 -1
- package/src/{types → models}/user_list.ts +1 -1
- package/src/{models → utils}/api.ts +1 -1
- package/src/utils/index.ts +1 -0
- package/test/api/defaultApi.test.ts +0 -1
- package/test/init.ts +2 -2
- package/test/util.ts +1 -1
- package/dist/src/models/api.d.ts.map +0 -1
- package/dist/src/models/api.js.map +0 -1
- package/dist/src/models/type.d.ts.map +0 -1
- package/dist/src/models/type.js.map +0 -1
- package/dist/src/types/flag.d.ts.map +0 -1
- package/dist/src/types/header.d.ts.map +0 -1
- package/dist/src/types/index.d.ts +0 -8
- package/dist/src/types/index.d.ts.map +0 -1
- package/dist/src/types/index.js.map +0 -1
- package/dist/src/types/response.d.ts.map +0 -1
- package/dist/src/types/response.js +0 -3
- package/dist/src/types/timeline.d.ts.map +0 -1
- package/dist/src/types/timeline.js +0 -3
- package/dist/src/types/tweet.d.ts.map +0 -1
- package/dist/src/types/user.d.ts.map +0 -1
- package/dist/src/types/user_list.d.ts.map +0 -1
- package/dist/src/types/user_list.js +0 -3
- package/src/types/index.ts +0 -7
- /package/src/{types → models}/flag.ts +0 -0
- /package/src/{types → models}/header.ts +0 -0
- /package/src/{types → models}/timeline.ts +0 -0
- /package/src/models/{type.ts → utils.ts} +0 -0
package/src/api.ts
CHANGED
|
@@ -10,74 +10,130 @@ import {
|
|
|
10
10
|
V11PostApiUtils,
|
|
11
11
|
V20GetApiUtils,
|
|
12
12
|
} from '@/apis';
|
|
13
|
-
import { DefaultFlag } from '@/
|
|
13
|
+
import { DefaultFlag } from '@/models';
|
|
14
14
|
|
|
15
|
-
type TwitterOpenApiParams = {
|
|
15
|
+
export type TwitterOpenApiParams = {
|
|
16
16
|
lang?: string;
|
|
17
|
+
fetchApi?: i.FetchAPI;
|
|
17
18
|
};
|
|
18
19
|
|
|
19
|
-
export type
|
|
20
|
+
export type TwitterOpenApiCookie = {
|
|
21
|
+
name: string;
|
|
22
|
+
value: string;
|
|
23
|
+
};
|
|
20
24
|
|
|
21
25
|
export class TwitterOpenApi {
|
|
22
26
|
static hash = 'd5ccc25869b68cbb39c68fa81a1fa77967a667da';
|
|
23
27
|
static url = `https://raw.githubusercontent.com/fa0311/twitter-openapi/${this.hash}/src/config/placeholder.json`;
|
|
28
|
+
static twitter = 'https://twitter.com/home';
|
|
29
|
+
|
|
24
30
|
static userAgent =
|
|
25
31
|
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36';
|
|
26
32
|
static bearer =
|
|
27
33
|
'AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA';
|
|
28
34
|
param: TwitterOpenApiParams;
|
|
29
35
|
|
|
30
|
-
fetchApi: FetchApi | undefined;
|
|
31
|
-
|
|
32
36
|
constructor(param: TwitterOpenApiParams = {}) {
|
|
33
37
|
this.param = param;
|
|
34
38
|
}
|
|
35
39
|
|
|
36
|
-
|
|
37
|
-
this.fetchApi
|
|
40
|
+
get fetchApi(): i.FetchAPI {
|
|
41
|
+
return this.param.fetchApi || fetch;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
cookieDecode(cookie: string): TwitterOpenApiCookie[] {
|
|
45
|
+
return cookie
|
|
46
|
+
.split(', ')
|
|
47
|
+
.map((cookie) => cookie.split(';')[0])
|
|
48
|
+
.filter((cookie) => cookie.indexOf('=') != -1)
|
|
49
|
+
.map((cookie) => cookie.split('='))
|
|
50
|
+
.map(([name, value]) => ({
|
|
51
|
+
name: name,
|
|
52
|
+
value: value,
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
cookieEncode(cookie: TwitterOpenApiCookie[]): string {
|
|
56
|
+
return cookie.map((cookie) => `${cookie.name}=${cookie.value}`).join('; ');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async getGuestSession(): Promise<TwitterOpenApiCookie[]> {
|
|
60
|
+
const response = await this.fetchApi(TwitterOpenApi.twitter, { method: 'GET', redirect: 'manual' });
|
|
61
|
+
const chars = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'];
|
|
62
|
+
const csrfToken = [...Array(32)].reduce((a) => a + chars[Math.floor(Math.random() * chars.length)], '');
|
|
63
|
+
const cookies = this.cookieDecode(response.headers.get('set-cookie')!);
|
|
64
|
+
cookies.push({ name: 'ct0', value: csrfToken });
|
|
65
|
+
|
|
66
|
+
const html = await this.fetchApi(TwitterOpenApi.twitter, {
|
|
67
|
+
method: 'GET',
|
|
68
|
+
headers: { Cookie: this.cookieEncode(cookies) },
|
|
69
|
+
}).then((response) => response.text());
|
|
70
|
+
|
|
71
|
+
const re = new RegExp('<script nonce="([a-zA-Z0-9]{48})">(document.cookie="(.*?)";)+<\\/script>');
|
|
72
|
+
|
|
73
|
+
const script = html.match(re)[0];
|
|
74
|
+
script
|
|
75
|
+
.split('document.cookie="')
|
|
76
|
+
.slice(1)
|
|
77
|
+
.map((e) => e.replace('</script>', '').replace('";', ''))
|
|
78
|
+
.map((e) => this.cookieDecode(e)[0])
|
|
79
|
+
.filter((e) => cookies.findIndex((c) => c.name == e.name) == -1)
|
|
80
|
+
.forEach((e) => cookies.push(e));
|
|
81
|
+
|
|
82
|
+
return cookies;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
setCookies(context: i.RequestContext, cookies: TwitterOpenApiCookie[]): i.RequestContext {
|
|
86
|
+
if (context.init.headers) {
|
|
87
|
+
const headers = context.init.headers as i.HTTPHeaders;
|
|
88
|
+
headers['cookie'] = this.cookieEncode(cookies);
|
|
89
|
+
}
|
|
90
|
+
return context;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
async getClient(): Promise<TwitterOpenApiClient> {
|
|
94
|
+
const cookies: TwitterOpenApiCookie[] = await this.getGuestSession();
|
|
95
|
+
const config: i.ConfigurationParameters = {
|
|
96
|
+
fetchApi: this.fetchApi,
|
|
97
|
+
middleware: [{ pre: async (context) => this.setCookies(context, cookies) }],
|
|
98
|
+
apiKey: (key) => {
|
|
99
|
+
return {
|
|
100
|
+
'user-agent': TwitterOpenApi.userAgent,
|
|
101
|
+
'x-twitter-client-language': this.param.lang ?? 'en',
|
|
102
|
+
'x-twitter-active-user': 'yes',
|
|
103
|
+
'x-csrf-token': cookies.find((cookie) => cookie.name === 'ct0')?.value,
|
|
104
|
+
'x-guest-token': cookies.find((cookie) => cookie.name === 'gt')?.value,
|
|
105
|
+
}[key]!;
|
|
106
|
+
},
|
|
107
|
+
accessToken: TwitterOpenApi.bearer,
|
|
108
|
+
};
|
|
109
|
+
const flag = this.fetchApi(TwitterOpenApi.url, { method: 'GET' }).then((res) => res.json()) as Promise<DefaultFlag>;
|
|
110
|
+
return new TwitterOpenApiClient(new i.Configuration(config), await flag);
|
|
38
111
|
}
|
|
39
112
|
|
|
40
113
|
async getClientFromCookies(ct0: string, authToken: string): Promise<TwitterOpenApiClient> {
|
|
114
|
+
const cookies: TwitterOpenApiCookie[] = await this.getGuestSession();
|
|
115
|
+
[
|
|
116
|
+
{ name: 'auth_token', value: authToken },
|
|
117
|
+
{ name: 'ct0', value: ct0 },
|
|
118
|
+
]
|
|
119
|
+
.filter((e) => cookies.findIndex((c) => c.name == e.name) == -1)
|
|
120
|
+
.forEach((e) => cookies.push(e));
|
|
121
|
+
|
|
41
122
|
const config: i.ConfigurationParameters = {
|
|
42
|
-
fetchApi: this.fetchApi || fetch,
|
|
43
|
-
middleware: [
|
|
44
|
-
{
|
|
45
|
-
pre: async (context) => {
|
|
46
|
-
const cookie = [
|
|
47
|
-
{
|
|
48
|
-
name: 'auth_token',
|
|
49
|
-
value: authToken,
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
name: 'ct0',
|
|
53
|
-
value: ct0,
|
|
54
|
-
},
|
|
55
|
-
]
|
|
56
|
-
.map((cookie) => `${cookie.name}=${cookie.value}`)
|
|
57
|
-
.join('; ');
|
|
58
|
-
|
|
59
|
-
if (context.init.headers) {
|
|
60
|
-
const headers = context.init.headers as i.HTTPHeaders;
|
|
61
|
-
headers['cookie'] = cookie;
|
|
62
|
-
}
|
|
63
|
-
return context;
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
],
|
|
123
|
+
fetchApi: this.param.fetchApi || fetch,
|
|
124
|
+
middleware: [{ pre: async (context) => this.setCookies(context, cookies) }],
|
|
67
125
|
apiKey: (key) => {
|
|
68
126
|
return {
|
|
69
127
|
'user-agent': TwitterOpenApi.userAgent,
|
|
70
128
|
'x-twitter-client-language': this.param.lang ?? 'en',
|
|
71
129
|
'x-twitter-active-user': 'yes',
|
|
72
130
|
'x-twitter-auth-type': 'OAuth2Session',
|
|
73
|
-
'x-csrf-token': ct0,
|
|
131
|
+
'x-csrf-token': cookies.find((cookie) => cookie.name === 'ct0')?.value,
|
|
74
132
|
}[key]!;
|
|
75
133
|
},
|
|
76
134
|
accessToken: TwitterOpenApi.bearer,
|
|
77
135
|
};
|
|
78
|
-
const flag =
|
|
79
|
-
.fetchApi(TwitterOpenApi.url, { method: 'GET' })
|
|
80
|
-
.then((res) => res.json()) as Promise<DefaultFlag>;
|
|
136
|
+
const flag = this.fetchApi(TwitterOpenApi.url, { method: 'GET' }).then((res) => res.json()) as Promise<DefaultFlag>;
|
|
81
137
|
return new TwitterOpenApiClient(new i.Configuration(config), await flag);
|
|
82
138
|
}
|
|
83
139
|
}
|
package/src/apis/defaultApi.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as i from 'twitter-openapi-typescript-generated';
|
|
2
|
-
import {
|
|
3
|
-
import { RequestParam,
|
|
4
|
-
import { TwitterApiUtilsResponse } from '@/types/response';
|
|
2
|
+
import { buildHeader } from '@/utils';
|
|
3
|
+
import { RequestParam, DefaultFlag, TwitterApiUtilsResponse } from '@/models';
|
|
5
4
|
|
|
6
5
|
export type ProfileSpotlightsQueryParam = {
|
|
7
6
|
screenName: string;
|
package/src/apis/postApi.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i from 'twitter-openapi-typescript-generated';
|
|
2
|
-
import { DefaultFlag } from '@/
|
|
3
|
-
import { buildHeader
|
|
4
|
-
import { TwitterApiUtilsResponse } from '@/
|
|
2
|
+
import { DefaultFlag } from '@/models';
|
|
3
|
+
import { buildHeader } from '@/utils';
|
|
4
|
+
import { TwitterApiUtilsResponse } from '@/models';
|
|
5
5
|
|
|
6
6
|
type PostCreateTweetParam = {
|
|
7
7
|
tweetText: string;
|
package/src/apis/tweetApi.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i from 'twitter-openapi-typescript-generated';
|
|
2
|
-
import { DefaultFlag, TweetListApiUtilsResponse, ApiUtilsRaw } from '@/
|
|
3
|
-
import {
|
|
2
|
+
import { DefaultFlag, TweetListApiUtilsResponse, ApiUtilsRaw, RequestParam } from '@/models';
|
|
3
|
+
import { buildHeader, entriesCursor, instructionToEntry, tweetEntriesConverter } from '@/utils';
|
|
4
4
|
|
|
5
5
|
type GetTweetDetailParam = {
|
|
6
6
|
focalTweetId: string;
|
package/src/apis/userApi.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i from 'twitter-openapi-typescript-generated';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { RequestParam, DefaultFlag, UserApiUtilsResponse } from '@/models';
|
|
3
|
+
import { buildHeader } from '@/utils';
|
|
4
4
|
|
|
5
5
|
type getUserByScreenNameParam = {
|
|
6
6
|
screenName: string;
|
package/src/apis/userListApi.ts
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import * as i from 'twitter-openapi-typescript-generated';
|
|
2
|
-
import { DefaultFlag, ApiUtilsRaw, UserListApiUtilsResponse } from '@/
|
|
3
|
-
import {
|
|
4
|
-
RequestParam,
|
|
5
|
-
buildHeader,
|
|
6
|
-
buildUserResponse,
|
|
7
|
-
entriesCursor,
|
|
8
|
-
instructionToEntry,
|
|
9
|
-
userEntriesConverter,
|
|
10
|
-
} from '@/models';
|
|
2
|
+
import { RequestParam, DefaultFlag, ApiUtilsRaw, UserListApiUtilsResponse } from '@/models';
|
|
3
|
+
import { buildHeader, buildUserResponse, entriesCursor, instructionToEntry, userEntriesConverter } from '@/utils';
|
|
11
4
|
|
|
12
5
|
type GetFollowers = {
|
|
13
6
|
userId: string;
|
package/src/apis/v11GetApi.ts
CHANGED
package/src/apis/v11PostApi.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i from 'twitter-openapi-typescript-generated';
|
|
2
|
-
import { DefaultFlag, TwitterApiUtilsResponse } from '@/
|
|
3
|
-
import { buildHeader } from '@/
|
|
2
|
+
import { DefaultFlag, TwitterApiUtilsResponse } from '@/models';
|
|
3
|
+
import { buildHeader } from '@/utils';
|
|
4
4
|
|
|
5
5
|
type PostCreateFriendshipsParam = {
|
|
6
6
|
userId: string;
|
package/src/apis/v20GetApi.ts
CHANGED
package/src/index.ts
CHANGED
package/src/models/index.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
1
|
+
export * from './flag';
|
|
2
|
+
export * from './header';
|
|
3
|
+
export * from './timeline';
|
|
4
|
+
export * from './tweet';
|
|
5
|
+
export * from './user_list';
|
|
6
|
+
export * from './user';
|
|
7
|
+
export * from './response';
|
|
8
|
+
export * from './utils';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i from 'twitter-openapi-typescript-generated';
|
|
2
|
-
import { CursorApiUtilsResponse, ApiUtilsRaw, ApiUtilsHeader } from '@/
|
|
2
|
+
import { CursorApiUtilsResponse, ApiUtilsRaw, ApiUtilsHeader } from '@/models';
|
|
3
3
|
|
|
4
4
|
export type TweetListApiUtilsResponse = {
|
|
5
5
|
raw: ApiUtilsRaw;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i from 'twitter-openapi-typescript-generated';
|
|
2
|
-
import { ApiUtilsRaw, CursorApiUtilsResponse, ApiUtilsHeader } from '@/
|
|
2
|
+
import { ApiUtilsRaw, CursorApiUtilsResponse, ApiUtilsHeader } from '@/models';
|
|
3
3
|
|
|
4
4
|
export type UserListApiUtilsResponse = {
|
|
5
5
|
raw: ApiUtilsRaw;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i from 'twitter-openapi-typescript-generated';
|
|
2
|
-
import { TweetApiUtilsData, UserApiUtilsData, CursorApiUtilsResponse, ApiUtilsHeader } from '@/
|
|
2
|
+
import { TweetApiUtilsData, UserApiUtilsData, CursorApiUtilsResponse, ApiUtilsHeader } from '@/models';
|
|
3
3
|
|
|
4
4
|
export const instructionToEntry = (item: i.InstructionUnion[]): i.TimelineAddEntry[] => {
|
|
5
5
|
return item
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './api';
|
package/test/init.ts
CHANGED
|
@@ -27,8 +27,8 @@ export const logger = log4js
|
|
|
27
27
|
.getLogger('Test');
|
|
28
28
|
|
|
29
29
|
export const getClient = async () => {
|
|
30
|
-
const api = new TwitterOpenApi();
|
|
31
|
-
api.setFetchApi(fetch as any);
|
|
30
|
+
const api = new TwitterOpenApi({ fetchApi: fetch as any });
|
|
32
31
|
const client = await api.getClientFromCookies(ct0, authToken);
|
|
32
|
+
// const client = await api.getClient();
|
|
33
33
|
return client;
|
|
34
34
|
};
|
package/test/util.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/models/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,sCAAsC,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEtG,eAAO,MAAM,kBAAkB,SAAU,EAAE,gBAAgB,EAAE,KAAG,EAAE,gBAAgB,EAIjF,CAAC;AAEF,eAAO,MAAM,qBAAqB,SAAU,EAAE,gBAAgB,EAAE,KAAG,iBAAiB,EA0BnF,CAAC;AAEF,KAAK,sBAAsB,GAAG;IAC5B,MAAM,EAAE,CAAC,CAAC,UAAU,CAAC;IACrB,gBAAgB,CAAC,EAAE,GAAG,CAAC;IACvB,KAAK,CAAC,EAAE,CAAC,CAAC,aAAa,EAAE,CAAC;CAC3B,CAAC;AACF,eAAO,MAAM,kBAAkB,SAAU,sBAAsB,KAAG,iBAAiB,GAAG,SAgBrF,CAAC;AAEF,eAAO,MAAM,qBAAqB,iBAAkB,EAAE,UAAU,KAAG,EAAE,KAAK,GAAG,SAU5E,CAAC;AAEF,eAAO,MAAM,oBAAoB,SAAU,EAAE,gBAAgB,EAAE,KAAG,EAAE,YAAY,EAS/E,CAAC;AAEF,eAAO,MAAM,iBAAiB,SAAU,EAAE,YAAY,KAAG,gBAKxD,CAAC;AAEF,eAAO,MAAM,aAAa,SAAU,EAAE,gBAAgB,EAAE,KAAG,sBAc1D,CAAC;AAEF,eAAO,MAAM,WAAW,eAAgB,EAAE,sBA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","sources":["../../../src/models/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,sCAAsC,CAAC;AAE1D,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI,CAAC,iBAAiB,EAAE;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB,KAAK,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;AAEhC,MAAM,MAAM,YAAY,CAAC,EAAE,EAAE,EAAE,IAAI;IACjC,KAAK,EAAE,WAAW,CAAC,EAAE,CAAC,CAAC;IACvB,SAAS,EAAE,eAAe,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,eAAe,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../src/models/type.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flag.d.ts","sourceRoot":"","sources":["../../../src/types/flag.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB,CAAC,GAAG,EAAE,MAAM,GAAG;QACb,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;CACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../../src/types/header.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,OAAO,CAAC;IACb,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,2CAAyB;AACzB,6CAA2B;AAC3B,0CAAwB;AACxB,8CAA4B;AAC5B,yCAAuB;AACvB,6CAA2B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../../src/types/response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,MAAM,uBAAuB,CAAC,CAAC,IAAI;IACvC,GAAG,EAAE,kBAAkB,CAAC;IACxB,MAAM,EAAE,cAAc,CAAC;IACvB,IAAI,EAAE,CAAC,CAAC;CACT,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"timeline.d.ts","sourceRoot":"","sources":["../../../src/types/timeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,sCAAsC,CAAC;AAE1D,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,CAAC,EAAE,CAAC,CAAC,sBAAsB,CAAC;IAClC,GAAG,CAAC,EAAE,CAAC,CAAC,sBAAsB,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,EAAE,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAClC,KAAK,EAAE,CAAC,CAAC,gBAAgB,EAAE,CAAC;CAC7B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tweet.d.ts","sourceRoot":"","sources":["../../../src/types/tweet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,sCAAsC,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9E,MAAM,MAAM,yBAAyB,GAAG;IACtC,GAAG,EAAE,WAAW,CAAC;IACjB,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,EAAE,sBAAsB,CAAC;IAC/B,IAAI,EAAE,iBAAiB,EAAE,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,GAAG,EAAE,CAAC,CAAC,UAAU,CAAC;IAClB,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC;IACf,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;IACb,KAAK,EAAE,iBAAiB,EAAE,CAAC;IAC3B,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,SAAS,CAAC,EAAE,iBAAiB,CAAC;IAC9B,gBAAgB,CAAC,EAAE,GAAG,CAAC;CACxB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../src/types/user.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,sCAAsC,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,MAAM,oBAAoB,GAAG;IACjC,GAAG,EAAE,eAAe,CAAC;IACrB,MAAM,EAAE,cAAc,CAAC;IACvB,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"user_list.d.ts","sourceRoot":"","sources":["../../../src/types/user_list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,sCAAsC,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9E,MAAM,MAAM,wBAAwB,GAAG;IACrC,GAAG,EAAE,WAAW,CAAC;IACjB,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,EAAE,sBAAsB,CAAC;IAC/B,IAAI,EAAE,gBAAgB,EAAE,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,EAAE,CAAC,CAAC,YAAY,CAAC;IACpB,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;CACd,CAAC"}
|
package/src/types/index.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|