Updatead AnalVids studios.
This commit is contained in:
@@ -5,6 +5,10 @@ const bhttp = require('bhttp');
|
||||
const slugify = require('../utils/slugify');
|
||||
const { studios: oldStudios } = require('../../seeds/03_studios');
|
||||
|
||||
const slugMap = {
|
||||
thay_ksada: 'thayksada2',
|
||||
};
|
||||
|
||||
async function init() {
|
||||
const res = await bhttp.get('https://pornbox.com/studio/list');
|
||||
|
||||
@@ -21,6 +25,7 @@ async function init() {
|
||||
const newStudio = {
|
||||
name: studio.name,
|
||||
slug,
|
||||
originalSlug: slugify(studio.alias, ''),
|
||||
url: `https://www.analvids.com/studios/${studio.alias}`,
|
||||
parent: 'analvids',
|
||||
};
|
||||
@@ -55,14 +60,21 @@ async function init() {
|
||||
await fs.writeFile('./analvids-studios.json', JSON.stringify(newStudios, null, 4));
|
||||
|
||||
newStudios.reduce((acc, studio) => {
|
||||
if (acc.has(studio.slug)) {
|
||||
console.log('slug already exists!', studio, studio.slug);
|
||||
const existingStudio = acc.get(studio.slug);
|
||||
|
||||
if (existingStudio) {
|
||||
if (!acc.has(studio.originalSlug)) {
|
||||
console.log('REWRITE', studio.slug, studio.originalSlug);
|
||||
studio.slug = studio.originalSlug; // eslint-disable-line
|
||||
}
|
||||
|
||||
console.log('slug already exists!', existingStudio, studio, studio.originalSlug, studio.slug);
|
||||
}
|
||||
|
||||
acc.add(studio.slug);
|
||||
acc.set(studio.slug, studio);
|
||||
|
||||
return acc;
|
||||
}, new Set());
|
||||
}, new Map());
|
||||
|
||||
// console.log(newStudios);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user