1+ /*
2+ @header ({
3+ searchable: 1,
4+ filterable: 1,
5+ quickSearch: 1,
6+ title: '03影视',
7+ author: '小可乐/250915/第一版',
8+ '类型': '影视',
9+ lang: 'dr2'
10+ })
11+ */
12+
13+ var rule = {
14+ author : '小可乐/250915/第一版' ,
15+ title : '03影视' ,
16+ 类型 : '影视' ,
17+ host : 'https://www.03yy.live' ,
18+ headers : {
19+ 'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/128.0.0.0 Safari/537.36' ,
20+ 'Accept' : 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' ,
21+ 'Accept-Language' : 'zh-CN,zh;q=0.9'
22+ } ,
23+ 编码 : 'utf-8' ,
24+ timeout : 5000 ,
25+ url : '/type/indexfyclass-fypage.html' ,
26+ filter_url : '' ,
27+ searchUrl : '/search.php?searchword=**' ,
28+ searchable : 1 ,
29+ quickSearch : 1 ,
30+ filterable : 1 ,
31+
32+ class_name : '电影&电视剧&综艺&动漫' ,
33+ class_url : '1&2&3&4' ,
34+ filter_def : { } ,
35+ 预处理 : $js . toString ( ( ) => {
36+ // 使用withHeaders: true来获取响应头
37+ const res = request ( HOST , {
38+ headers : rule . headers ,
39+ withHeaders : true ,
40+ redirect : false ,
41+ method : 'GET'
42+ } ) ;
43+ const resJson = typeof res === 'string' ? JSON . parse ( res ) : res ;
44+
45+ // 提取set-cookie头
46+ const setCookie = resJson [ 'set-cookie' ] || '' ;
47+
48+ // 处理cookie格式
49+ let cookies = '' ;
50+ if ( Array . isArray ( setCookie ) ) {
51+ cookies = setCookie . map ( c => c . split ( ';' ) [ 0 ] . trim ( ) ) . join ( '; ' ) ;
52+ } else if ( setCookie ) {
53+ cookies = setCookie . split ( ';' ) [ 0 ] . trim ( ) ;
54+ }
55+
56+ // 更新rule.headers中的cookie
57+ if ( cookies ) {
58+ rule . headers [ "cookie" ] = rule . headers [ "cookie" ] ?
59+ rule . headers [ "cookie" ] + '; ' + cookies : cookies ;
60+ rule_fetch_params . headers = Object . assign ( { } , rule . headers ) ;
61+ }
62+
63+ console . log ( `提取的Cookie: ${ cookies || '无' } ` ) ;
64+ console . log ( `最终Cookie: ${ rule . headers [ "cookie" ] || '无' } ` ) ;
65+ } ) ,
66+ play_parse : true ,
67+ lazy : $js . toString ( ( ) => {
68+ let html = request ( input , {
69+ headers : rule . headers ,
70+ withHeaders : true ,
71+ redirect : false ,
72+ method : 'GET'
73+ } ) ;
74+
75+ // 处理转义引号:将 \" 替换为 "
76+ html = html . replace ( / \\ " / g, '"' ) ;
77+
78+ // 匹配参数
79+ const nowMatch = html . match ( / v a r \s + n o w \s * = \s * b a s e 6 4 d e c o d e \s * \( \s * [ " ' ] ( [ ^ " ' ] + ) [ " ' ] \s * \) / ) ;
80+ const prePageMatch = html . match ( / v a r \s + p r e P a g e \s * = \s * [ " ' ] ( [ ^ " ' ] + ) [ " ' ] / ) ;
81+ const nextPageMatch = html . match ( / v a r \s + n e x t P a g e \s * = \s * [ " ' ] ( [ ^ " ' ] + ) [ " ' ] / ) ;
82+ var now = nowMatch [ 1 ] ;
83+ now = base64Decode ( now ) ;
84+ console . log ( "now:" + now ) ;
85+
86+ if ( / \. ( m 3 u 8 | m p 4 | m k v | j p g ) / . test ( now ) ) {
87+ input = { parse : 0 , url : now }
88+ } else {
89+ const prePage = prePageMatch [ 1 ] ;
90+ const nextPage = nextPageMatch [ 1 ] ;
91+ console . log ( "prePage:" + prePage ) ;
92+ console . log ( "nextPage:" + nextPage ) ;
93+
94+ let jx = `${ HOST } /api/dplayer.php?url=${ now } &ref=${ encodeURIComponent ( prePage ) } &next=${ encodeURIComponent ( nextPage ) } ` ;
95+
96+ console . log ( "请求URL:" + jx ) ;
97+
98+ let videohtml = request ( jx , {
99+ headers : rule . headers ,
100+ withHeaders : true ,
101+ redirect : false ,
102+ method : 'GET'
103+ } ) ;
104+ console . log ( "videohtml:" + videohtml ) ;
105+
106+ const mediaInfoRegex = / m e d i a I n f o \s * = \s * ( \[ .* ?\] ) ; / gis;
107+ const mediaInfoMatch = mediaInfoRegex . exec ( videohtml ) ;
108+ let videoUrl = "" ;
109+
110+ if ( mediaInfoMatch && mediaInfoMatch [ 1 ] ) {
111+ const mediaInfoContent = mediaInfoMatch [ 1 ] ;
112+ const qualityLevels = [ "1080" , "720" , "540" , "360" ] ;
113+ const urls = [ ] ;
114+ for ( const quality of qualityLevels ) {
115+ const urlRegex = new RegExp (
116+ `definition.*?${ quality } .*?url.*?:.*?"(https.*?)"` ,
117+ 'is'
118+ ) ;
119+ const urlMatch = mediaInfoContent . match ( urlRegex ) ;
120+ if ( urlMatch && urlMatch [ 1 ] ) {
121+ videoUrl = urlMatch [ 1 ] ;
122+ videoUrl = videoUrl . replace ( / \\ \\ \/ / g, '/' ) . replace ( / \\ + / g, '' ) ;
123+ console . log ( `找到${ quality } 清晰度的URL:` , videoUrl ) ;
124+ urls . push ( quality , videoUrl ) ;
125+ }
126+ }
127+ input = { parse : 0 , url : urls } ;
128+ if ( ! videoUrl ) {
129+ console . log ( "未找到任何已知清晰度的URL" ) ;
130+ }
131+ } else {
132+ console . error ( "未匹配到mediaInfo" ) ;
133+ }
134+ }
135+ } ) ,
136+ limit : 9 ,
137+ double : true ,
138+ 推荐 : '.Pic-list&&.pic-content;a&&title;img&&src;span&&Text;a&&href' ,
139+ 一级 : '.type-box&&.pic-height-a;a&&title;img&&src;span&&Text;a&&href' ,
140+ 二级 : {
141+ title : 'h2&&Text;.m-content&&ul&&li:eq(4)' ,
142+ img : 'img&&src' ,
143+ desc : '.color-red&&Text;.m-content&&ul&&span:eq(2)&&Text;.m-content&&ul&&span:eq(0)&&Text;.m-content&&ul&&li:eq(1)&&Text;.m-content&&ul&&li:eq(0)&&Text' ,
144+ content : '.m-intro&&Text' ,
145+ tabs : '#playlist&&li' ,
146+ tab_text : 'body&&Text' ,
147+ lists : '.play_list:eq(#id)&&li' ,
148+ list_text : 'body&&Text' ,
149+ list_url : 'a&&href'
150+ } ,
151+ 搜索 : '*' ,
152+ }
0 commit comments