Fixed upcoming Jules Jordan scene without teaser breaking scraper.

This commit is contained in:
DebaucheryLibrarian 2020-09-11 02:36:36 +02:00
parent 9499cd0265
commit eb6337f6fb
1 changed files with 12 additions and 19 deletions

View File

@ -186,48 +186,41 @@ function scrapeUpcoming(html, site) {
const scenesElements = $('#coming_soon_carousel').find('.table').toArray(); const scenesElements = $('#coming_soon_carousel').find('.table').toArray();
return scenesElements.map((element) => { return scenesElements.map((element) => {
const entryId = $(element).find('.upcoming_updates_thumb').attr('id').match(/\d+/)[0]; const release = {};
release.entryId = $(element).find('.upcoming_updates_thumb').attr('id').match(/\d+/)[0];
const details = $(element).find('.update_details_comingsoon') const details = $(element).find('.update_details_comingsoon')
.eq(1) .eq(1)
.children() .children()
.remove(); .remove();
const title = details release.title = details
.end() .end()
.text() .text()
.trim(); .trim();
const actors = details release.actors = details
.text() .text()
.trim() .trim()
.split(', '); .split(', ');
const date = moment release.date = moment
.utc($(element).find('.update_date_comingsoon').text().slice(7), 'MM/DD/YYYY') .utc($(element).find('.update_date_comingsoon').text().slice(7), 'MM/DD/YYYY')
.toDate(); .toDate();
const photoElement = $(element).find('a img.thumbs'); const photoElement = $(element).find('a img.thumbs');
const posterPath = photoElement.attr('src'); const posterPath = photoElement.attr('src');
const poster = posterPath.match(/^http/) ? posterPath : `${site.url}${posterPath}`; release.poster = posterPath.match(/^http/) ? posterPath : `${site.url}${posterPath}`;
const videoClass = $(element).find('.update_thumbnail div').attr('class'); const videoClass = $(element).find('.update_thumbnail div').attr('class');
const videoScript = $(element).find(`script:contains(${videoClass})`).html(); const videoScript = $(element).find(`script:contains(${videoClass})`).html();
const teaser = videoScript.slice(videoScript.indexOf('https://'), videoScript.indexOf('.mp4') + 4);
return { if (videoScript) {
url: null, release.teaser = videoScript.slice(videoScript.indexOf('https://'), videoScript.indexOf('.mp4') + 4);
entryId, }
title,
date, return release;
actors,
poster,
teaser: {
src: teaser,
},
rating: null,
site,
};
}); });
} }