triangle-utils 1.4.70 → 1.4.71

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.
@@ -6,5 +6,9 @@ export declare class UtilsTwitter {
6
6
  get_tweets(user_id: string, options: {
7
7
  compile?: boolean;
8
8
  min_twitter_tweet_id?: string;
9
- }): Promise<any>;
9
+ max_twitter_tweet_id?: string;
10
+ min_publish_time?: string;
11
+ max_publish_time?: string;
12
+ num_pages?: number;
13
+ }): Promise<any[]>;
10
14
  }
@@ -79,13 +79,16 @@ export class UtilsTwitter {
79
79
  const compile = options.compile !== undefined ? options.compile : true;
80
80
  const results = [];
81
81
  let token = undefined;
82
- while (true) {
82
+ for (let p = 0; options.num_pages === undefined || p < options.num_pages; p++) {
83
83
  let response = undefined;
84
84
  for (let i = 0;; i++) {
85
85
  try {
86
86
  response = await this.twitter.users.getPosts(user_id, {
87
87
  paginationToken: token,
88
88
  sinceId: options.min_twitter_tweet_id,
89
+ untilId: options.max_twitter_tweet_id,
90
+ startTime: options.min_publish_time,
91
+ endTime: options.max_publish_time,
89
92
  tweetFields: tweet_fields
90
93
  });
91
94
  break;
@@ -107,5 +110,6 @@ export class UtilsTwitter {
107
110
  return results;
108
111
  }
109
112
  }
113
+ return results;
110
114
  }
111
115
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-utils",
3
- "version": "1.4.70",
3
+ "version": "1.4.71",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "directories": {
@@ -85,18 +85,25 @@ export class UtilsTwitter {
85
85
 
86
86
  async get_tweets(user_id : string, options : {
87
87
  compile? : boolean
88
- min_twitter_tweet_id? : string
89
- }) : Promise<any> {
88
+ min_twitter_tweet_id? : string,
89
+ max_twitter_tweet_id? : string,
90
+ min_publish_time? : string,
91
+ max_publish_time? : string,
92
+ num_pages? : number
93
+ }) : Promise<any[]> {
90
94
  const compile = options.compile !== undefined ? options.compile : true
91
95
  const results : any[] = []
92
96
  let token : string | undefined = undefined
93
- while (true) {
97
+ for (let p = 0; options.num_pages === undefined || p < options.num_pages; p++) {
94
98
  let response : any = undefined
95
99
  for (let i = 0; ; i++) {
96
100
  try {
97
101
  response = await this.twitter.users.getPosts(user_id, {
98
102
  paginationToken : token,
99
103
  sinceId : options.min_twitter_tweet_id,
104
+ untilId : options.max_twitter_tweet_id,
105
+ startTime : options.min_publish_time,
106
+ endTime : options.max_publish_time,
100
107
  tweetFields : tweet_fields
101
108
  })
102
109
  break
@@ -116,6 +123,8 @@ export class UtilsTwitter {
116
123
  if (token === undefined || !compile) {
117
124
  return results
118
125
  }
126
+
119
127
  }
128
+ return results
120
129
  }
121
130
  }