Added PurgatoryX scraper.

This commit is contained in:
DebaucheryLibrarian
2021-11-27 23:55:16 +01:00
parent 2539e88f47
commit 9d7183ac69
32 changed files with 196 additions and 16 deletions

View File

@@ -52,6 +52,12 @@ const parentNetworks = [
},
parent: 'gamma',
},
{
slug: 'radical',
alias: ['kb productions'],
name: 'Radical Entertainment',
url: 'https://radicalcash.com',
},
];
const networks = [
@@ -550,6 +556,7 @@ const networks = [
slug: 'topwebmodels',
name: 'Top Web Models',
url: 'https://tour.topwebmodels.com',
parent: 'radical',
parameters: {
apiKey: '5b637cd8c4bc59cd13686f1c38dcb780',
},
@@ -624,12 +631,12 @@ const networks = [
},
];
exports.seed = knex => Promise.resolve()
exports.seed = (knex) => Promise.resolve()
.then(async () => {
const grandParentNetworkEntries = await upsert('entities', grandParentNetworks.map(network => ({ ...network, type: 'network' })), ['slug', 'type'], knex);
const grandParentNetworkEntries = await upsert('entities', grandParentNetworks.map((network) => ({ ...network, type: 'network' })), ['slug', 'type'], knex);
const grandParentNetworksBySlug = [].concat(grandParentNetworkEntries.inserted, grandParentNetworkEntries.updated).reduce((acc, network) => ({ ...acc, [network.slug]: network.id }), {});
const parentNetworksWithGrandParent = parentNetworks.map(network => ({
const parentNetworksWithGrandParent = parentNetworks.map((network) => ({
slug: network.slug,
name: network.name,
type: network.type || 'network',
@@ -643,7 +650,7 @@ exports.seed = knex => Promise.resolve()
const parentNetworkEntries = await upsert('entities', parentNetworksWithGrandParent, ['slug', 'type'], knex);
const parentNetworksBySlug = [].concat(parentNetworkEntries.inserted, parentNetworkEntries.updated).reduce((acc, network) => ({ ...acc, [network.slug]: network.id }), {});
const networksWithParent = networks.map(network => ({
const networksWithParent = networks.map((network) => ({
slug: network.slug,
name: network.name,
type: network.type || 'network',
@@ -665,14 +672,14 @@ exports.seed = knex => Promise.resolve()
networkEntries.updated,
).reduce((acc, network) => ({ ...acc, [network.slug]: network.id }), {});
const tagSlugs = networks.map(network => network.tags).flat().filter(Boolean);
const tagSlugs = networks.map((network) => network.tags).flat().filter(Boolean);
const tagEntries = await knex('tags').whereIn('slug', tagSlugs);
const tagIdsBySlug = tagEntries.reduce((acc, tag) => ({ ...acc, [tag.slug]: tag.id }), {});
const tagAssociations = networks
.map(network => (network.tags
? network.tags.map(tagSlug => ({
.map((network) => (network.tags
? network.tags.map((tagSlug) => ({
entity_id: networkIdsBySlug[network.slug],
tag_id: tagIdsBySlug[tagSlug],
inherit: true,

View File

@@ -7235,6 +7235,14 @@ const sites = [
parent: 'puretaboo',
},
*/
// RADICAL ENTERTAINMENT
{
name: 'PurgatoryX',
slug: 'purgatoryx',
url: 'https://tour.purgatoryx.com',
independent: true,
parent: 'radical',
},
// REALITY KINGS
{
name: 'Look At Her Now',
@@ -10706,7 +10714,7 @@ const sites = [
];
/* eslint-disable max-len */
exports.seed = knex => Promise.resolve()
exports.seed = (knex) => Promise.resolve()
.then(async () => {
const networks = await knex('entities')
.where('type', 'network')
@@ -10717,7 +10725,7 @@ exports.seed = knex => Promise.resolve()
const tags = await knex('tags').select('*').whereNull('alias_for');
const tagsMap = tags.reduce((acc, { id, slug }) => ({ ...acc, [slug]: id }), {});
const sitesWithNetworks = sites.map(site => ({
const sitesWithNetworks = sites.map((site) => ({
slug: site.slug,
name: site.name,
type: site.type || 'channel',
@@ -10735,8 +10743,8 @@ exports.seed = knex => Promise.resolve()
const { inserted, updated } = await upsert('entities', sitesWithNetworks, ['slug', 'type'], knex);
const sitesMap = [].concat(inserted, updated).reduce((acc, { id, slug }) => ({ ...acc, [slug]: id }), {});
const tagAssociations = sites.map(site => (site.tags
? site.tags.map(tagSlug => ({
const tagAssociations = sites.map((site) => (site.tags
? site.tags.map((tagSlug) => ({
entity_id: sitesMap[site.slug],
tag_id: tagsMap[tagSlug],
inherit: true,