| 19 | let rateLimitResetTime = ''; |
| 20 | |
| 21 | const fetchFromTwitter = (handle: string) => fetch('https://api.twitter.com/1.1/users/lookup.json?screen_name=' + handle, { |
| 22 | headers: { |
| 23 | Authorization: "Bearer " + process.env.TWITTER_API_TOKEN |
| 24 | }, |
| 25 | }).then(r => { |
| 26 | howManyMoreCanIDo = parseFloat(r.headers.get('x-rate-limit-remaining')!); |
| 27 | rateLimitResetTime = r.headers.get('x-rate-limit-reset')!; |
| 28 | return r.json() |
| 29 | }) |
| 30 | |
| 31 | for (const userIndex in users) { |
| 32 | const id = getIdFromTweetUrl(testimonials[userIndex]) |