Compare commits

..

No commits in common. "67c1e6c556a5040b98209d7570836141b4beab07" and "0b84c977daf8a71b9d1718f3735916afac3fb9ed" have entirely different histories.

7 changed files with 27 additions and 11 deletions

View File

@ -134,7 +134,7 @@
<ul class="tags nolist">
<li
v-for="tag in release.tags"
:key="`tag-${tag.slug}`"
:key="`tag-${tag.id}`"
class="tag"
>
<a

View File

@ -111,7 +111,7 @@
>
<li
v-for="tag in release.tags"
:key="`tag-${tag.slug}`"
:key="`tag-${tag.id}`"
class="tag"
>
<router-link

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "traxxx",
"version": "1.58.2",
"version": "1.58.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "traxxx",
"version": "1.58.2",
"version": "1.58.1",
"description": "All the latest porn releases in one place",
"main": "src/app.js",
"scripts": {

View File

@ -6,6 +6,9 @@ const bhttp = require('bhttp');
const { JSDOM } = require('jsdom');
const moment = require('moment');
const knex = require('../knex');
const { matchTags } = require('../tags');
async function getPhoto(url) {
const res = await bhttp.get(url);
const html = res.body.toString();
@ -89,7 +92,7 @@ async function scrapeScene(html, url, site) {
.replace('...read more', '')
.trim();
const channel = document.querySelector('.site-name').textContent.split('.')[0].toLowerCase();
const siteSlug = document.querySelector('.site-name').textContent.split('.')[0].toLowerCase();
const date = new Date(document.querySelector('meta[itemprop="uploadDate"]').content);
const duration = moment
.duration(`00:${document
@ -107,7 +110,17 @@ async function scrapeScene(html, url, site) {
const photos = await getPhotos(`${origin}${pathname}${lastPhotosUrl}`, site, url);
const stars = Math.floor(Number(document.querySelector('span[itemprop="average"]').textContent) / 2);
const tags = Array.from(document.querySelectorAll('.scene-details .categories a')).map(({ textContent }) => textContent);
const rawTags = Array.from(document.querySelectorAll('.scene-details .categories a')).map(({ textContent }) => textContent);
const [channelSite, tags] = await Promise.all([
site.isFallback
? knex('sites')
.where({ slug: siteSlug })
.orWhere({ url: `https://${siteSlug}.com` })
.first()
: site,
matchTags(rawTags),
]);
return {
url: `${origin}${pathname}`,
@ -125,8 +138,7 @@ async function scrapeScene(html, url, site) {
rating: {
stars,
},
site,
channel,
site: channelSite || site,
};
}

View File

@ -120,14 +120,17 @@ async function fetchSitesFromArgv() {
async function fetchSitesFromConfig() {
const included = destructConfigNetworks(config.include);
const networks = await knex('networks').select('id').whereIn('slug', included.networks || []);
const networkIds = networks.map(network => network.id);
const rawSites = await knex('sites')
.select(
'sites.*',
'networks.name as network_name', 'networks.slug as network_slug', 'networks.url as network_url', 'networks.description as network_description', 'networks.parameters as network_parameters',
)
.leftJoin('networks', 'sites.network_id', 'networks.id')
.whereIn('sites.slug', included.sites || [])
.orWhereIn('networks.slug', included.networks || []);
.orWhereIn('network_id', networkIds)
.leftJoin('networks', 'sites.network_id', 'networks.id');
const curatedSites = await curateSites(rawSites, true);
logger.info(`Found ${curatedSites.length} sites in database`);

View File

@ -42,6 +42,7 @@ async function matchTags(rawTags) {
const tagEntries = await knex('tags')
.pluck('aliases.id')
.whereIn('tags.name', tags)
.orWhereIn('tags.slug', tags)
.leftJoin('tags as aliases', function join() {
this
.on('tags.alias_for', 'aliases.id')
@ -65,7 +66,7 @@ async function associateTags(release, releaseId) {
? await matchTags(release.tags) // scraper returned raw tags
: rawReleaseTags; // tags already matched by (outdated) scraper
const tags = Array.from(new Set(releaseTags.concat(siteTags)));
const tags = releaseTags.concat(siteTags);
if (tags.length === 0) {
logger.info(`No tags available for (${release.site.name}, ${releaseId}) "${release.title}"`);