Fixed empty page breaking Vixen scraper.

This commit is contained in:
DebaucheryLibrarian
2020-11-26 03:13:43 +01:00
parent 980efbc93d
commit 54df9d0c78
8 changed files with 54 additions and 22 deletions

View File

@@ -207,8 +207,12 @@ async function fetchLatest(site, page = 1) {
const url = `${site.url}/api/videos?page=${page}`;
const res = await http.get(url);
if (res.status === 200) {
return scrapeAll(res.body.data.videos, site);
if (res.ok) {
if (res.body.data.videos) {
return scrapeAll(res.body.data.videos, site);
}
return null;
}
return res.status;
@@ -218,8 +222,12 @@ async function fetchUpcoming(site) {
const apiUrl = `${site.url}/api`;
const res = await http.get(apiUrl);
if (res.status === 200) {
return scrapeUpcoming(res.body.data.nextScene, site);
if (res.ok) {
if (res.body.data.nextScene) {
return scrapeUpcoming(res.body.data.nextScene, site);
}
return null;
}
return res.status;
@@ -231,7 +239,7 @@ async function fetchScene(url, site, baseRelease) {
const res = await http.get(apiUrl);
if (res.status === 200) {
if (res.ok) {
return scrapeScene(res.body.data, url, site, baseRelease);
}
@@ -244,7 +252,7 @@ async function fetchProfile({ name: actorName }, { site }, include) {
const url = `${origin}/api/${actorSlug}`;
const res = await http.get(url);
if (res.status === 200) {
if (res.ok) {
return scrapeProfile(res.body.data, origin, include.scenes);
}