Fix: Request failed with status code 403
This commit is contained in:
1 parent
3e46f1fc0f
commit
2a7f668a0d
2 files changed
+16
-5
No files matched your search
+15
-4
@@ -6,17 +6,28 @@ const BASE_URL = 'https://javdb.com';
|
||||
|
||||
const HEADERS = {
|
||||
'User-Agent':
|
||||
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) ' +
|
||||
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) ' +
|
||||
'AppleWebKit/537.36 (KHTML, like Gecko) ' +
|
||||
'Chrome/124.0.0.0 Safari/537.36',
|
||||
'Chrome/123.0.0.0 Safari/537.36',
|
||||
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8',
|
||||
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8',
|
||||
Cookie: 'locale=zh', // 强制返回中文页面
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'Connection': 'keep-alive',
|
||||
'Upgrade-Insecure-Requests': '1',
|
||||
'Sec-Fetch-Dest': 'document',
|
||||
'Sec-Fetch-Mode': 'navigate',
|
||||
'Sec-Fetch-Site': 'none',
|
||||
'Sec-Fetch-User': '?1',
|
||||
'Cache-Control': 'max-age=0',
|
||||
Cookie: 'locale=zh; over18=1', // over18=1 跳过成人内容确认页
|
||||
};
|
||||
|
||||
async function fetchHtml(url) {
|
||||
const res = await axios.get(url, {
|
||||
headers: HEADERS,
|
||||
timeout: 10000,
|
||||
timeout: 15000,
|
||||
maxRedirects: 5,
|
||||
decompress: true,
|
||||
});
|
||||
return res.data;
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "javinfo",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"description": "AV番号命令行查询工具",
|
||||
"main": "./index.js",
|
||||
"type": "module",
|
||||
|
||||
Reference in new issue
Block a user