rettiwt-api 2.1.0 → 2.2.0
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/.github/workflows/publish.yml +0 -3
- package/README.md +28 -12
- package/dist/Rettiwt.d.ts +3 -2
- package/dist/Rettiwt.js +5 -9
- package/dist/Rettiwt.js.map +1 -1
- package/dist/models/CursoredData.d.ts +15 -15
- package/dist/models/CursoredData.js +18 -18
- package/dist/models/CursoredData.js.map +1 -1
- package/dist/models/Tweet.d.ts +39 -17
- package/dist/models/Tweet.js +74 -31
- package/dist/models/Tweet.js.map +1 -1
- package/dist/models/User.d.ts +1 -1
- package/dist/models/User.js.map +1 -1
- package/dist/services/FetcherService.d.ts +19 -3
- package/dist/services/FetcherService.js +33 -5
- package/dist/services/FetcherService.js.map +1 -1
- package/dist/services/TweetService.d.ts +3 -3
- package/dist/services/TweetService.js +4 -3
- package/dist/services/TweetService.js.map +1 -1
- package/dist/services/UserService.d.ts +16 -3
- package/dist/services/UserService.js +33 -3
- package/dist/services/UserService.js.map +1 -1
- package/dist/types/CursoredData.d.ts +9 -9
- package/dist/types/Tweet.d.ts +27 -15
- package/package.json +4 -2
- package/src/Rettiwt.ts +5 -11
- package/src/models/CursoredData.ts +19 -19
- package/src/models/Tweet.ts +102 -50
- package/src/models/User.ts +3 -1
- package/src/services/FetcherService.ts +38 -5
- package/src/services/TweetService.ts +4 -4
- package/src/services/UserService.ts +27 -4
- package/src/types/CursoredData.ts +10 -10
- package/src/types/Tweet.ts +35 -19
package/README.md
CHANGED
|
@@ -26,6 +26,19 @@ Although the above process initializes a new project, that is, in fact, not nece
|
|
|
26
26
|
|
|
27
27
|
**Note:** The API_KEY (cookie) that we generated, is a very sensitive information and provides all access to the Twitter account. Therefore, it is generally recommended to store it as an environment variable and use it from there.
|
|
28
28
|
|
|
29
|
+
## Using a proxy
|
|
30
|
+
|
|
31
|
+
For masking of IP address using a proxy server, use the following code snippet for instantiation of Rettiwt:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
/**
|
|
35
|
+
* proxyUrl is the URL or configuration for the proxy server you want to use.`
|
|
36
|
+
*/
|
|
37
|
+
const rettiwt = Rettiwt(API_KEY, proxyUrl);
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
This creates a Rettiwt instance which uses the given proxy server for making requests to Twitter.
|
|
41
|
+
|
|
29
42
|
## Usage
|
|
30
43
|
|
|
31
44
|
The following examples may help you to get started using the library:
|
|
@@ -109,20 +122,23 @@ For more information regarding the different available filter options, please re
|
|
|
109
122
|
So far, the following operations are supported:
|
|
110
123
|
|
|
111
124
|
### Tweets
|
|
112
|
-
|
|
113
|
-
-
|
|
114
|
-
-
|
|
115
|
-
-
|
|
116
|
-
-
|
|
117
|
-
-
|
|
118
|
-
-
|
|
119
|
-
-
|
|
125
|
+
|
|
126
|
+
- [Getting the details of a tweet](https://rishikant181.github.io/Rettiwt-API/classes/TweetService.html#details)
|
|
127
|
+
- [Favoriting/liking a tweet](https://rishikant181.github.io/Rettiwt-API/classes/TweetService.html#favorite)
|
|
128
|
+
- [Getting the list of users who favorited/liked a given tweet](https://rishikant181.github.io/Rettiwt-API/classes/TweetService.html#favoriters)
|
|
129
|
+
- [Getting the list of tweets from a given Twitter list](https://rishikant181.github.io/Rettiwt-API/classes/TweetService.html#list)
|
|
130
|
+
- [Retweeting/reposting a tweet](https://rishikant181.github.io/Rettiwt-API/classes/TweetService.html#retweet)
|
|
131
|
+
- [Getting the list of users who retweeted/reposted a given tweet](https://rishikant181.github.io/Rettiwt-API/classes/TweetService.html#retweeters)
|
|
132
|
+
- [Searching for the list of tweets that match a given filter](https://rishikant181.github.io/Rettiwt-API/classes/TweetService.html#search)
|
|
133
|
+
- [Posting a new tweet](https://rishikant181.github.io/Rettiwt-API/classes/TweetService.html#tweet)
|
|
120
134
|
|
|
121
135
|
### Users
|
|
122
|
-
|
|
123
|
-
-
|
|
124
|
-
-
|
|
125
|
-
-
|
|
136
|
+
|
|
137
|
+
- [Getting the details of a user](https://rishikant181.github.io/Rettiwt-API/classes/UserService.html#details)
|
|
138
|
+
- [Getting the list of users who follow the given user](https://rishikant181.github.io/Rettiwt-API/classes/UserService.html#followers)
|
|
139
|
+
- [Getting the list of users who are followed by the given user](https://rishikant181.github.io/Rettiwt-API/classes/UserService.html#following)
|
|
140
|
+
- [Getting the list of tweets favorited/liked by the given user](https://rishikant181.github.io/Rettiwt-API/classes/UserService.html#likes)
|
|
141
|
+
- [Getting the timeline of a user](https://rishikant181.github.io/Rettiwt-API/classes/UserService.html#timeline)
|
|
126
142
|
|
|
127
143
|
## API Reference
|
|
128
144
|
|
package/dist/Rettiwt.d.ts
CHANGED
|
@@ -13,7 +13,8 @@ export declare class Rettiwt {
|
|
|
13
13
|
/**
|
|
14
14
|
* Initializes a new Rettiwt instance using the given api key.
|
|
15
15
|
*
|
|
16
|
-
* @param apiKey - The apiKey (cookie) to
|
|
16
|
+
* @param apiKey - The apiKey (cookie) to use for authenticating Rettiwt against Twitter API.
|
|
17
|
+
* @param proxyUrl - Optional URL with proxy configuration to use for requests to Twitter API.
|
|
17
18
|
*/
|
|
18
|
-
constructor(apiKey: string);
|
|
19
|
+
constructor(apiKey: string, proxyUrl?: URL);
|
|
19
20
|
}
|
package/dist/Rettiwt.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Rettiwt = void 0;
|
|
4
|
-
// PACKAGE
|
|
5
|
-
var rettiwt_auth_1 = require("rettiwt-auth");
|
|
6
4
|
// SERVICES
|
|
7
5
|
var TweetService_1 = require("./services/TweetService");
|
|
8
6
|
var UserService_1 = require("./services/UserService");
|
|
@@ -15,14 +13,12 @@ var Rettiwt = /** @class */ (function () {
|
|
|
15
13
|
/**
|
|
16
14
|
* Initializes a new Rettiwt instance using the given api key.
|
|
17
15
|
*
|
|
18
|
-
* @param apiKey - The apiKey (cookie) to
|
|
16
|
+
* @param apiKey - The apiKey (cookie) to use for authenticating Rettiwt against Twitter API.
|
|
17
|
+
* @param proxyUrl - Optional URL with proxy configuration to use for requests to Twitter API.
|
|
19
18
|
*/
|
|
20
|
-
function Rettiwt(apiKey) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
// Initalizing service instances
|
|
24
|
-
this.tweet = new TweetService_1.TweetService(cred);
|
|
25
|
-
this.user = new UserService_1.UserService(cred);
|
|
19
|
+
function Rettiwt(apiKey, proxyUrl) {
|
|
20
|
+
this.tweet = new TweetService_1.TweetService(apiKey, proxyUrl);
|
|
21
|
+
this.user = new UserService_1.UserService(apiKey, proxyUrl);
|
|
26
22
|
}
|
|
27
23
|
return Rettiwt;
|
|
28
24
|
}());
|
package/dist/Rettiwt.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Rettiwt.js","sourceRoot":"","sources":["../src/Rettiwt.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"Rettiwt.js","sourceRoot":"","sources":["../src/Rettiwt.ts"],"names":[],"mappings":";;;AAAA,WAAW;AACX,wDAAuD;AACvD,sDAAqD;AAErD;;;;GAIG;AACH;IAOC;;;;;OAKG;IACH,iBAAY,MAAc,EAAE,QAAc;QACzC,IAAI,CAAC,KAAK,GAAG,IAAI,2BAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAChD,IAAI,CAAC,IAAI,GAAG,IAAI,yBAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC/C,CAAC;IACF,cAAC;AAAD,CAAC,AAjBD,IAiBC;AAjBY,0BAAO"}
|
|
@@ -2,21 +2,6 @@ import { ITweet as IRawTweet, IUser as IRawUser } from 'rettiwt-core';
|
|
|
2
2
|
import { Tweet } from './Tweet';
|
|
3
3
|
import { User } from './User';
|
|
4
4
|
import { ICursor, ICursoredData } from '../types/CursoredData';
|
|
5
|
-
/**
|
|
6
|
-
* The cursor to the batch of data to be fetched.
|
|
7
|
-
*
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
10
|
-
export declare class Cursor implements ICursor {
|
|
11
|
-
/** The cursor string. */
|
|
12
|
-
value: string;
|
|
13
|
-
/**
|
|
14
|
-
* Initializes a new cursor from the given cursor string.
|
|
15
|
-
*
|
|
16
|
-
* @param cursorStr - The string representation of the cursor.
|
|
17
|
-
*/
|
|
18
|
-
constructor(cursorStr: string);
|
|
19
|
-
}
|
|
20
5
|
/**
|
|
21
6
|
* The data that us fetched batch-wise along with a cursor.
|
|
22
7
|
*
|
|
@@ -35,3 +20,18 @@ export declare class CursoredData<T extends Tweet | User> implements ICursoredDa
|
|
|
35
20
|
*/
|
|
36
21
|
constructor(list?: (IRawTweet | IRawUser)[], next?: string);
|
|
37
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* The cursor to the batch of data to be fetched.
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
export declare class Cursor implements ICursor {
|
|
29
|
+
/** The cursor string. */
|
|
30
|
+
value: string;
|
|
31
|
+
/**
|
|
32
|
+
* Initializes a new cursor from the given cursor string.
|
|
33
|
+
*
|
|
34
|
+
* @param cursorStr - The string representation of the cursor.
|
|
35
|
+
*/
|
|
36
|
+
constructor(cursorStr: string);
|
|
37
|
+
}
|
|
@@ -1,26 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Cursor = exports.CursoredData = void 0;
|
|
4
4
|
// MODELS
|
|
5
5
|
var Tweet_1 = require("./Tweet");
|
|
6
6
|
var User_1 = require("./User");
|
|
7
|
-
/**
|
|
8
|
-
* The cursor to the batch of data to be fetched.
|
|
9
|
-
*
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
var Cursor = /** @class */ (function () {
|
|
13
|
-
/**
|
|
14
|
-
* Initializes a new cursor from the given cursor string.
|
|
15
|
-
*
|
|
16
|
-
* @param cursorStr - The string representation of the cursor.
|
|
17
|
-
*/
|
|
18
|
-
function Cursor(cursorStr) {
|
|
19
|
-
this.value = cursorStr;
|
|
20
|
-
}
|
|
21
|
-
return Cursor;
|
|
22
|
-
}());
|
|
23
|
-
exports.Cursor = Cursor;
|
|
24
7
|
/**
|
|
25
8
|
* The data that us fetched batch-wise along with a cursor.
|
|
26
9
|
*
|
|
@@ -56,4 +39,21 @@ var CursoredData = /** @class */ (function () {
|
|
|
56
39
|
return CursoredData;
|
|
57
40
|
}());
|
|
58
41
|
exports.CursoredData = CursoredData;
|
|
42
|
+
/**
|
|
43
|
+
* The cursor to the batch of data to be fetched.
|
|
44
|
+
*
|
|
45
|
+
* @public
|
|
46
|
+
*/
|
|
47
|
+
var Cursor = /** @class */ (function () {
|
|
48
|
+
/**
|
|
49
|
+
* Initializes a new cursor from the given cursor string.
|
|
50
|
+
*
|
|
51
|
+
* @param cursorStr - The string representation of the cursor.
|
|
52
|
+
*/
|
|
53
|
+
function Cursor(cursorStr) {
|
|
54
|
+
this.value = cursorStr;
|
|
55
|
+
}
|
|
56
|
+
return Cursor;
|
|
57
|
+
}());
|
|
58
|
+
exports.Cursor = Cursor;
|
|
59
59
|
//# sourceMappingURL=CursoredData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CursoredData.js","sourceRoot":"","sources":["../../src/models/CursoredData.ts"],"names":[],"mappings":";;;AAGA,SAAS;AACT,iCAAgC;AAChC,+BAA8B;AAK9B
|
|
1
|
+
{"version":3,"file":"CursoredData.js","sourceRoot":"","sources":["../../src/models/CursoredData.ts"],"names":[],"mappings":";;;AAGA,SAAS;AACT,iCAAgC;AAChC,+BAA8B;AAK9B;;;;;;GAMG;AACH;IAOC;;;OAGG;IACH,sBAAY,IAAmC,EAAE,IAAiB;QAAtD,qBAAA,EAAA,SAAmC;QAAE,qBAAA,EAAA,SAAiB;QAVlE,0CAA0C;QAC1C,SAAI,GAAQ,EAAE,CAAC;QAUd,8DAA8D;QAC9D,KAAmB,UAAI,EAAJ,aAAI,EAAJ,kBAAI,EAAJ,IAAI,EAAE;YAApB,IAAM,IAAI,aAAA;YACd,mCAAmC;YACnC,IAAI,IAAI,CAAC,UAAU,IAAI,OAAO,IAAI,IAAI,CAAC,OAAO,EAAE;gBAC/C,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,aAAK,CAAC,IAAiB,CAAM,CAAC,CAAC;aAClD;YACD,kCAAkC;iBAC7B,IAAI,IAAI,CAAC,UAAU,IAAI,MAAM,IAAI,IAAI,CAAC,OAAO,IAAK,IAAiB,CAAC,EAAE,EAAE;gBAC5E,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,WAAI,CAAC,IAAgB,CAAM,CAAC,CAAC;aAChD;SACD;QAED,uBAAuB;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IACF,mBAAC;AAAD,CAAC,AA3BD,IA2BC;AA3BY,oCAAY;AA6BzB;;;;GAIG;AACH;IAIC;;;;OAIG;IACH,gBAAY,SAAiB;QAC5B,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;IACxB,CAAC;IACF,aAAC;AAAD,CAAC,AAZD,IAYC;AAZY,wBAAM"}
|
package/dist/models/Tweet.d.ts
CHANGED
|
@@ -1,22 +1,6 @@
|
|
|
1
|
+
import { ITweet as IRawTweet, IEntities as IRawTweetEntities, IExtendedMedia as IRawExtendedMedia, EMediaType } from 'rettiwt-core';
|
|
1
2
|
import { ITweet, ITweetEntities } from '../types/Tweet';
|
|
2
|
-
import { ITweet as IRawTweet, IEntities as IRawTweetEntities } from 'rettiwt-core';
|
|
3
3
|
import { User } from './User';
|
|
4
|
-
/**
|
|
5
|
-
* The different types parsed entities like urls, media, mentions, hashtags, etc.
|
|
6
|
-
*
|
|
7
|
-
* @public
|
|
8
|
-
*/
|
|
9
|
-
export declare class TweetEntities implements ITweetEntities {
|
|
10
|
-
/** The list of hashtags mentioned in the tweet. */
|
|
11
|
-
hashtags: string[];
|
|
12
|
-
/** The list of urls mentioned in the tweet. */
|
|
13
|
-
urls: string[];
|
|
14
|
-
/** The list of IDs of users mentioned in the tweet. */
|
|
15
|
-
mentionedUsers: string[];
|
|
16
|
-
/** The list of urls to various media mentioned in the tweet. */
|
|
17
|
-
media: string[];
|
|
18
|
-
constructor(entities: IRawTweetEntities);
|
|
19
|
-
}
|
|
20
4
|
/**
|
|
21
5
|
* The details of a single Tweet.
|
|
22
6
|
*
|
|
@@ -31,6 +15,8 @@ export declare class Tweet implements ITweet {
|
|
|
31
15
|
createdAt: string;
|
|
32
16
|
/** Additional tweet entities like urls, mentions, etc. */
|
|
33
17
|
entities: TweetEntities;
|
|
18
|
+
/** The urls of the media contents of the tweet (if any). */
|
|
19
|
+
media: TweetMedia[];
|
|
34
20
|
/** The rest id of the tweet which is quoted in the tweet. */
|
|
35
21
|
quoted: string;
|
|
36
22
|
/** The full text content of the tweet. */
|
|
@@ -58,3 +44,39 @@ export declare class Tweet implements ITweet {
|
|
|
58
44
|
*/
|
|
59
45
|
constructor(tweet: IRawTweet);
|
|
60
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* The different types parsed entities like urls, media, mentions, hashtags, etc.
|
|
49
|
+
*
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
export declare class TweetEntities implements ITweetEntities {
|
|
53
|
+
/** The list of hashtags mentioned in the tweet. */
|
|
54
|
+
hashtags: string[];
|
|
55
|
+
/** The list of urls mentioned in the tweet. */
|
|
56
|
+
urls: string[];
|
|
57
|
+
/** The list of IDs of users mentioned in the tweet. */
|
|
58
|
+
mentionedUsers: string[];
|
|
59
|
+
/**
|
|
60
|
+
* Initializes the TweetEntities from the raw tweet entities.
|
|
61
|
+
*
|
|
62
|
+
* @param entities - The raw tweet entities.
|
|
63
|
+
*/
|
|
64
|
+
constructor(entities: IRawTweetEntities);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* A single media content.
|
|
68
|
+
*
|
|
69
|
+
* @public
|
|
70
|
+
*/
|
|
71
|
+
export declare class TweetMedia {
|
|
72
|
+
/** The type of media. */
|
|
73
|
+
type: EMediaType;
|
|
74
|
+
/** The direct URL to the media. */
|
|
75
|
+
url: string;
|
|
76
|
+
/**
|
|
77
|
+
* Initializes the TweetMedia from the raw tweet media.
|
|
78
|
+
*
|
|
79
|
+
* @param media - The raw tweet media.
|
|
80
|
+
*/
|
|
81
|
+
constructor(media: IRawExtendedMedia);
|
|
82
|
+
}
|
package/dist/models/Tweet.js
CHANGED
|
@@ -1,16 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.TweetMedia = exports.TweetEntities = exports.Tweet = void 0;
|
|
4
|
+
// PACKAGES
|
|
5
|
+
var rettiwt_core_1 = require("rettiwt-core");
|
|
4
6
|
// MODELS
|
|
5
7
|
var User_1 = require("./User");
|
|
6
8
|
// PARSERS
|
|
7
9
|
var JsonUtils_1 = require("../helper/JsonUtils");
|
|
10
|
+
/**
|
|
11
|
+
* The details of a single Tweet.
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
var Tweet = /** @class */ (function () {
|
|
16
|
+
/**
|
|
17
|
+
* Initializes a new Tweet from the given raw tweet data.
|
|
18
|
+
*
|
|
19
|
+
* @param tweet - The raw tweet data.
|
|
20
|
+
*/
|
|
21
|
+
function Tweet(tweet) {
|
|
22
|
+
var _a, _b;
|
|
23
|
+
this.id = tweet.rest_id;
|
|
24
|
+
this.createdAt = tweet.legacy.created_at;
|
|
25
|
+
this.tweetBy = new User_1.User(tweet.core.user_results.result);
|
|
26
|
+
this.entities = new TweetEntities(tweet.legacy.entities);
|
|
27
|
+
this.media = (_b = (_a = tweet.legacy.extended_entities) === null || _a === void 0 ? void 0 : _a.media) === null || _b === void 0 ? void 0 : _b.map(function (media) { return new TweetMedia(media); });
|
|
28
|
+
this.quoted = tweet.legacy.quoted_status_id_str;
|
|
29
|
+
this.fullText = (0, JsonUtils_1.normalizeText)(tweet.legacy.full_text);
|
|
30
|
+
this.replyTo = tweet.legacy.in_reply_to_status_id_str;
|
|
31
|
+
this.lang = tweet.legacy.lang;
|
|
32
|
+
this.quoteCount = tweet.legacy.quote_count;
|
|
33
|
+
this.replyCount = tweet.legacy.reply_count;
|
|
34
|
+
this.retweetCount = tweet.legacy.retweet_count;
|
|
35
|
+
this.likeCount = tweet.legacy.favorite_count;
|
|
36
|
+
this.viewCount = parseInt(tweet.views.count);
|
|
37
|
+
this.bookmarkCount = tweet.legacy.bookmark_count;
|
|
38
|
+
}
|
|
39
|
+
return Tweet;
|
|
40
|
+
}());
|
|
41
|
+
exports.Tweet = Tweet;
|
|
8
42
|
/**
|
|
9
43
|
* The different types parsed entities like urls, media, mentions, hashtags, etc.
|
|
10
44
|
*
|
|
11
45
|
* @public
|
|
12
46
|
*/
|
|
13
47
|
var TweetEntities = /** @class */ (function () {
|
|
48
|
+
/**
|
|
49
|
+
* Initializes the TweetEntities from the raw tweet entities.
|
|
50
|
+
*
|
|
51
|
+
* @param entities - The raw tweet entities.
|
|
52
|
+
*/
|
|
14
53
|
function TweetEntities(entities) {
|
|
15
54
|
/** The list of hashtags mentioned in the tweet. */
|
|
16
55
|
this.hashtags = [];
|
|
@@ -18,8 +57,6 @@ var TweetEntities = /** @class */ (function () {
|
|
|
18
57
|
this.urls = [];
|
|
19
58
|
/** The list of IDs of users mentioned in the tweet. */
|
|
20
59
|
this.mentionedUsers = [];
|
|
21
|
-
/** The list of urls to various media mentioned in the tweet. */
|
|
22
|
-
this.media = [];
|
|
23
60
|
// Extracting user mentions
|
|
24
61
|
if (entities.user_mentions) {
|
|
25
62
|
for (var _i = 0, _a = entities.user_mentions; _i < _a.length; _i++) {
|
|
@@ -41,45 +78,51 @@ var TweetEntities = /** @class */ (function () {
|
|
|
41
78
|
this.hashtags.push(hashtag.text);
|
|
42
79
|
}
|
|
43
80
|
}
|
|
44
|
-
// Extracting media urls (if any)
|
|
45
|
-
if (entities.media) {
|
|
46
|
-
for (var _f = 0, _g = entities.media; _f < _g.length; _f++) {
|
|
47
|
-
var media = _g[_f];
|
|
48
|
-
this.media.push(media.media_url_https);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
81
|
}
|
|
52
82
|
return TweetEntities;
|
|
53
83
|
}());
|
|
54
84
|
exports.TweetEntities = TweetEntities;
|
|
55
85
|
/**
|
|
56
|
-
*
|
|
86
|
+
* A single media content.
|
|
57
87
|
*
|
|
58
88
|
* @public
|
|
59
89
|
*/
|
|
60
|
-
var
|
|
90
|
+
var TweetMedia = /** @class */ (function () {
|
|
61
91
|
/**
|
|
62
|
-
* Initializes
|
|
92
|
+
* Initializes the TweetMedia from the raw tweet media.
|
|
63
93
|
*
|
|
64
|
-
* @param
|
|
94
|
+
* @param media - The raw tweet media.
|
|
65
95
|
*/
|
|
66
|
-
function
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
this.
|
|
71
|
-
this.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
96
|
+
function TweetMedia(media) {
|
|
97
|
+
var _this = this;
|
|
98
|
+
var _a, _b;
|
|
99
|
+
/** The direct URL to the media. */
|
|
100
|
+
this.url = '';
|
|
101
|
+
this.type = media.type;
|
|
102
|
+
// If the media is a photo
|
|
103
|
+
if (media.type == rettiwt_core_1.EMediaType.PHOTO) {
|
|
104
|
+
this.url = media.media_url_https;
|
|
105
|
+
}
|
|
106
|
+
// If the media is a gif
|
|
107
|
+
else if (media.type == rettiwt_core_1.EMediaType.GIF) {
|
|
108
|
+
this.url = (_a = media.video_info) === null || _a === void 0 ? void 0 : _a.variants[0].url;
|
|
109
|
+
}
|
|
110
|
+
// If the media is a video
|
|
111
|
+
else {
|
|
112
|
+
/** The highest bitrate of all variants. */
|
|
113
|
+
var highestRate_1 = 0;
|
|
114
|
+
/**
|
|
115
|
+
* Selecting the URL of the video variant with the highest bitrate.
|
|
116
|
+
*/
|
|
117
|
+
(_b = media.video_info) === null || _b === void 0 ? void 0 : _b.variants.forEach(function (variant) {
|
|
118
|
+
if (variant.bitrate > highestRate_1) {
|
|
119
|
+
highestRate_1 = variant.bitrate;
|
|
120
|
+
_this.url = variant.url;
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
81
124
|
}
|
|
82
|
-
return
|
|
125
|
+
return TweetMedia;
|
|
83
126
|
}());
|
|
84
|
-
exports.
|
|
127
|
+
exports.TweetMedia = TweetMedia;
|
|
85
128
|
//# sourceMappingURL=Tweet.js.map
|
package/dist/models/Tweet.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tweet.js","sourceRoot":"","sources":["../../src/models/Tweet.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"Tweet.js","sourceRoot":"","sources":["../../src/models/Tweet.ts"],"names":[],"mappings":";;;AAAA,WAAW;AACX,6CAKsB;AAKtB,SAAS;AACT,+BAA8B;AAE9B,UAAU;AACV,iDAAoD;AAEpD;;;;GAIG;AACH;IA8CC;;;;OAIG;IACH,eAAY,KAAgB;;QAC3B,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC;QACzC,IAAI,CAAC,OAAO,GAAG,IAAI,WAAI,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QACxD,IAAI,CAAC,QAAQ,GAAG,IAAI,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACzD,IAAI,CAAC,KAAK,GAAG,MAAA,MAAA,KAAK,CAAC,MAAM,CAAC,i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AC;YAE5B;;eAEG;YACH,MAAA,KAAK,CAAC,UAAU,0CAAE,QAAQ,CAAC,OAAO,CAAC,UAAC,OAAO;gBAC1C,IAAI,OAAO,CAAC,OAAO,GAAG,aAAW,EAAE;oBAClC,aAAW,GAAG,OAAO,CAAC,OAAO,CAAC;oBAC9B,KAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;iBACvB;YACF,CAAC,CAAC,CAAC;SACH;IACF,CAAC;IACF,iBAAC;AAAD,CAAC,AAvCD,IAuCC;AAvCY,gCAAU"}
|
package/dist/models/User.d.ts
CHANGED
package/dist/models/User.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"User.js","sourceRoot":"","sources":["../../src/models/User.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"User.js","sourceRoot":"","sources":["../../src/models/User.ts"],"names":[],"mappings":";;;AAMA;;;;GAIG;AACH;IA2CC;;;;OAIG;IACH,cAAY,IAAc;QACzB,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;QACxC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;QACxC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;QAC3C,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;QACvC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC;QACpD,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC;QAClD,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC;QACjD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC;QAChD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;QACrC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;QACvD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC;QACpD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,uBAAuB,CAAC;IACzD,CAAC;IACF,WAAC;AAAD,CAAC,AAhED,IAgEC;AAhEY,oBAAI"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Args, EResourceType } from 'rettiwt-core';
|
|
2
|
-
import { AuthCredential } from 'rettiwt-auth';
|
|
3
2
|
import { CursoredData } from '../models/CursoredData';
|
|
4
3
|
import { Tweet } from '../models/Tweet';
|
|
5
4
|
import { User } from '../models/User';
|
|
@@ -11,10 +10,27 @@ import { User } from '../models/User';
|
|
|
11
10
|
export declare class FetcherService {
|
|
12
11
|
/** The credential to use for authenticating against Twitter API. */
|
|
13
12
|
private cred;
|
|
13
|
+
/** The HTTPS Agent to use for requests to Twitter API. */
|
|
14
|
+
private readonly httpsAgent;
|
|
14
15
|
/**
|
|
15
|
-
* @param
|
|
16
|
+
* @param apiKey - The apiKey (cookie) to use for authenticating Rettiwt against Twitter API.
|
|
17
|
+
* @param proxyUrl - Optional URL with proxy configuration to use for requests to Twitter API.
|
|
16
18
|
*/
|
|
17
|
-
constructor(
|
|
19
|
+
constructor(apiKey: string, proxyUrl?: URL);
|
|
20
|
+
/**
|
|
21
|
+
* Returns an AuthCredential generated using the given API key.
|
|
22
|
+
*
|
|
23
|
+
* @param apiKey - The API key to use for authenticating.
|
|
24
|
+
* @returns The generated AuthCredential.
|
|
25
|
+
*/
|
|
26
|
+
private getAuthCredential;
|
|
27
|
+
/**
|
|
28
|
+
* Gets the HttpsAgent based on whether a proxy is used or not.
|
|
29
|
+
*
|
|
30
|
+
* @param proxyUrl - Optional URL with proxy configuration to use for requests to Twitter API.
|
|
31
|
+
* @returns The HttpsAgent to use.
|
|
32
|
+
*/
|
|
33
|
+
private getHttpsAgent;
|
|
18
34
|
/**
|
|
19
35
|
* The middleware for handling any http error.
|
|
20
36
|
*
|
|
@@ -43,6 +43,9 @@ exports.FetcherService = void 0;
|
|
|
43
43
|
// PACKAGES
|
|
44
44
|
var rettiwt_core_1 = require("rettiwt-core");
|
|
45
45
|
var axios_1 = __importDefault(require("axios"));
|
|
46
|
+
var https_1 = __importDefault(require("https"));
|
|
47
|
+
var rettiwt_auth_1 = require("rettiwt-auth");
|
|
48
|
+
var https_proxy_agent_1 = require("https-proxy-agent");
|
|
46
49
|
// ENUMS
|
|
47
50
|
var HTTP_1 = require("../enums/HTTP");
|
|
48
51
|
var ApiErrors_1 = require("../enums/ApiErrors");
|
|
@@ -57,11 +60,34 @@ var JsonUtils_1 = require("../helper/JsonUtils");
|
|
|
57
60
|
*/
|
|
58
61
|
var FetcherService = /** @class */ (function () {
|
|
59
62
|
/**
|
|
60
|
-
* @param
|
|
63
|
+
* @param apiKey - The apiKey (cookie) to use for authenticating Rettiwt against Twitter API.
|
|
64
|
+
* @param proxyUrl - Optional URL with proxy configuration to use for requests to Twitter API.
|
|
61
65
|
*/
|
|
62
|
-
function FetcherService(
|
|
63
|
-
this.cred =
|
|
66
|
+
function FetcherService(apiKey, proxyUrl) {
|
|
67
|
+
this.cred = this.getAuthCredential(apiKey);
|
|
68
|
+
this.httpsAgent = this.getHttpsAgent(proxyUrl);
|
|
64
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* Returns an AuthCredential generated using the given API key.
|
|
72
|
+
*
|
|
73
|
+
* @param apiKey - The API key to use for authenticating.
|
|
74
|
+
* @returns The generated AuthCredential.
|
|
75
|
+
*/
|
|
76
|
+
FetcherService.prototype.getAuthCredential = function (apiKey) {
|
|
77
|
+
return new rettiwt_auth_1.AuthCredential(apiKey.split(';'));
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Gets the HttpsAgent based on whether a proxy is used or not.
|
|
81
|
+
*
|
|
82
|
+
* @param proxyUrl - Optional URL with proxy configuration to use for requests to Twitter API.
|
|
83
|
+
* @returns The HttpsAgent to use.
|
|
84
|
+
*/
|
|
85
|
+
FetcherService.prototype.getHttpsAgent = function (proxyUrl) {
|
|
86
|
+
if (proxyUrl) {
|
|
87
|
+
return new https_proxy_agent_1.HttpsProxyAgent(proxyUrl);
|
|
88
|
+
}
|
|
89
|
+
return new https_1.default.Agent();
|
|
90
|
+
};
|
|
65
91
|
/**
|
|
66
92
|
* The middleware for handling any http error.
|
|
67
93
|
*
|
|
@@ -113,13 +139,14 @@ var FetcherService = /** @class */ (function () {
|
|
|
113
139
|
method: config.type,
|
|
114
140
|
data: config.payload,
|
|
115
141
|
headers: JSON.parse(JSON.stringify(this.cred.toHeader())),
|
|
142
|
+
httpsAgent: this.httpsAgent,
|
|
116
143
|
};
|
|
117
144
|
return [4 /*yield*/, (0, axios_1.default)(axiosRequest)
|
|
118
145
|
.then(function (res) { return _this.handleHttpError(res); })
|
|
119
146
|
.then(function (res) { return _this.handleApiError(res); })];
|
|
120
147
|
case 1:
|
|
121
148
|
/**
|
|
122
|
-
* After making the request, the response is then passed to HTTP error handling
|
|
149
|
+
* After making the request, the response is then passed to HTTP error handling middleware for HTTP error handling.
|
|
123
150
|
*/
|
|
124
151
|
return [2 /*return*/, _a.sent()];
|
|
125
152
|
}
|
|
@@ -149,7 +176,8 @@ var FetcherService = /** @class */ (function () {
|
|
|
149
176
|
}
|
|
150
177
|
else if (type == rettiwt_core_1.EResourceType.TWEET_SEARCH ||
|
|
151
178
|
type == rettiwt_core_1.EResourceType.USER_LIKES ||
|
|
152
|
-
type == rettiwt_core_1.EResourceType.LIST_TWEETS
|
|
179
|
+
type == rettiwt_core_1.EResourceType.LIST_TWEETS ||
|
|
180
|
+
type == rettiwt_core_1.EResourceType.USER_TWEETS) {
|
|
153
181
|
required = (0, JsonUtils_1.findByFilter)(data, '__typename', 'TimelineTweet').map(function (item) { return item.tweet_results.result; });
|
|
154
182
|
}
|
|
155
183
|
else if (type == rettiwt_core_1.EResourceType.TWEET_FAVORITERS ||
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FetcherService.js","sourceRoot":"","sources":["../../src/services/FetcherService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,WAAW;AACX,6CAWsB;AACtB,gDAAsF;
|
|
1
|
+
{"version":3,"file":"FetcherService.js","sourceRoot":"","sources":["../../src/services/FetcherService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,WAAW;AACX,6CAWsB;AACtB,gDAAsF;AACtF,gDAAqC;AACrC,6CAA8C;AAC9C,uDAAoD;AAEpD,QAAQ;AACR,sCAA4C;AAC5C,gDAAgD;AAEhD,SAAS;AACT,uDAAsD;AAItD,UAAU;AACV,iDAAmE;AAEnE;;;;GAIG;AACH;IAOC;;;OAGG;IACH,wBAAY,MAAc,EAAE,QAAc;QACzC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;QAC3C,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChD,CAAC;IAED;;;;;OAKG;IACK,0CAAiB,GAAzB,UAA0B,MAAc;QACvC,OAAO,IAAI,6BAAc,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;OAKG;IACK,sCAAa,GAArB,UAAsB,QAAc;QACnC,IAAI,QAAQ,EAAE;YACb,OAAO,IAAI,mCAAe,CAAC,QAAQ,CAAC,CAAC;SACrC;QAED,OAAO,IAAI,eAAK,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;IAED;;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AAK,OAAA,IAAI,CAAC,YAAY,CAAC,MAAM,EAAxB,CAAwB,CAClC,CAAC;SACF;QAED,OAAO,IAAI,2BAAY,CAAC,QAAQ,EAAE,MAAA,IAAA,wBAAY,EAAa,IAAI,EAAE,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,0CAAE,KAAK,CAAC,CAAC;IACrG,CAAC;IAED;;;;;;;OAOG;IACa,8BAAK,GAArB,UACC,YAA2B,EAC3B,IAAU;;;;;;wBAGJ,OAAO,GAAY,IAAI,sBAAO,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;wBAG7C,qBAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,UAAC,GAAG,IAAK,OAAA,GAAG,CAAC,IAAI,EAAR,CAAQ,CAAC,EAAA;;wBAAzD,GAAG,GAAG,SAAmD;wBAGzD,IAAI,GAAG,IAAI,CAAC,WAAW,CAAU,GAAG,EAAE,YAAY,CAAC,CAAC;wBAE1D,sBAAO,IAAI,EAAC;;;;KACZ;IAED;;;;;;OAMG;IACa,6BAAI,GAApB,UAAqB,YAA2B,EAAE,IAAU;;;;;;wBAErD,OAAO,GAAY,IAAI,sBAAO,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;wBAEzD,mBAAmB;wBACnB,qBAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAA;;wBAD3B,mBAAmB;wBACnB,SAA2B,CAAC;wBAE5B,sBAAO,IAAI,EAAC;;;;KACZ;IACF,qBAAC;AAAD,CAAC,AAhMD,IAgMC;AAhMY,wCAAc"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { TweetFilter } from 'rettiwt-core';
|
|
2
|
-
import { AuthCredential } from 'rettiwt-auth';
|
|
3
2
|
import { FetcherService } from './FetcherService';
|
|
4
3
|
import { Tweet } from '../models/Tweet';
|
|
5
4
|
import { User } from '../models/User';
|
|
@@ -11,11 +10,12 @@ import { CursoredData } from '../models/CursoredData';
|
|
|
11
10
|
*/
|
|
12
11
|
export declare class TweetService extends FetcherService {
|
|
13
12
|
/**
|
|
14
|
-
* @param
|
|
13
|
+
* @param apiKey - The apiKey (cookie) to use for authenticating Rettiwt against Twitter API.
|
|
14
|
+
* @param proxyUrl - Optional URL with proxy configuration to use for requests to Twitter API.
|
|
15
15
|
*
|
|
16
16
|
* @internal
|
|
17
17
|
*/
|
|
18
|
-
constructor(
|
|
18
|
+
constructor(apiKey: string, proxyUrl?: URL);
|
|
19
19
|
/**
|
|
20
20
|
* Get the details of a tweet.
|
|
21
21
|
*
|
|
@@ -64,12 +64,13 @@ var FetcherService_1 = require("./FetcherService");
|
|
|
64
64
|
var TweetService = /** @class */ (function (_super) {
|
|
65
65
|
__extends(TweetService, _super);
|
|
66
66
|
/**
|
|
67
|
-
* @param
|
|
67
|
+
* @param apiKey - The apiKey (cookie) to use for authenticating Rettiwt against Twitter API.
|
|
68
|
+
* @param proxyUrl - Optional URL with proxy configuration to use for requests to Twitter API.
|
|
68
69
|
*
|
|
69
70
|
* @internal
|
|
70
71
|
*/
|
|
71
|
-
function TweetService(
|
|
72
|
-
return _super.call(this,
|
|
72
|
+
function TweetService(apiKey, proxyUrl) {
|
|
73
|
+
return _super.call(this, apiKey, proxyUrl) || this;
|
|
73
74
|
}
|
|
74
75
|
/**
|
|
75
76
|
* Get the details of a tweet.
|