1
- import { XMLParser } from 'fast-xml-parser' ;
1
+ import { XMLParser } from 'fast-xml-parser' ;
2
2
import _ from 'lodash' ;
3
3
import Base64 from 'crypto-js/enc-base64' ;
4
4
import Utf8 from 'crypto-js/enc-utf8' ;
5
5
import xpath from 'xpath' ;
6
- import { DOMParser } from '@xmldom/xmldom' ;
6
+ import { DOMParser } from '@xmldom/xmldom' ;
7
7
8
- import { doWork as t3Work , terminateWork as t3WorkTerminate } from './drpy' ;
8
+ import { doWork as t3Work , terminateWork as t3WorkTerminate } from './drpy' ;
9
9
import CLASS_FILTER_CONFIG from '@/config/appFilter' ;
10
10
import request from '@/utils/request' ;
11
11
@@ -95,7 +95,7 @@ const t3RuleInit = async (site) => {
95
95
96
96
if ( _ . has ( site , 'ext' ) ) {
97
97
try {
98
- await t3Work ( { type : 'init' , data : site . ext } ) ;
98
+ await t3Work ( { type : 'init' , data : site . ext } ) ;
99
99
data = {
100
100
code : 200 ,
101
101
msg : 'success' ,
@@ -116,7 +116,7 @@ const t3RuleProxy = async (url: string): Promise<any[]> => {
116
116
const formatUrl = new URL ( url ) ;
117
117
const params = Object . fromEntries ( formatUrl . searchParams . entries ( ) ) ;
118
118
119
- const result : any = await t3Work ( { type : 'proxy' , data : params } ) ;
119
+ const result : any = await t3Work ( { type : 'proxy' , data : params } ) ;
120
120
return ( result ?. data ?? [ ] ) as any [ ] ;
121
121
} ;
122
122
@@ -158,7 +158,7 @@ const fetchClassify = async (site) => {
158
158
} else if ( site . type === 6 ) {
159
159
url = buildUrl ( site . api , `&extend=${ site . ext } &filter=true` ) ;
160
160
} else if ( site . type === 7 ) {
161
- const content : any = await t3Work ( { type : 'home' } ) ;
161
+ const content : any = await t3Work ( { type : 'home' } ) ;
162
162
const res = {
163
163
page : 1 ,
164
164
pagecount : 9999 ,
@@ -304,9 +304,9 @@ const fetchClassify = async (site) => {
304
304
const value = classItem . type_extend [ key ] ;
305
305
if ( ! _ . isEmpty ( value ) && ! [ 'star' , 'state' , 'version' , 'director' ] . includes ( key ) ) {
306
306
const valueList = value . split ( ',' ) . map ( ( item ) => item . trim ( ) ) ;
307
- const options = valueList . map ( ( value ) => ( { n : value === '全部' ? '全部' : value , v : value } ) ) ;
308
- const name = ( _ . find ( CLASS_FILTER_CONFIG , { key } ) || { } ) . desc ;
309
- result . push ( { key, name, value : [ { n : '全部' , v : '' } , ...options ] } ) ;
307
+ const options = valueList . map ( ( value ) => ( { n : value === '全部' ? '全部' : value , v : value } ) ) ;
308
+ const name = ( _ . find ( CLASS_FILTER_CONFIG , { key} ) || { } ) . desc ;
309
+ result . push ( { key, name, value : [ { n : '全部' , v : '' } , ...options ] } ) ;
310
310
}
311
311
}
312
312
filters [ classItem . type_id ] = result ;
@@ -403,18 +403,18 @@ const checkValid = async (site) => {
403
403
const convertVideoList = ( videoItems ) => {
404
404
return videoItems . map (
405
405
( {
406
- id : vod_id ,
407
- tid : type_id ,
408
- type : type_name ,
409
- pic : vod_pic ,
410
- note : vod_remark ,
411
- name : vod_name ,
412
- des : vod_content ,
413
- year : vod_year ,
414
- area : vod_area ,
415
- director : vod_director ,
416
- actor : vod_actor ,
417
- } ) => ( {
406
+ id : vod_id ,
407
+ tid : type_id ,
408
+ type : type_name ,
409
+ pic : vod_pic ,
410
+ note : vod_remark ,
411
+ name : vod_name ,
412
+ des : vod_content ,
413
+ year : vod_year ,
414
+ area : vod_area ,
415
+ director : vod_director ,
416
+ actor : vod_actor ,
417
+ } ) => ( {
418
418
vod_id,
419
419
type_id,
420
420
type_name,
@@ -452,7 +452,7 @@ const fetchList = async (site, pg = 1, t, f = {}) => {
452
452
} else if ( site . type === 7 ) {
453
453
const res : any = await t3Work ( {
454
454
type : 'category' ,
455
- data : { tid : t , pg, filter : _ . size ( f ) ? true : false , extend : _ . size ( f ) ? f : { } } ,
455
+ data : { tid : t , pg, filter : _ . size ( f ) ? true : false , extend : _ . size ( f ) ? f : { } } ,
456
456
} ) ;
457
457
return res . data . list ;
458
458
} else if ( site . type === 8 ) {
@@ -510,7 +510,7 @@ const fetchList = async (site, pg = 1, t, f = {}) => {
510
510
* @returns
511
511
*/
512
512
const convertHotList = ( hotItems ) => {
513
- return hotItems . map ( ( { id : vod_id , tid : type_id , type : type_name , note : vod_remark , name : vod_name } ) => ( {
513
+ return hotItems . map ( ( { id : vod_id , tid : type_id , type : type_name , note : vod_remark , name : vod_name } ) => ( {
514
514
vod_id,
515
515
type_id,
516
516
type_name,
@@ -592,11 +592,11 @@ const convertSearchList = (searchItem) => {
592
592
593
593
return result ;
594
594
} ;
595
- const fetchSearch = async ( site , wd ) => {
595
+ const fetchSearch = async ( site , wd , pg : number = 1 ) => {
596
596
// xml坑: 单条结果是dict 多条结果list
597
597
try {
598
598
if ( site . type === 7 ) {
599
- const res : any = await t3Work ( { type : 'search' , data : { wd, quick : false , pg : 1 } } ) ;
599
+ const res : any = await t3Work ( { type : 'search' , data : { wd, quick : false , pg : pg } } ) ;
600
600
return res . data ?. list ;
601
601
}
602
602
let url , postData ;
@@ -607,7 +607,7 @@ const fetchSearch = async (site, wd) => {
607
607
url = buildUrl ( site . api , `/search` ) ;
608
608
postData = {
609
609
wd,
610
- pg : 1 ,
610
+ pg : pg ,
611
611
} ;
612
612
} else url = buildUrl ( site . api , `?wd=${ encodeURIComponent ( wd ) } ` ) ;
613
613
@@ -732,19 +732,19 @@ const convertDetailList = (detailItems) => {
732
732
733
733
return detailItems . map (
734
734
( {
735
- id : vod_id ,
736
- tid : type_id ,
737
- type : type_name ,
738
- pic : vod_pic ,
739
- note : vod_remark ,
740
- name : vod_name ,
741
- des : vod_content ,
742
- year : vod_year ,
743
- area : vod_area ,
744
- director : vod_director ,
745
- actor : vod_actor ,
746
- dl : { dd : dldd } ,
747
- } ) => ( {
735
+ id : vod_id ,
736
+ tid : type_id ,
737
+ type : type_name ,
738
+ pic : vod_pic ,
739
+ note : vod_remark ,
740
+ name : vod_name ,
741
+ des : vod_content ,
742
+ year : vod_year ,
743
+ area : vod_area ,
744
+ director : vod_director ,
745
+ actor : vod_actor ,
746
+ dl : { dd : dldd } ,
747
+ } ) => ( {
748
748
vod_id,
749
749
type_id,
750
750
type_name,
@@ -774,7 +774,7 @@ const fetchDetail = async (site, id) => {
774
774
} else if ( site . type === 6 ) {
775
775
url = buildUrl ( site . api , `?ac=detail&ids=${ id } &extend=${ site . ext } ` ) ;
776
776
} else if ( site . type === 7 ) {
777
- const res : any = await t3Work ( { type : 'detail' , data : `${ id } ` } ) ;
777
+ const res : any = await t3Work ( { type : 'detail' , data : `${ id } ` } ) ;
778
778
return res . data . list ;
779
779
} else if ( site . type === 8 ) {
780
780
url = buildUrl ( site . api , `/detail` ) ;
@@ -807,11 +807,13 @@ const fetchDetail = async (site, id) => {
807
807
const detailxlPat = reptileApiFormat ( site . api , 'detailxl' ) ;
808
808
const detailxlRes = reptileXpathFormat ( json , detailxlPat ) ;
809
809
const detailjsPat = reptileApiFormat ( site . api , 'detailjs' ) ;
810
+ // @ts -ignore
810
811
const detailjsRes = reptileXpathFormat ( json , detailjsPat ) ;
811
812
const detailjsurlPat = reptileApiFormat ( site . api , 'detailjsurl' ) ;
812
813
const detailjsurlRes = reptileXpathFormat ( json , detailjsurlPat ) ;
813
814
814
815
const vod_from = detailxlRes . join ( '$$$' ) ;
816
+ // @ts -ignore
815
817
let zippedData = _ . zip ( detaillistRes , detailjsurlRes ) ;
816
818
console . log ( detaillistRes , detailjsurlRes ) ;
817
819
console . log ( vod_from ) ;
@@ -871,7 +873,7 @@ const fetchHipyPlayUrl = async (site, flag, play) => {
871
873
*/
872
874
const fetchT3PlayUrl = async ( flag : string , id : string , flags : string [ ] = [ ] ) => {
873
875
try {
874
- const res : any = await t3Work ( { type : 'play' , data : { flag, id, flags } } ) ;
876
+ const res : any = await t3Work ( { type : 'play' , data : { flag, id, flags} } ) ;
875
877
return res . data ;
876
878
} catch ( err ) {
877
879
throw err ;
@@ -891,7 +893,7 @@ const fetchCatvodPlayUrl = async (site, flag: string, id: string) => {
891
893
const response = await request ( {
892
894
url,
893
895
method : 'POST' ,
894
- data : { flag, id } ,
896
+ data : { flag, id} ,
895
897
} ) ;
896
898
return response ;
897
899
} catch ( err ) {
@@ -1053,10 +1055,10 @@ const fetchDoubanRate = async (id, type, name, year) => {
1053
1055
try {
1054
1056
let rate = 0.0 ;
1055
1057
if ( ! id || ! type ) {
1056
- const { vod_score : foundRate } = ( await fetchDoubanSearch ( name , year ) ) as any ;
1058
+ const { vod_score : foundRate } = ( await fetchDoubanSearch ( name , year ) ) as any ;
1057
1059
rate = foundRate ;
1058
1060
} else {
1059
- const { vod_score : foundRate } = ( await fetchDoubanDetail ( id , type ) ) as any ;
1061
+ const { vod_score : foundRate } = ( await fetchDoubanDetail ( id , type ) ) as any ;
1060
1062
rate = foundRate ;
1061
1063
}
1062
1064
@@ -1077,7 +1079,7 @@ const fetchDoubanRate = async (id, type, name, year) => {
1077
1079
const fetchDoubanRecommend = async ( id , type , name , year ) => {
1078
1080
try {
1079
1081
if ( ! id || ! type ) {
1080
- const { vod_douban_id : foundId , vod_douban_type : foundType } = ( await fetchDoubanSearch ( name , year ) ) as any ;
1082
+ const { vod_douban_id : foundId , vod_douban_type : foundType } = ( await fetchDoubanSearch ( name , year ) ) as any ;
1081
1083
id = foundId ;
1082
1084
type = foundType ;
1083
1085
}
0 commit comments