From ad9113f6240dcb23a52448960a54fa2a253fe435 Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Tue, 9 Jul 2024 01:44:17 +0200 Subject: [PATCH] Added Upclose to Gamma. --- seeds/02_sites.js | 9 +++++++++ src/scrapers/gamma.js | 8 ++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/seeds/02_sites.js b/seeds/02_sites.js index d954705b..480b7436 100755 --- a/seeds/02_sites.js +++ b/seeds/02_sites.js @@ -504,6 +504,15 @@ const sites = [ tags: ['lesbian'], parent: 'adulttime', }, + { + name: 'Upclose', + slug: 'upclose', + url: 'https://getupclose.com', + parent: 'adulttime', + parameters: { + querySlug: 'getupclose', + }, + }, // ADULT TIME no API results /* { diff --git a/src/scrapers/gamma.js b/src/scrapers/gamma.js index b7d5aa1f..c94231be 100755 --- a/src/scrapers/gamma.js +++ b/src/scrapers/gamma.js @@ -654,10 +654,11 @@ function scrapeApiProfile(data, releases, siteSlug) { async function fetchLatestApi(site, page = 1, options, preData, upcoming = false) { const referer = options.parameters?.referer || `${options.parameters?.networkReferer ? site.parent.url : site.url}/en/videos`; const { apiUrl } = await fetchApiCredentials(referer, site); + const slug = options.parameters.querySlug || site.slug; const params = `query=&hitsPerPage=36&maxValuesPerFacet=100&page=${page - 1}&facetFilters=[["lesbian:"],["bisex:"],["shemale:"],["upcoming:${upcoming ? 1 : 0}"]]${options.parameters.queryChannel - ? `&filters=channels.id:${options.parameters.queryChannel === true ? site.slug : options.parameters.queryChannel}` - : `&filters=sitename:${site.slug}`}`; + ? `&filters=channels.id:${options.parameters.queryChannel === true ? slug : options.parameters.queryChannel}` + : `&filters=sitename:${slug}`}`; const res = await http.post(apiUrl, { requests: [ @@ -674,7 +675,10 @@ async function fetchLatestApi(site, page = 1, options, preData, upcoming = false encodeJSON: true, }); + console.log(res.status); + if (res.status === 200 && res.body.results?.[0]?.hits) { + console.log(res.body.results); return scrapeApiReleases(res.body.results[0].hits, site, options); }