Added children to deep release entity, removed database dependency from Perfect Gonzo scraper.

This commit is contained in:
DebaucheryLibrarian
2021-02-02 01:51:22 +01:00
parent ab83dd2e55
commit 6364912aa8
2 changed files with 6 additions and 12 deletions

View File

@@ -1,17 +1,9 @@
'use strict';
const blake2 = require('blake2');
const knex = require('../knex');
const qu = require('../utils/qu');
async function getSiteSlugs() {
return knex('entities')
.pluck('entities.slug')
.join('entities AS parents', 'parents.id', 'entities.parent_id')
.where('parents.slug', 'perfectgonzo');
}
function getHash(identifier) {
const hash = blake2.createHash('blake2b', { digestLength: 8 });
@@ -39,9 +31,7 @@ function extractMaleModelsFromTags(tagContainer) {
}
async function extractChannelFromPhoto(photo, channel) {
const siteSlugs = (channel.type === 'network' ? channel.children : channel.parent?.children)?.map(child => child.slug)
|| await getSiteSlugs();
const siteSlugs = (channel.type === 'network' ? channel.children : channel.parent?.children)?.map(child => child.slug);
const channelMatch = photo.match(new RegExp(siteSlugs.join('|')));
if (channelMatch) {