forked from DebaucheryLibrarian/traxxx
				
			Added children to deep release entity, removed database dependency from Perfect Gonzo scraper.
This commit is contained in:
		
							parent
							
								
									ab83dd2e55
								
							
						
					
					
						commit
						6364912aa8
					
				|  | @ -199,7 +199,11 @@ async function fetchReleaseEntities(baseReleases) { | |||
| 			FROM entity_tree | ||||
| 			JOIN entities ON entity_tree.parent_id = entities.id | ||||
| 		) | ||||
| 		SELECT entity FROM entity_tree WHERE parent_id is null | ||||
| 		SELECT jsonb_set(entity, '{children}', to_jsonb(COALESCE(json_agg(children) FILTER (WHERE children.id IS NOT NULL), '[]'))) entity | ||||
| 		FROM entity_tree | ||||
| 		LEFT JOIN entities AS children ON children.parent_id = (entity->>'id')::int | ||||
| 		WHERE entity_tree.parent_id IS NULL | ||||
| 		GROUP BY entity_tree.entity | ||||
| 		ORDER BY entity->'type' ASC; | ||||
| 	`, { entitySlugs });
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -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) { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue