From 9a183c7ffbdeeabf1b527c7e20025df1dac40b5e Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Fri, 27 Nov 2020 03:23:12 +0100 Subject: [PATCH] Added channel matching to Little Caprice Dreams. --- src/scrapers/littlecapricedreams.js | 44 ++++++++++++++--------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/src/scrapers/littlecapricedreams.js b/src/scrapers/littlecapricedreams.js index 4c99c1eb..cb75a77e 100644 --- a/src/scrapers/littlecapricedreams.js +++ b/src/scrapers/littlecapricedreams.js @@ -10,24 +10,20 @@ function matchChannel(release, channel) { ...acc, [serie.name]: serie, [serie.slug]: serie, - }), { - vr: 'littlecapricevr', - }); + }), {}); + + serieNames.vr = serieNames.littlecapricevr; + serieNames.superprivat = serieNames.superprivatex; + serieNames.superprivate = serieNames.superprivatex; + serieNames.nasst = serieNames.nassty; + serieNames.sexlesson = serieNames.sexlessons; + serieNames['sex lesson'] = serieNames.sexlessons; const serieName = release.title.match(new RegExp(Object.keys(serieNames).join('|'), 'i'))?.[0]; const serie = serieName && serieNames[slugify(serieName, '')]; - console.log(release.title); - console.log(serieName); - - if (serie) { - return { - channel: serie.slug, - title: release.title.replace(new RegExp(`${serieName}[\\s:–-]*`), ''), - }; - } - - return null; + return serie?.slug || null; + // title: release.title.replace(new RegExp(`(${serieName}|${serie.name}|${serie.slug})[\\s:–-]*`, 'i'), ''), } function scrapeAll(scenes, channel) { @@ -40,12 +36,14 @@ function scrapeAll(scenes, channel) { release.title = query.cnt('.meta h3'); release.date = query.date('.meta .post-meta', 'MMMM D, YYYY'); - release.poster = query.img('img'); - - return { - ...release, - ...matchChannel(release, channel), + release.poster = { + src: query.img('img'), + referer: channel.url, }; + + release.channel = matchChannel(release, channel); + + return release; }); } @@ -102,15 +100,15 @@ async function scrapeScene({ query }, url, channel, include) { release.photos = await fetchPhotos(query.url('.vid_buttons a[href*="project/"]')); } - return { - ...release, - ...matchChannel(release, channel), - }; + release.channel = matchChannel(release, channel); + + return release; } async function fetchLatest(channel) { // no apparent pagination, all updates on one page // using channels in part because main overview contains indistinguishable photo albums + // however, some serie pages contain videos from other series const res = await qu.getAll(channel.url, '.project'); if (res.ok) {