twitter-openapi-typescript 0.0.19 → 0.0.20
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 +20 -2
- package/package.json +3 -4
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ npm i twitter-openapi-typescript
|
|
|
12
12
|
import { TwitterOpenApi } from "twitter-openapi-typescript";
|
|
13
13
|
|
|
14
14
|
const api = new TwitterOpenApi();
|
|
15
|
-
const client = await api.
|
|
15
|
+
const client = await api.getGuestClient();
|
|
16
16
|
const response = await client.getUserApi().getUserByScreenName({ screenName: 'elonmusk' });
|
|
17
17
|
console.log(response.data.legacy.screenName);
|
|
18
18
|
console.log(`followCount: ${response.data.legacy.friendsCount} followersCount: ${response.data.legacy.followersCount}`);
|
|
@@ -28,7 +28,11 @@ npm i twitter-openapi-typescript
|
|
|
28
28
|
### Login
|
|
29
29
|
|
|
30
30
|
```typescript
|
|
31
|
-
|
|
31
|
+
// ct0 and authToken will also work but it is recommended to set all cookies.
|
|
32
|
+
const client = await api.getClientFromCookies({
|
|
33
|
+
ct0: "<csrf_token>",
|
|
34
|
+
auth_token: "<auth_token>",
|
|
35
|
+
});
|
|
32
36
|
```
|
|
33
37
|
|
|
34
38
|
### List of APIs
|
|
@@ -37,6 +41,20 @@ You should read the Test case.
|
|
|
37
41
|
|
|
38
42
|
<https://github.com/fa0311/twitter-openapi-typescript/tree/master/twitter-openapi-typescript/test/api>
|
|
39
43
|
|
|
44
|
+
### Customize in detail
|
|
45
|
+
|
|
46
|
+
Most values exist as static variables. There is no need to change them.
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
import { TwitterOpenApi } from "twitter-openapi-typescript";
|
|
50
|
+
TwitterOpenApi.url = "twitter-openapi placeholder json url";
|
|
51
|
+
TwitterOpenApi.twitter = "twitter first access url";
|
|
52
|
+
TwitterOpenApi.userAgent = "user agent";
|
|
53
|
+
TwitterOpenApi.bearer = "bearer token";
|
|
54
|
+
TwitterOpenApi.browser_headers = "browser headers";
|
|
55
|
+
TwitterOpenApi.api_key = "api key";
|
|
56
|
+
```
|
|
57
|
+
|
|
40
58
|
## License
|
|
41
59
|
|
|
42
60
|
This project is dual licensed. You can choose one of the following licenses:
|
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "twitter-openapi-typescript",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.20",
|
|
4
4
|
"description": "Implementation of Twitter internal API in TypeScript",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "jest",
|
|
7
|
-
"build": "tsc -p tsconfig.build.json && npx tscpaths -p tsconfig.build.json -s . -o ./dist"
|
|
8
|
-
"prepare": "npm run build"
|
|
7
|
+
"build": "tsc -p tsconfig.build.json && npx tscpaths -p tsconfig.build.json -s . -o ./dist"
|
|
9
8
|
},
|
|
10
9
|
"keywords": [
|
|
11
10
|
"twitter",
|
|
@@ -22,7 +21,7 @@
|
|
|
22
21
|
"main": "./dist/src/index.js",
|
|
23
22
|
"typings": "./dist/src/index.d.ts",
|
|
24
23
|
"dependencies": {
|
|
25
|
-
"twitter-openapi-typescript-generated": "^0.0.
|
|
24
|
+
"twitter-openapi-typescript-generated": "^0.0.13"
|
|
26
25
|
},
|
|
27
26
|
"devDependencies": {
|
|
28
27
|
"@types/jest": "*",
|