From 7b5bef62a109e4d8435f2221aebc296f2dfe859e Mon Sep 17 00:00:00 2001 From: filesite Date: Wed, 18 Dec 2024 22:22:15 +0800 Subject: [PATCH] add user-agent for axios options --- lib/heroBot.mjs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/heroBot.mjs b/lib/heroBot.mjs index e793ab0..10c4d7a 100644 --- a/lib/heroBot.mjs +++ b/lib/heroBot.mjs @@ -42,6 +42,10 @@ class HeroBot { //axios请求配置 this.axiosConfig = { + //配置一个浏览器的user-agent + headers: { + 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36' + }, timeout: 8000, //请求超时 proxy: false //是否走代理 };