forked from DebaucheryLibrarian/traxxx
Blowpass now uses Gamma module for latest and upcoming.
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
const bhttp = require('bhttp');
|
||||
|
||||
const { scrapeAll, scrapeScene, fetchProfile } = require('./gamma');
|
||||
const { fetchLatest, fetchUpcoming, scrapeScene, fetchProfile } = require('./gamma');
|
||||
|
||||
async function fetchScene(url, site) {
|
||||
// const res = await bhttp.get(url);
|
||||
@@ -21,18 +21,6 @@ async function fetchScene(url, site) {
|
||||
return release;
|
||||
}
|
||||
|
||||
async function fetchLatest(site, page = 1) {
|
||||
const res = await bhttp.get(`https://www.blowpass.com/en/videos/${site.slug}/latest/All-Categories/0/All-Pornstars/0/${page}`);
|
||||
|
||||
return scrapeAll(res.body.toString(), site);
|
||||
}
|
||||
|
||||
async function fetchUpcoming(site) {
|
||||
const res = await bhttp.get(`https://www.blowpass.com/en/videos/${site.slug}/upcoming`);
|
||||
|
||||
return scrapeAll(res.body.toString(), site);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
fetchLatest,
|
||||
fetchProfile,
|
||||
|
||||
@@ -365,11 +365,14 @@ async function fetchLatest(site, page = 1) {
|
||||
const url = `${site.url}${site.parameters?.latest || '/en/videos/AllCategories/0/'}${page}`;
|
||||
const res = await bhttp.get(url);
|
||||
|
||||
console.log(url);
|
||||
|
||||
return scrapeAll(res.body.toString(), site);
|
||||
}
|
||||
|
||||
async function fetchUpcoming(site) {
|
||||
const res = await bhttp.get(`${site.url}${site.parameters?.upcoming || '/en/videos/AllCategories/0/1/upcoming'}`);
|
||||
const url = `${site.url}${site.parameters?.upcoming || '/en/videos/AllCategories/0/1/upcoming'}`;
|
||||
const res = await bhttp.get(url);
|
||||
|
||||
return scrapeAll(res.body.toString(), site);
|
||||
}
|
||||
@@ -450,10 +453,10 @@ async function fetchApiProfile(actorName, siteSlug) {
|
||||
});
|
||||
|
||||
if (res.statusCode === 200 && res.body.results[0].hits.length > 0) {
|
||||
const actorData = res.body.results[0].hits.find(actor => actor.name === actorName);
|
||||
const actorData = res.body.results[0].hits.find(actor => slugify(actor.name) === slugify(actorName));
|
||||
|
||||
if (actorData) {
|
||||
const actorScenes = await fetchActorScenes(actorName, apiUrl, siteSlug);
|
||||
const actorScenes = await fetchActorScenes(actorData.name, apiUrl, siteSlug);
|
||||
|
||||
return scrapeApiProfile(actorData, actorScenes, siteSlug);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user