Hero scripts of machete.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

64 lines
2.2 KiB

import Douyin from '../bot/Douyin.mjs';
import Kuaishou from '../bot/Kuaishou.mjs';
import Xigua from '../bot/Xigua.mjs';
import configs from '../config.mjs';
(async () => {
let test_bot = 'douyin';
if (process.argv.length == 3) {
test_bot = process.argv[2];
}
console.log('当前测试Bot:%s', test_bot);
const heroCloudServer = 'ws://192.168.3.13:1818';
let url = '', data = {};
switch(test_bot) {
case 'douyin':
//抖音测试
const douyin = new Douyin(heroCloudServer);
url = 'https://v.douyin.com/iJr1NsJJ/';
console.log('请求中: %s ...', url);
data = await douyin.scrap(url);
console.log("解析结果:\n%s", JSON.stringify(data));
break;
case 'kuaishou':
//快手测试
configs.heroTabOptions.timeoutMs = 20000; //所有内容加载完成超时
configs.heroBotOptions.userAgent = configs.userAgents.iphone_wechat;
//configs.heroBotOptions.userAgent = configs.userAgents.mac_chrome;
console.log('Hero配置', configs);
const kuaishou = new Kuaishou(heroCloudServer);
//url = 'https://www.kuaishou.com/f/X8FTguiIjZQVwE7';
url = 'https://v.kuaishou.com/7zwqe6';
//url = 'https://www.kuaishou.com/';
console.log('请求中: %s ...', url);
data = await kuaishou.scrap(url);
console.log("解析结果:\n%s", JSON.stringify(data));
break;
case 'xigua':
//西瓜测试
//url = 'https://www.ixigua.com/7092326495246516749'; //pc
url = 'https://v.ixigua.com/ieUaqrFN/'; //mobile
configs.heroBotOptions.referrer = url;
configs.heroBotOptions.userAgent = configs.userAgents.mac_chrome;
console.log('Hero配置', configs);
const xigua = new Xigua(heroCloudServer);
console.log('请求中: %s ...', url);
data = await xigua.scrap(`${url}?wid_try=1`);
console.log("解析结果:\n%s", JSON.stringify(data));
break;
}
process.exit(0);
})();