Browse Source

set mob mode for douyin

master
filesite 7 months ago
parent
commit
51b935e7dc
  1. 8
      spider.mjs

8
spider.mjs

@ -49,7 +49,6 @@ import path from 'node:path'; @@ -49,7 +49,6 @@ import path from 'node:path';
//spider run
let spider_is_running = false,
last_run_time = 0;
let last_douyin_mode = 'pc';
const task_check_time = 20; //每 20 秒抓取一次
const task_auto_run = cron.schedule(`*/${task_check_time} * * * * *`, async () => {
const current_time = common.getTimestampInSeconds();
@ -71,7 +70,7 @@ import path from 'node:path'; @@ -71,7 +70,7 @@ import path from 'node:path';
switch (botName) {
case 'douyin':
bot = new Douyin(heroCloudServer);
bot.setMode(last_douyin_mode);
bot.setMode('mob'); //使用手机模式
break;
case 'kuaishou':
bot = new Kuaishou(heroCloudServer);
@ -92,11 +91,6 @@ import path from 'node:path'; @@ -92,11 +91,6 @@ import path from 'node:path';
const data = await bot.scrap(task.url);
//console.log('Data got by bot', data);
//为抖音切换模式
if (bot.name == 'douyin') {
last_douyin_mode = last_douyin_mode == 'pc' ? 'mob' : 'pc';
}
if (typeof(data.done) != 'undefined' && data.done == true) {
task.data = data; //把抓取到的数据保存到任务里
taskMoniter.updateTask(task.id, task);

Loading…
Cancel
Save