Allowing HTTP rate limits to be set by configuration or argument.

This commit is contained in:
DebaucheryLibrarian
2020-11-22 23:50:24 +01:00
parent 6a5063cf32
commit 3d427f7e1d
4 changed files with 54 additions and 17 deletions

View File

@@ -159,7 +159,7 @@ async function fetchActorReleases(pages, model, origin) {
const url = `${origin}/api${model.targetUrl}?page=${page}`;
const res = await http.get(url);
if (res.code === 200) {
if (res.status === 200) {
return scrapeAll(res.body.data.videos.videos, null, origin);
}
@@ -207,22 +207,22 @@ async function fetchLatest(site, page = 1) {
const url = `${site.url}/api/videos?page=${page}`;
const res = await http.get(url);
if (res.code === 200) {
if (res.status === 200) {
return scrapeAll(res.body.data.videos, site);
}
return res.code;
return res.status;
}
async function fetchUpcoming(site) {
const apiUrl = `${site.url}/api`;
const res = await http.get(apiUrl);
if (res.code === 200) {
if (res.status === 200) {
return scrapeUpcoming(res.body.data.nextScene, site);
}
return res.code;
return res.status;
}
async function fetchScene(url, site, baseRelease) {
@@ -231,11 +231,11 @@ async function fetchScene(url, site, baseRelease) {
const res = await http.get(apiUrl);
if (res.code === 200) {
if (res.status === 200) {
return scrapeScene(res.body.data, url, site, baseRelease);
}
return res.code;
return res.status;
}
async function fetchProfile({ name: actorName }, { site }, include) {
@@ -244,7 +244,7 @@ async function fetchProfile({ name: actorName }, { site }, include) {
const url = `${origin}/api/${actorSlug}`;
const res = await http.get(url);
if (res.code === 200) {
if (res.status === 200) {
return scrapeProfile(res.body.data, origin, include.scenes);
}