forked from DebaucheryLibrarian/traxxx
Allowing scrapers to return multiple trailer qualities, implemented for Brazzers. Removed tag and site matching from Brazzers scraper.
This commit is contained in:
@@ -7,8 +7,6 @@ const { JSDOM } = require('jsdom');
|
||||
const moment = require('moment');
|
||||
|
||||
const { heightToCm, lbsToKg } = require('../utils/convert');
|
||||
const { fetchSites } = require('../sites');
|
||||
const { matchTags } = require('../tags');
|
||||
|
||||
const hairMap = {
|
||||
Blonde: 'blonde',
|
||||
@@ -82,26 +80,19 @@ async function scrapeScene(html, url, site) {
|
||||
const dislikes = Number($('.label-rating .dislike').text());
|
||||
|
||||
const siteElement = $('.niche-site-logo');
|
||||
const siteUrl = `https://www.brazzers.com${siteElement.attr('href').slice(0, -1)}`;
|
||||
// const siteUrl = `https://www.brazzers.com${siteElement.attr('href').slice(0, -1)}`;
|
||||
const siteName = siteElement.attr('title');
|
||||
const siteSlug = siteName.replace(/\s+/g, '').toLowerCase();
|
||||
const channel = siteName.replace(/\s+/g, '').toLowerCase();
|
||||
|
||||
const rawTags = $('.tag-card-container a').map((tagIndex, tagElement) => $(tagElement).text()).toArray();
|
||||
const tags = $('.tag-card-container a').map((tagIndex, tagElement) => $(tagElement).text()).toArray();
|
||||
|
||||
const poster = `https:${videoData.poster}`;
|
||||
const trailer = `https:${videoData.stream_info.http.paths.mp4_480_1500}`;
|
||||
const photos = $('.carousel-thumb a').map((photoIndex, photoElement) => `https:${$(photoElement).attr('href')}`).toArray();
|
||||
|
||||
const [tags, [channelSite]] = await Promise.all([
|
||||
matchTags(rawTags),
|
||||
site.isFallback
|
||||
? fetchSites({
|
||||
slug: siteSlug,
|
||||
name: siteName,
|
||||
url: siteUrl,
|
||||
})
|
||||
: [site],
|
||||
]);
|
||||
const trailer = Object.entries(videoData.stream_info.http.paths).map(([quality, path]) => ({
|
||||
src: `https:${path}`,
|
||||
quality: Number(quality.match(/\d{3,}/)[0]),
|
||||
}));
|
||||
|
||||
return {
|
||||
url,
|
||||
@@ -112,17 +103,15 @@ async function scrapeScene(html, url, site) {
|
||||
date,
|
||||
poster,
|
||||
photos,
|
||||
trailer: {
|
||||
src: trailer,
|
||||
quality: 480,
|
||||
},
|
||||
trailer,
|
||||
duration,
|
||||
rating: {
|
||||
likes,
|
||||
dislikes,
|
||||
},
|
||||
tags,
|
||||
site: channelSite || site,
|
||||
site,
|
||||
channel,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user