Added sorting env to ManyVids seed, changed default to followers instead of top.
This commit is contained in:
@@ -4,12 +4,13 @@ const unprint = require('unprint');
|
|||||||
const slugify = require('../src/utils/slugify');
|
const slugify = require('../src/utils/slugify');
|
||||||
|
|
||||||
const limit = Number(process.env.MV_LIMIT) || 1000;
|
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 = []) {
|
async function fetchCreators(page = 1, acc = []) {
|
||||||
console.log(`Fetching creators ${acc.length}/${limit}`);
|
console.log(`Fetching creators ${acc.length}/${limit}`);
|
||||||
|
|
||||||
// size seems to be capped at 70
|
// size seems to be capped at 70
|
||||||
const res = await unprint.get(`https://api.manyvids.com/search/creators/list?contentPref=1,2,3&sort=top&size=50&from=${(page - 1) * 50}`);
|
const res = await unprint.get(`https://api.manyvids.com/search/creators/list?contentPref=1,2,3&sort=${sorting}&size=50&from=${(page - 1) * 50}`);
|
||||||
|
|
||||||
if (res.ok && res.data?.creators) {
|
if (res.ok && res.data?.creators) {
|
||||||
const creators = acc.concat(res.data.creators.map((creator) => ({
|
const creators = acc.concat(res.data.creators.map((creator) => ({
|
||||||
|
|||||||
Reference in New Issue
Block a user