Fixed Kelly Madison posters, marking frontpage video as teaser.

This commit is contained in:
ThePendulum 2020-02-23 22:37:14 +01:00
parent 21688ab9d0
commit 164681427a
1 changed files with 11 additions and 9 deletions

View File

@ -50,8 +50,8 @@ function scrapeLatest(html, site) {
const durationString = durationEl.textContent.match(/\d+ min/); const durationString = durationEl.textContent.match(/\d+ min/);
if (durationString) release.duration = Number(durationString[0].match(/\d+/)[0]) * 60; if (durationString) release.duration = Number(durationString[0].match(/\d+/)[0]) * 60;
release.poster = scene.querySelector('.card-img-top').src; release.poster = scene.querySelector('.card-img-top').dataset.src;
release.trailer = { release.teaser = {
src: scene.querySelector('video').src, src: scene.querySelector('video').src,
}; };
@ -59,14 +59,14 @@ function scrapeLatest(html, site) {
}).filter(scene => scene); }).filter(scene => scene);
} }
function scrapeScene(html, url, site, shallowRelease) { function scrapeScene(html, url, site, baseRelease) {
const { document } = new JSDOM(html).window; const { document } = new JSDOM(html).window;
const release = { url, site }; const release = { url, site };
const titleEl = document.querySelector('.card-header.row h4').childNodes; const titleEl = document.querySelector('.card-header.row h4').childNodes;
const titleString = extractTextNode(titleEl); const titleString = extractTextNode(titleEl);
if (!shallowRelease) [release.entryId] = url.match(/\d+/); if (!baseRelease) [release.entryId] = url.match(/\d+/);
release.title = titleString release.title = titleString
.replace('Trailer: ', '') .replace('Trailer: ', '')
@ -107,9 +107,11 @@ function scrapeScene(html, url, site, shallowRelease) {
quality: resolutions[index], quality: resolutions[index],
})); }));
release.photos = [document.body.innerHTML const posterPrefix = html.indexOf('poster:');
.match(/poster: .*\.jpg/)[0] const poster = html.slice(html.indexOf('http', posterPrefix), html.indexOf('.jpg', posterPrefix) + 4);
.match(/https:\/\/.*\.jpg/)[0]];
if (baseRelease?.poster) release.photos = [poster];
else release.poster = poster;
return release; return release;
} }
@ -154,7 +156,7 @@ async function fetchLatest(site, page = 1) {
return null; return null;
} }
async function fetchScene(url, site, shallowRelease) { async function fetchScene(url, site, baseRelease) {
const { pathname } = new URL(url); const { pathname } = new URL(url);
const res = await bhttp.get(`https://www.kellymadison.com${pathname}`, { const res = await bhttp.get(`https://www.kellymadison.com${pathname}`, {
@ -163,7 +165,7 @@ async function fetchScene(url, site, shallowRelease) {
}, },
}); });
return scrapeScene(res.body.toString(), url, site, shallowRelease); return scrapeScene(res.body.toString(), url, site, baseRelease);
} }
async function fetchProfile(actorName) { async function fetchProfile(actorName) {