twitter-openapi-typescript 0.0.39 → 0.0.40
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 +8 -4
- package/package.json +1 -1
- package/test/init.ts +3 -3
package/README.md
CHANGED
|
@@ -41,9 +41,10 @@ This library uses the Linux Chrome header by default.
|
|
|
41
41
|
To use Token issued by Windows, do the following.
|
|
42
42
|
|
|
43
43
|
```typescript
|
|
44
|
-
|
|
44
|
+
const api = new TwitterOpenApi();
|
|
45
|
+
api.setAdditionalApiHeaders({
|
|
45
46
|
'sec-ch-ua-platform': '"Windows"',
|
|
46
|
-
};
|
|
47
|
+
});
|
|
47
48
|
```
|
|
48
49
|
|
|
49
50
|
### List of APIs
|
|
@@ -55,12 +56,15 @@ You should read the Test case.
|
|
|
55
56
|
### Customize in detail
|
|
56
57
|
|
|
57
58
|
Most values exist as static variables. There is no need to change them.
|
|
59
|
+
Changing them could result in account suspension.
|
|
60
|
+
For advanced customization, use the
|
|
61
|
+
You can also use the `TwitterOpenApiClient` class directly
|
|
58
62
|
|
|
59
63
|
```typescript
|
|
60
64
|
import { TwitterOpenApi } from 'twitter-openapi-typescript';
|
|
61
|
-
TwitterOpenApi.additionalBrowserHeaders = {};
|
|
62
|
-
TwitterOpenApi.additionalApiHeaders = {};
|
|
63
65
|
TwitterOpenApi.fetchApi = fetch.bind(globalThis);
|
|
66
|
+
TwitterOpenApi.twitter = 'https://x.com/home';
|
|
67
|
+
TwitterOpenApi.bearer = 'xxxx';
|
|
64
68
|
```
|
|
65
69
|
|
|
66
70
|
## License
|
package/package.json
CHANGED
package/test/init.ts
CHANGED
|
@@ -27,10 +27,10 @@ export type Cookie = {
|
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
export const getClient = async () => {
|
|
30
|
-
TwitterOpenApi.additionalApiHeaders = {
|
|
31
|
-
'sec-ch-ua-platform': '"Windows"',
|
|
32
|
-
};
|
|
33
30
|
const api = new TwitterOpenApi();
|
|
31
|
+
api.setAdditionalApiHeaders({
|
|
32
|
+
'sec-ch-ua-platform': '"Windows"',
|
|
33
|
+
});
|
|
34
34
|
const data = await fs.readFile('cookies.json', 'utf-8');
|
|
35
35
|
const parsed = JSON.parse(data);
|
|
36
36
|
const cookies = parsed as Cookie[];
|