Browse Source

add user agents

master
filesite 1 year ago
parent
commit
352741ace5
  1. 6
      config.mjs
  2. 2
      test/scrap_test.mjs

6
config.mjs

@ -10,6 +10,12 @@ export default {
//网页tab参数 //网页tab参数
heroTabOptions: { heroTabOptions: {
timeoutMs: 5000 timeoutMs: 5000
},
//常用浏览器user-agent
userAgents: {
iphone_chrome: 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1',
mac_chrome: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36',
} }
}; };

2
test/scrap_test.mjs

@ -25,7 +25,7 @@ import configs from '../config.mjs';
//西瓜测试 //西瓜测试
const url = 'https://www.ixigua.com/7092326495246516749'; const url = 'https://www.ixigua.com/7092326495246516749';
configs.heroBotOptions.referrer = url; configs.heroBotOptions.referrer = url;
configs.heroBotOptions.userAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36'; configs.heroBotOptions.userAgent = configs.userAgents.mac_chrome;
console.log('Hero配置', configs); console.log('Hero配置', configs);
const xigua = new Xigua(heroCloudServer); const xigua = new Xigua(heroCloudServer);

Loading…
Cancel
Save