Blowpass now uses Gamma module for latest and upcoming.

This commit is contained in:
2020-02-07 01:06:39 +01:00
parent 8a139e1ac0
commit 631ac34573
4 changed files with 52 additions and 53 deletions

View File

@@ -78,48 +78,36 @@ function scrapeUpcoming(html, site) {
}
*/
function scrapeScene(html, url, site) {
const $ = cheerio.load(html, { normalizeWhitespace: true });
const sceneElement = $('.playerSection');
function scrapeScene(html, url, _site) {
const { q, qa, qu, qi, qt } = ex(html, '.playerSection');
const release = {};
const shootId = sceneElement.find('.vdoCast:contains("Release")').text().replace('Release: ', '');
const entryId = url.split('/')[3].slice(5);
const title = sceneElement.find('.ps-vdoHdd h1').text();
const description = sceneElement.find('.vdoDesc').text().trim();
[release.shootId] = q('.vdoTags + .vdoCast', true).match(/\w+$/);
[release.entryId] = url.split('/')[3].match(/\d+$/);
release.title = q('.ps-vdoHdd h1', true);
release.description = q('.vdoDesc', true);
const [siteName, ...actors] = sceneElement.find('.vdoCast a').map((actorIndex, actorElement) => $(actorElement).text()).toArray();
const siteSlug = siteName.replace(/[\s']+/g, '').toLowerCase();
release.actors = qa('a[href*="/model"]', true);
release.tags = qa('.vdoTags a', true);
const poster = `https:${$('img#player-overlay-image').attr('src')}`;
const trailer = `https:${$('source[type="video/mp4"]').attr('src')}`;
release.stars = Number(q('div[class*="like"]', true).match(/^\d+/)[0]) / 20;
const firstPhotoUrl = `https:${$('img[data-slider-index="1"]').attr('src')}`;
// all scenes seem to have 12 album photos available, not always included on the page
const photos = Array.from({ length: 12 }, (val, index) => firstPhotoUrl.replace(/big\d+/, `big${index + 1}`));
const tags = $('.vdoTags a').map((tagIndex, tagElement) => $(tagElement).text()).toArray();
const stars = Number(sceneElement.find('.bVdPl_it_like .bVdPl_txt').text().replace('% like', '')) / 20;
return {
url,
shootId,
entryId,
title,
description,
actors,
tags,
const poster = qi('img#player-overlay-image');
release.poster = [
poster,
photos,
trailer: {
src: trailer,
},
rating: {
stars,
},
site,
channel: siteSlug === 'bangcasting' ? 'bangbroscasting' : siteSlug,
};
poster.replace('/big_trailer', '/members/450x340'), // load error fallback
];
release.trailer = { src: qt() };
// all scenes seem to have 12 album photos available, not always included on the page
const firstPhotoUrl = ex(html).qi('img[data-slider-index="1"]');
release.photos = Array.from({ length: 12 }, (val, index) => firstPhotoUrl.replace(/big\d+/, `big${index + 1}`));
const [channel] = qu('a[href*="/websites"]').match(/\w+$/);
release.channel = channel === 'bangcasting' ? 'bangbroscasting' : channel;
return release;
}
function scrapeProfile(html) {