twitter-openapi-typescript 0.0.35 → 0.0.37
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/.vscode/settings.json +12 -4
- package/README.md +24 -10
- package/cookies.json +208 -475
- package/dist/src/api.d.ts +12 -4
- package/dist/src/api.d.ts.map +1 -1
- package/dist/src/api.js +37 -36
- package/dist/src/api.js.map +1 -1
- package/dist/src/apis/defaultApi.js +2 -2
- package/dist/src/apis/postApi.d.ts +3 -0
- package/dist/src/apis/postApi.d.ts.map +1 -1
- package/dist/src/apis/postApi.js +29 -17
- package/dist/src/apis/postApi.js.map +1 -1
- package/dist/src/apis/tweetApi.d.ts.map +1 -1
- package/dist/src/apis/tweetApi.js +15 -15
- package/dist/src/apis/tweetApi.js.map +1 -1
- package/dist/src/apis/userApi.js +2 -2
- package/dist/src/apis/userListApi.d.ts.map +1 -1
- package/dist/src/apis/userListApi.js +4 -4
- package/dist/src/apis/userListApi.js.map +1 -1
- package/dist/src/apis/usersApi.js +2 -2
- package/dist/src/apis/v11PostApi.js +2 -2
- package/dist/src/utils/api.d.ts +1 -0
- package/dist/src/utils/api.d.ts.map +1 -1
- package/dist/src/utils/api.js +8 -1
- package/dist/src/utils/api.js.map +1 -1
- package/package.json +4 -4
- package/src/api.ts +39 -36
- package/src/apis/postApi.ts +19 -4
- package/src/apis/tweetApi.ts +5 -4
- package/src/apis/userListApi.ts +3 -2
- package/src/utils/api.ts +7 -0
- package/test/api/auth.test.ts +14 -0
- package/test/api/postApi.test.ts +1 -1
- package/test/init.ts +8 -5
- package/dist/a.d.ts +0 -2
- package/dist/a.d.ts.map +0 -1
- package/dist/a.js +0 -57
- package/dist/a.js.map +0 -1
package/.vscode/settings.json
CHANGED
|
@@ -2,12 +2,20 @@
|
|
|
2
2
|
"jest.autoRun": {
|
|
3
3
|
"watch": false
|
|
4
4
|
},
|
|
5
|
+
"[json]": {
|
|
6
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
7
|
+
},
|
|
8
|
+
"[jsonc]": {
|
|
9
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
10
|
+
},
|
|
11
|
+
"[yaml]": {
|
|
12
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
13
|
+
},
|
|
14
|
+
"[markdown]": {
|
|
15
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
|
16
|
+
},
|
|
5
17
|
"[typescript]": {
|
|
6
18
|
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
7
|
-
"editor.codeActionsOnSave": {
|
|
8
|
-
"source.fixAll": "explicit",
|
|
9
|
-
"source.organizeImports": "explicit",
|
|
10
|
-
},
|
|
11
19
|
"editor.formatOnSave": true,
|
|
12
20
|
},
|
|
13
21
|
}
|
package/README.md
CHANGED
|
@@ -14,8 +14,13 @@ import { TwitterOpenApi } from 'twitter-openapi-typescript';
|
|
|
14
14
|
const api = new TwitterOpenApi();
|
|
15
15
|
const client = await api.getGuestClient();
|
|
16
16
|
const response = await client.getUserApi().getUserByScreenName({ screenName: 'elonmusk' });
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
const userLegacy = response.data?.user?.legacy;
|
|
18
|
+
if (userLegacy) {
|
|
19
|
+
console.log(userLegacy.screenName);
|
|
20
|
+
console.log(`followCount: ${userLegacy.friendsCount} followersCount: ${userLegacy.followersCount}`);
|
|
21
|
+
} else {
|
|
22
|
+
console.log('User not found');
|
|
23
|
+
}
|
|
19
24
|
```
|
|
20
25
|
|
|
21
26
|
### Login
|
|
@@ -28,10 +33,22 @@ const client = await api.getClientFromCookies({
|
|
|
28
33
|
});
|
|
29
34
|
```
|
|
30
35
|
|
|
36
|
+
### Multiple OS
|
|
37
|
+
|
|
38
|
+
The Token can only be used on the same OS that issued the Token
|
|
39
|
+
In other words, if the sec-ch-ua-platform does not match, the Token cannot be used.
|
|
40
|
+
This library uses the Linux Chrome header by default.
|
|
41
|
+
To use Token issued by Windows, do the following.
|
|
42
|
+
|
|
43
|
+
````typescript
|
|
44
|
+
TwitterOpenApi.additionalApiHeaders = {
|
|
45
|
+
'sec-ch-ua-platform': '"Windows"',
|
|
46
|
+
};
|
|
47
|
+
```
|
|
48
|
+
|
|
31
49
|
### List of APIs
|
|
32
50
|
|
|
33
51
|
You should read the Test case.
|
|
34
|
-
aaaaa
|
|
35
52
|
|
|
36
53
|
<https://github.com/fa0311/twitter-openapi-typescript/tree/master/twitter-openapi-typescript/test/api>
|
|
37
54
|
|
|
@@ -41,13 +58,10 @@ Most values exist as static variables. There is no need to change them.
|
|
|
41
58
|
|
|
42
59
|
```typescript
|
|
43
60
|
import { TwitterOpenApi } from 'twitter-openapi-typescript';
|
|
44
|
-
TwitterOpenApi.
|
|
45
|
-
TwitterOpenApi.
|
|
46
|
-
TwitterOpenApi.
|
|
47
|
-
|
|
48
|
-
TwitterOpenApi.browser_headers = 'browser headers';
|
|
49
|
-
TwitterOpenApi.api_key = 'api key';
|
|
50
|
-
```
|
|
61
|
+
TwitterOpenApi.additionalBrowserHeaders = {};
|
|
62
|
+
TwitterOpenApi.additionalApiHeaders = {};
|
|
63
|
+
TwitterOpenApi.fetchApi = fetch.bind(globalThis);
|
|
64
|
+
````
|
|
51
65
|
|
|
52
66
|
## License
|
|
53
67
|
|