rettiwt-api 1.0.1 → 1.0.2
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
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
# Rettiwt-API
|
|
2
2
|
An API for fetching data from TwitterAPI, without any rate limits!
|
|
3
3
|
|
|
4
|
-
**
|
|
4
|
+
#### **This API is not a replacement of official Twitter API, since it does not scale**
|
|
5
|
+
#### **It works well for small applications like the one side project you started and are never gonna finish**
|
|
6
|
+
#### **If you want something that will scale as you application grows, Twitter API is the way to go**
|
|
7
|
+
|
|
8
|
+
#### **The API can either be used as a GraphQL Server or as a standalone npm library**
|
|
5
9
|
|
|
6
10
|
## 1. GraphQL Server
|
|
7
11
|
Using the API as a GraphQL enables complex nested queries to fetch data from twitter.
|
|
@@ -25,14 +29,17 @@ To use the API as an npm package,
|
|
|
25
29
|
|
|
26
30
|
1. In your node project, install the package using 'npm install --save rettiwt-api'.
|
|
27
31
|
2. import { Rettiwt } from 'rettiwt-api'.
|
|
28
|
-
3. const rettiwt = Rettiwt(
|
|
32
|
+
3. const rettiwt = Rettiwt().
|
|
29
33
|
4. Use the created Rettiwt instance to fetch data from Twitter.
|
|
30
34
|
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
This creates an instance of Rettiwt which can be used to fetch data from Twitter. This instance works as guest and no form of authentication is used. However, guest mode implies functionalities such fetching of user followings, followers, likes and tweet likes, retweets, quotes and replies is not possible. Whatever data can be viewed in Twitter without loggin in, can be accessed this way.
|
|
36
|
+
|
|
37
|
+
If you wan't full functionality, you need to use the cookie of a logged in Twitter account, which can be retrieved from the browser.
|
|
33
38
|
|
|
34
|
-
- For GraphQL Server mode, pass the cookie in the header while making a request to the graphql server
|
|
35
|
-
- For npm library mode, pass the cookie to the constructor while creating instance of Rettiwt
|
|
39
|
+
- For GraphQL Server mode, pass the cookie-string in the header while making a request to the graphql server
|
|
40
|
+
- For npm library mode, pass the cookie-string to the constructor while creating instance of Rettiwt
|
|
36
41
|
|
|
37
|
-
If you
|
|
38
|
-
**No likes, followers, followings, retweets, replies, tweet likes, quotes can be fetched without using cookie!**
|
|
42
|
+
### **If you don't want to risk you twitter account getting banned, using cookies is completely optional and you can omit passing cookie and use the API as guest**
|
|
43
|
+
### **No likes, followers, followings, retweets, replies, tweet likes, quotes can be fetched without using cookie!**
|
|
44
|
+
### **It's completely safe to use the API as a guest and not using cookies, since that way, no form of authentication is used**
|
|
45
|
+
### **If you decide to use cookies for full functionality, I'M NOT RESPONSIBLE IF YOU GET YOU TWITTER ACCOUNT BANNED!**
|
|
@@ -26,21 +26,10 @@ function authorizedHeader(authCred) {
|
|
|
26
26
|
exports.authorizedHeader = authorizedHeader;
|
|
27
27
|
function guestHeader(guestCred) {
|
|
28
28
|
return [
|
|
29
|
-
'
|
|
30
|
-
'accept: */*',
|
|
31
|
-
'accept-language: en-US,en;q=0.9',
|
|
29
|
+
'Accept: */*',
|
|
32
30
|
"authorization: ".concat(guestCred.authToken),
|
|
33
|
-
'
|
|
34
|
-
|
|
35
|
-
'referer: https://twitter.com/',
|
|
36
|
-
'sec-ch-ua: ^\^"Not_A Brand^\^";v=^\^"99^\^", ^\^"Microsoft Edge^\^";v=^\^"109^\^", ^\^"Chromium^\^";v=^\^"109^\^"',
|
|
37
|
-
'sec-ch-ua-mobile: ?0',
|
|
38
|
-
'sec-ch-ua-platform: ^\^"Windows^\^"',
|
|
39
|
-
'sec-fetch-dest: empty',
|
|
40
|
-
'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 Edg/109.0.1518.70',
|
|
41
|
-
"x-guest-token: ".concat(guestCred.guestToken),
|
|
42
|
-
'x-twitter-active-user: yes',
|
|
43
|
-
'x-twitter-client-language: en'
|
|
31
|
+
'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 Edg/109.0.1518.70',
|
|
32
|
+
"x-guest-token: ".concat(guestCred.guestToken)
|
|
44
33
|
];
|
|
45
34
|
}
|
|
46
35
|
exports.guestHeader = guestHeader;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Headers.js","sourceRoot":"","sources":["../../../src/services/helper/Headers.ts"],"names":[],"mappings":";;;AAGA;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,QAAyB;IACtD,OAAO;QACH,2FAA+E;QAC/E,+BAA+B;QAC/B,wBAAiB,QAAQ,CAAC,SAAS,CAAE;QACrC,sBAAsB;QACtB,yBAAkB,QAAQ,CAAC,SAAS,CAAE;QACtC,+IAA+I;QAC/I,oCAAoC;QACpC,4BAA4B;QAC5B,iCAA+B;QAC/B,aAAa;QACb,uBAAuB;QACvB,kBAAW,QAAQ,CAAC,MAAM,CAAE;KAC/B,CAAC;AACN,CAAC;AAfD,4CAeC;AAED,SAAgB,WAAW,CAAC,SAA2B;IACnD,OAAO;QACH,
|
|
1
|
+
{"version":3,"file":"Headers.js","sourceRoot":"","sources":["../../../src/services/helper/Headers.ts"],"names":[],"mappings":";;;AAGA;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,QAAyB;IACtD,OAAO;QACH,2FAA+E;QAC/E,+BAA+B;QAC/B,wBAAiB,QAAQ,CAAC,SAAS,CAAE;QACrC,sBAAsB;QACtB,yBAAkB,QAAQ,CAAC,SAAS,CAAE;QACtC,+IAA+I;QAC/I,oCAAoC;QACpC,4BAA4B;QAC5B,iCAA+B;QAC/B,aAAa;QACb,uBAAuB;QACvB,kBAAW,QAAQ,CAAC,MAAM,CAAE;KAC/B,CAAC;AACN,CAAC;AAfD,4CAeC;AAED,SAAgB,WAAW,CAAC,SAA2B;IACnD,OAAO;QACH,aAAa;QACb,yBAAkB,SAAS,CAAC,SAAS,CAAE;QACvC,+IAA+I;QAC/I,yBAAkB,SAAS,CAAC,UAAU,CAAE;KAC3C,CAAC;AACN,CAAC;AAPD,kCAOC"}
|
package/package.json
CHANGED
|
@@ -26,20 +26,9 @@ export function authorizedHeader(authCred: AuthCredentials): any {
|
|
|
26
26
|
|
|
27
27
|
export function guestHeader(guestCred: GuestCredentials): any {
|
|
28
28
|
return [
|
|
29
|
-
'
|
|
30
|
-
'accept: */*',
|
|
31
|
-
'accept-language: en-US,en;q=0.9',
|
|
29
|
+
'Accept: */*',
|
|
32
30
|
`authorization: ${guestCred.authToken}`,
|
|
33
|
-
'
|
|
34
|
-
|
|
35
|
-
'referer: https://twitter.com/',
|
|
36
|
-
'sec-ch-ua: ^\^"Not_A Brand^\^";v=^\^"99^\^", ^\^"Microsoft Edge^\^";v=^\^"109^\^", ^\^"Chromium^\^";v=^\^"109^\^"',
|
|
37
|
-
'sec-ch-ua-mobile: ?0',
|
|
38
|
-
'sec-ch-ua-platform: ^\^"Windows^\^"',
|
|
39
|
-
'sec-fetch-dest: empty',
|
|
40
|
-
'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 Edg/109.0.1518.70',
|
|
41
|
-
`x-guest-token: ${guestCred.guestToken}`,
|
|
42
|
-
'x-twitter-active-user: yes',
|
|
43
|
-
'x-twitter-client-language: en'
|
|
31
|
+
'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 Edg/109.0.1518.70',
|
|
32
|
+
`x-guest-token: ${guestCred.guestToken}`
|
|
44
33
|
];
|
|
45
34
|
}
|