Added channel map to Naughty America.

This commit is contained in:
DebaucheryLibrarian
2026-01-24 01:30:17 +01:00
parent fe0d450af0
commit e7b9147995
2 changed files with 43 additions and 2 deletions

View File

@@ -0,0 +1,26 @@
'use strict';
const knex = require('../knex');
const slugify = require('../utils/slugify');
async function init() {
const channels = await knex('entities')
.select('entities.*')
.leftJoin('entities as parents', 'parents.id', 'entities.parent_id')
.where('parents.slug', 'in', ['naughtyamerica', 'naughtyamericavr']);
const mapped = Object.fromEntries(channels.map((channel) => {
const path = new URL(channel.url).pathname.match(/\/site\/(.*)/)?.[1];
const urlSlug = slugify(path, '');
if (!urlSlug || urlSlug === channel.slug) {
return null;
}
return [urlSlug, channel.slug];
}).filter(Boolean));
console.log(mapped);
}
init();