Using new HTTP module with a dynamic rate limiter.

This commit is contained in:
DebaucheryLibrarian
2020-11-22 04:07:09 +01:00
parent 5d0fe44130
commit b9b777c621
27 changed files with 358 additions and 175 deletions

View File

@@ -457,8 +457,8 @@ function extractAll(htmlValue, selector) {
async function request(method = 'get', urlValue, body, selector, headers, options, queryAll = false) {
const res = await (method === 'post'
? http.post(urlValue, body, headers, options)
: http[method](urlValue, headers, options));
? http.post(urlValue, body, { ...options, headers })
: http[method](urlValue, { ...options, headers }));
if (res.ok) {
const item = queryAll
@@ -494,7 +494,7 @@ async function post(urlValue, body, selector, headers, options) {
}
async function getAll(urlValue, selector, headers, options) {
return request('get,', urlValue, selector, headers, options, true);
return request('get', urlValue, null, selector, headers, options, true);
}
async function postAll(urlValue, body, selector, headers, options) {