@the-convocation/twitter-scraper
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -17,18 +17,23 @@ "use strict"; | ||
let res; | ||
try { | ||
res = await (0, cross_fetch_1.default)(url, { | ||
method, | ||
headers, | ||
}); | ||
} | ||
catch (err) { | ||
if (!(err instanceof Error)) { | ||
throw err; | ||
do { | ||
try { | ||
res = await (0, cross_fetch_1.default)(url, { | ||
method, | ||
headers, | ||
}); | ||
} | ||
return { | ||
success: false, | ||
err: new Error('Failed to perform request.'), | ||
}; | ||
} | ||
await (0, requests_1.updateCookieJar)(auth.cookieJar(), res.headers); | ||
catch (err) { | ||
if (!(err instanceof Error)) { | ||
throw err; | ||
} | ||
return { | ||
success: false, | ||
err: new Error('Failed to perform request.'), | ||
}; | ||
} | ||
await (0, requests_1.updateCookieJar)(auth.cookieJar(), res.headers); | ||
if (res.status === 429) { | ||
await new Promise((resolve) => setTimeout(resolve, 100)); | ||
} | ||
} while (res.status === 429); | ||
if (!res.ok) { | ||
@@ -35,0 +40,0 @@ return { |
{ | ||
"name": "@the-convocation/twitter-scraper", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"main": "dist/_module.js", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/the-convocation/twitter-scraper.git", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
161460
2375