Improved Vixen and XEmpire scrapers. Added media to Blowpass scraper. Improved release fetch code.
This commit is contained in:
@@ -21,6 +21,9 @@ function scrape(html, site) {
|
||||
const date = moment.utc($(element).find('.sceneDate').text(), 'MM-DD-YYYY').toDate();
|
||||
const actors = $(element).find('.sceneActors a').map((actorIndex, actorElement) => $(actorElement).text()).toArray();
|
||||
|
||||
const poster = $(element).find('a.imgLink img.img').attr('data-original');
|
||||
const trailer = `https://videothumb.gammacdn.com/600x339/${entryId}.mp4`;
|
||||
|
||||
const likes = Number($(element).find('.rating .state_1 .value').text());
|
||||
|
||||
return {
|
||||
@@ -29,6 +32,11 @@ function scrape(html, site) {
|
||||
title,
|
||||
actors,
|
||||
date,
|
||||
poster,
|
||||
trailer: {
|
||||
src: trailer,
|
||||
quality: 339,
|
||||
},
|
||||
rating: {
|
||||
likes,
|
||||
},
|
||||
@@ -43,26 +51,26 @@ async function scrapeScene(html, url, site) {
|
||||
const data = JSON.parse(json).slice(-1)[0];
|
||||
const sceneElement = $('#wrapper');
|
||||
|
||||
const videoScript = $('script:contains("window.ScenePlayerOptions")').html();
|
||||
const playerObject = videoScript.slice(videoScript.indexOf('{'), videoScript.indexOf('};') + 1);
|
||||
const playerData = JSON.parse(playerObject);
|
||||
|
||||
const workName = data.isPartOf.name.split(' - ');
|
||||
const shootId = workName.length > 1 ? workName[0] : null;
|
||||
const shootId = workName.length > 1 ? workName[1] : null;
|
||||
const entryId = url.split('/').slice(-1)[0];
|
||||
const title = data.isPartOf ? data.isPartOf.name : data.name;
|
||||
const { description } = data;
|
||||
const date = moment.utc(data.isPartOf.datePublished, 'YYYY-MM-DD').toDate();
|
||||
const title = data.title || $('meta[name="twitter:title"]').attr('content');
|
||||
const description = data.description || $('meta[name="twitter:description"]').attr('content');
|
||||
// date in data object is not the release date of the scene, but the date the entry was added
|
||||
const date = moment.utc($('.updatedDate').first().text(), 'MM-DD-YYYY').toDate();
|
||||
|
||||
// const actors = sceneElement.find('.sceneActors a').map((actorIndex, actorElement) => $(actorElement).text().trim()).toArray();
|
||||
const actors = data.actor
|
||||
.sort(({ gender: genderA }, { gender: genderB }) => {
|
||||
if (genderA === 'female' && genderB === 'male') return -1;
|
||||
if (genderA === 'male' && genderB === 'female') return 1;
|
||||
|
||||
return 0;
|
||||
})
|
||||
.map(actor => actor.name);
|
||||
const actors = data.actor.map(({ name }) => name);
|
||||
|
||||
const likes = Number(sceneElement.find('.rating .state_1 .value').text());
|
||||
const dislikes = Number(sceneElement.find('.rating .state_2 .value').text());
|
||||
|
||||
const poster = playerData.picPreview;
|
||||
const trailer = `${playerData.playerOptions.host}${playerData.url}`;
|
||||
|
||||
const duration = moment.duration(data.duration.slice(2)).asSeconds();
|
||||
|
||||
const rawTags = data.keywords.split(', ');
|
||||
@@ -77,6 +85,11 @@ async function scrapeScene(html, url, site) {
|
||||
actors,
|
||||
date,
|
||||
duration,
|
||||
poster,
|
||||
trailer: {
|
||||
src: trailer,
|
||||
quality: playerData.sizeOnLoad.slice(0, -1),
|
||||
},
|
||||
tags,
|
||||
rating: {
|
||||
likes,
|
||||
@@ -87,13 +100,13 @@ async function scrapeScene(html, url, site) {
|
||||
}
|
||||
|
||||
async function fetchLatest(site, page = 1) {
|
||||
const res = await bhttp.get(`https://www.blowpass.com/en/videos/${site.id}/latest/All-Categories/0/All-Pornstars/0/${page}`);
|
||||
const res = await bhttp.get(`https://www.blowpass.com/en/videos/${site.slug}/latest/All-Categories/0/All-Pornstars/0/${page}`);
|
||||
|
||||
return scrape(res.body.toString(), site);
|
||||
}
|
||||
|
||||
async function fetchUpcoming(site) {
|
||||
const res = await bhttp.get(`https://www.blowpass.com/en/videos/${site.id}/upcoming`);
|
||||
const res = await bhttp.get(`https://www.blowpass.com/en/videos/${site.slug}/upcoming`);
|
||||
|
||||
return scrape(res.body.toString(), site);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user