Returning status codes from Gamma fetch.
This commit is contained in:
parent
196449fbd6
commit
bec097f14d
|
@ -446,11 +446,11 @@ async function fetchApiLatest(site, page = 1, preData, include, upcoming = false
|
|||
encodeJSON: true,
|
||||
});
|
||||
|
||||
if (res.statusCode === 200 && res.body.results?.[0]?.hits) {
|
||||
if (res.status === 200 && res.body.results?.[0]?.hits) {
|
||||
return scrapeApiReleases(res.body.results[0].hits, site);
|
||||
}
|
||||
|
||||
return [];
|
||||
return res.status;
|
||||
}
|
||||
|
||||
async function fetchApiUpcoming(site, page = 1, preData, include) {
|
||||
|
@ -487,14 +487,22 @@ async function fetchLatest(site, page = 1) {
|
|||
const url = getLatestUrl(site, page);
|
||||
const res = await http.get(url);
|
||||
|
||||
if (res.ok) {
|
||||
return scrapeAll(res.body.toString(), site);
|
||||
}
|
||||
|
||||
return res.status;
|
||||
}
|
||||
|
||||
async function fetchUpcoming(site) {
|
||||
const url = getUpcomingUrl(site);
|
||||
const res = await http.get(url);
|
||||
|
||||
if (res.ok) {
|
||||
return scrapeAll(res.body.toString(), site, null, false);
|
||||
}
|
||||
|
||||
return res.status;
|
||||
}
|
||||
|
||||
function getDeepUrl(url, site, baseRelease, mobile) {
|
||||
|
@ -538,8 +546,8 @@ async function fetchScene(url, site, baseRelease) {
|
|||
}),
|
||||
]);
|
||||
|
||||
if (res.statusCode === 200) {
|
||||
const mobileBody = mobileRes?.statusCode === 200 ? mobileRes.body.toString() : null;
|
||||
if (res.status === 200) {
|
||||
const mobileBody = mobileRes?.status === 200 ? mobileRes.body.toString() : null;
|
||||
const scene = await scrapeScene(res.body.toString(), url, site, baseRelease, mobileBody);
|
||||
|
||||
return { ...scene, deepUrl };
|
||||
|
@ -563,7 +571,7 @@ async function fetchActorScenes(actorName, apiUrl, siteSlug) {
|
|||
encodeJSON: true,
|
||||
});
|
||||
|
||||
if (res.statusCode === 200 && res.body.results[0].hits.length > 0) {
|
||||
if (res.status === 200 && res.body.results[0].hits.length > 0) {
|
||||
return res.body.results[0].hits;
|
||||
}
|
||||
|
||||
|
@ -579,7 +587,7 @@ async function fetchProfile({ name: actorName }, context, altSearchUrl, getActor
|
|||
: `https://www.${siteSlug}.com/en/search/${siteSlug}/actor/${actorSlug}`;
|
||||
const searchRes = await http.get(searchUrl);
|
||||
|
||||
if (searchRes.statusCode !== 200) {
|
||||
if (searchRes.status !== 200) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -589,7 +597,7 @@ async function fetchProfile({ name: actorName }, context, altSearchUrl, getActor
|
|||
const url = `https://${siteSlug}.com${actorUrl}`;
|
||||
const actorRes = await http.get(url);
|
||||
|
||||
if (actorRes.statusCode !== 200) {
|
||||
if (actorRes.status !== 200) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue