Showing number of newly added creators in ManyVids seed.

This commit is contained in:
DebaucheryLibrarian
2026-07-09 00:34:16 +02:00
parent a68c8539fd
commit 56b18618be

View File

@@ -7,7 +7,7 @@ const limit = Number(process.env.MV_LIMIT) || 1000;
const sorting = process.env.MV_SORT || 'followers'; // followers, top, mostActive, newest, trending
async function fetchCreators(page = 1, acc = []) {
console.log(`Fetching creators ${acc.length}/${limit}`);
console.log(`Fetching ${acc.length}/${limit} creators by ${sorting}`);
// size seems to be capped at 70
const res = await unprint.get(`https://api.manyvids.com/search/creators/list?contentPref=1,2,3&sort=${sorting}&size=50&from=${(page - 1) * 50}`);
@@ -42,7 +42,7 @@ exports.seed = async function (knex) {
throw new Error('ManyVids found, did the network migration run?');
}
await knex('entities')
const result = await knex('entities')
.insert(channels.map((channel) => ({
name: channel.name,
slug: channel.slug,
@@ -51,7 +51,8 @@ exports.seed = async function (knex) {
has_logo: false,
})))
.onConflict(['slug', 'type'])
.merge(['name', 'url']);
.merge(['name', 'url'])
.returning(knex.raw('(xmax = 0) as inserted'));
console.log(`Done! ${channels.length} ManyVids creators added as channels`);
console.log(`Done! ${result.filter((row) => row.inserted).length}/${channels.length} ManyVids creators newly added as channels`);
};