Merge branch 'master' into wasabi
This commit is contained in:
10
src/media.js
10
src/media.js
@@ -605,7 +605,12 @@ async function trySource(baseSource, existingMedias, baseMedia) {
|
||||
};
|
||||
}
|
||||
|
||||
return fetchSource(extractedSource, baseMedia);
|
||||
const source = await fetchSource(extractedSource, baseMedia);
|
||||
|
||||
return {
|
||||
...source,
|
||||
entry: extractedSource.entry || existingSourceMedia,
|
||||
};
|
||||
}
|
||||
|
||||
async function fetchMedia(baseMedia, existingMedias) {
|
||||
@@ -698,9 +703,6 @@ async function storeMedias(baseMedias, options) {
|
||||
const newMediaEntries = newMediaWithEntries.filter(media => media.newEntry).map(media => media.entry);
|
||||
|
||||
try {
|
||||
// TODO: path duplicates disappear in DO NOTHING query, causing association error. source duplicate detection not working? use scene generator
|
||||
// UPDATE: cannot replicate when using the same poster and photo source in scene generator
|
||||
// await bulkInsert('media', newMediaEntries, false);
|
||||
await bulkInsert('media', newMediaEntries);
|
||||
|
||||
return [...newMediaWithEntries, ...existingHashMedias];
|
||||
|
||||
@@ -4,10 +4,10 @@ const { get, geta, ctxa } = require('../utils/q');
|
||||
|
||||
function extractActors(actorString) {
|
||||
return actorString
|
||||
?.replace(/.*:|\(.*\)|\d+(-|\s)year(-|\s)old|nurses?|tangled/ig, '') // remove Patient:, (date) and other nonsense
|
||||
.split(/\band\b|\bvs\b|\/|,|&/ig)
|
||||
.map(actor => actor.trim())
|
||||
.filter(actor => !!actor && !/\banal\b|\bschool\b|\bgamer\b|\breturn\b|\bfor\b|\bare\b|\bpart\b|realdoll|bimbo|p\d+/ig.test(actor))
|
||||
?.replace(/.*:|\(.*\)|\d+(-|\s)year(-|\s)old|nurses?|tangled/ig, '') // remove Patient:, (date) and other nonsense
|
||||
.split(/\band\b|\bvs\b|\/|,|&/ig)
|
||||
.map(actor => actor.trim())
|
||||
.filter(actor => !!actor && !/\banal\b|\bschool\b|\bgamer\b|\breturn\b|\bfor\b|\bare\b|\bpart\b|realdoll|bimbo|p\d+/ig.test(actor))
|
||||
|| [];
|
||||
}
|
||||
|
||||
|
||||
@@ -28,8 +28,8 @@ function scrapeProfile(html) {
|
||||
if (bio.Measurements) {
|
||||
const measurements = bio.Measurements
|
||||
.match(/\d+(\w+)?-\d+-\d+/g)
|
||||
?.slice(-1)[0] // allow for both '34C-25-36' and '86-64-94 cm / 34-25-37 in'
|
||||
.split('-');
|
||||
?.slice(-1)[0] // allow for both '34C-25-36' and '86-64-94 cm / 34-25-37 in'
|
||||
.split('-');
|
||||
|
||||
// account for measuemrents being just e.g. '32EE'
|
||||
if (measurements) {
|
||||
|
||||
@@ -77,7 +77,7 @@ async function fetchClassicProfile(actorName, { site }) {
|
||||
|
||||
const actorPath = pornstarsRes.item.qa('option[value*="/pornstar"]')
|
||||
.find(el => slugify(el.textContent) === actorSlug)
|
||||
?.value;
|
||||
?.value;
|
||||
|
||||
if (actorPath) {
|
||||
const actorUrl = `${site.url}${actorPath}`;
|
||||
|
||||
@@ -200,6 +200,8 @@ function scrapeAll(html, site, networkUrl, hasTeaser = true) {
|
||||
];
|
||||
}
|
||||
|
||||
console.log(release);
|
||||
|
||||
return release;
|
||||
});
|
||||
}
|
||||
@@ -252,7 +254,10 @@ async function scrapeScene(html, url, site, baseRelease, mobileHtml, options) {
|
||||
|
||||
const channel = data?.productionCompany?.name
|
||||
|| $('.studioLink a, .siteLink a').attr('title')?.trim()
|
||||
|| $('.siteNameSpan').text()?.trim().toLowerCase().replace('.com', '')
|
||||
|| $('.siteNameSpan').text()
|
||||
?.trim()
|
||||
.toLowerCase()
|
||||
.replace('.com', '')
|
||||
|| $('meta[name="twitter:domain"]').attr('content')?.replace('.com', '');
|
||||
|
||||
if (channel) release.channel = slugify(channel, '');
|
||||
|
||||
@@ -305,8 +305,8 @@ function scrapeMovie({ el, query }, url, site) {
|
||||
const scenes = scrapeAll(sceneQus, site);
|
||||
|
||||
const curatedScenes = scenes
|
||||
?.map(scene => ({ ...scene, movie }))
|
||||
.sort((sceneA, sceneB) => sceneA.date - sceneB.date);
|
||||
?.map(scene => ({ ...scene, movie }))
|
||||
.sort((sceneA, sceneB) => sceneA.date - sceneB.date);
|
||||
|
||||
movie.date = curatedScenes?.[0].date;
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ async function scrapeScene({ query }, url, site) {
|
||||
release.title = query.q('.content-pane-title h2', true);
|
||||
release.description = query.q('.content-pane-column div', true);
|
||||
|
||||
release.date = query.q('.date', 'MMM D, YYYY');
|
||||
release.date = query.date('.date', 'MMM D, YYYY');
|
||||
|
||||
release.actors = query.all('.content-pane-performers .model', true);
|
||||
release.tags = query.all('.categories a', true);
|
||||
@@ -134,12 +134,6 @@ async function fetchUpcoming(site) {
|
||||
return [];
|
||||
}
|
||||
|
||||
async function fetchScene(url, site) {
|
||||
const res = await qu.get(url);
|
||||
|
||||
return res.ok ? scrapeScene(res.item, url, site) : res.status;
|
||||
}
|
||||
|
||||
async function fetchProfile({ name: actorName }, { site }) {
|
||||
const firstLetter = actorName.charAt(0).toLowerCase();
|
||||
const origin = slugUrlMap[site.slug] || site.url;
|
||||
@@ -164,6 +158,6 @@ async function fetchProfile({ name: actorName }, { site }) {
|
||||
module.exports = {
|
||||
fetchLatest,
|
||||
fetchUpcoming,
|
||||
fetchScene,
|
||||
fetchProfile,
|
||||
scrapeScene,
|
||||
};
|
||||
|
||||
@@ -251,6 +251,8 @@ async function fetchLatest(entity, page, options) {
|
||||
.orderByRaw('random()')
|
||||
.limit(Math.floor(Math.random() * 10) + 1);
|
||||
|
||||
// const poster = 'sfw/kittens/thumbs/iNEXVlX-RLs.jpeg';
|
||||
|
||||
release.poster = `http://${config.web.host}:${config.web.port}/img/${poster}?id=${nanoid()}`; // ensure source is unique
|
||||
release.photos = photos.map(photo => `http://${config.web.host}:${config.web.port}/img/${photo}?id=${nanoid()}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user