@@ -7,6 +7,8 @@ import timezone from '@/utils/timezone';
77
88const baseUrl = 'https://www.qiche365.org.cn' ;
99
10+ const userAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36' ;
11+
1012export const route : Route = {
1113 path : '/recall/:channel' ,
1214 name : '汽车ε¬ε' ,
@@ -16,18 +18,35 @@ export const route: Route = {
1618| ------------ | ------------ | ------------ | ------------ |
1719| 1 | 2 | 3 | 4 |` ,
1820 categories : [ 'government' ] ,
21+ features : {
22+ antiCrawler : true ,
23+ } ,
1924 maintainers : [ 'huanfe1' ] ,
2025 handler,
2126 url : 'qiche365.org.cn/index/recall/index.html' ,
2227} ;
2328
2429async function handler ( ctx ) : Promise < Data > {
2530 const { channel } = ctx . req . param ( ) ;
31+ const targetUrl = `${ baseUrl } /index/recall/index/item/${ channel } .html?loadmore=1` ;
32+
33+ // Reason: site uses cookie-based anti-bot β first request returns 403 with set-cookie,
34+ // second request with those cookies returns the actual JSON data.
35+ const initResponse = await ofetch . raw ( targetUrl , {
36+ headers : {
37+ 'User-Agent' : userAgent ,
38+ 'Accept-Language' : 'zh-CN,zh;q=0.9' ,
39+ } ,
40+ ignoreResponseError : true ,
41+ } ) ;
42+
43+ const cookies = ( initResponse . headers . getSetCookie ?.( ) || [ ] ) . map ( ( c ) => c . split ( ';' ) [ 0 ] ) . join ( '; ' ) ;
2644
27- const { html } = await ofetch ( `${ baseUrl } /index/recall/index/item/${ channel } .html?loadmore=1` , {
28- method : 'get' ,
45+ const { html } = await ofetch ( targetUrl , {
2946 headers : {
47+ 'User-Agent' : userAgent ,
3048 'Accept-Language' : 'zh-CN,zh;q=0.9' ,
49+ Cookie : cookies ,
3150 } ,
3251 } ) ;
3352
@@ -46,7 +65,7 @@ async function handler(ctx): Promise<Data> {
4665 } ;
4766 } ) ;
4867 return {
49- title : [ 'ε½ε
ε¬εε
¬ε ' , 'ε½ε
ε¬εζ°ι» ' , 'ε½ε€ε¬εε
¬ε ' , 'ε½ε€ε¬εζ°ι» ' ] [ channel - 1 ] ,
68+ title : [ 'ε½ε
ε¬εζ°ι» ' , 'ε½ε
ε¬εε
¬ε ' , 'ε½ε€ε¬εζ°ι» ' , 'ε½ε€ε¬εε
¬ε ' ] [ Number ( channel ) - 1 ] ,
5069 link : `${ baseUrl } /index/recall/index.html` ,
5170 item : items ,
5271 language : 'zh-CN' ,
0 commit comments