@@ -24,6 +24,18 @@ import OtherSource from "../sources/other.js";
2424// 兼容弹弹play接口
2525// =====================
2626
27+ const kan360Source = new Kan360Source ( ) ;
28+ const vodSource = new VodSource ( ) ;
29+ const renrenSource = new RenrenSource ( ) ;
30+ const hanjutvSource = new HanjutvSource ( ) ;
31+ const bahamutSource = new BahamutSource ( ) ;
32+ const tencentSource = new TencentSource ( ) ;
33+ const youkuSource = new YoukuSource ( ) ;
34+ const iqiyiSource = new IqiyiSource ( ) ;
35+ const mangoSource = new MangoSource ( ) ;
36+ const bilibiliSource = new BilibiliSource ( ) ;
37+ const otherSource = new OtherSource ( ) ;
38+
2739function matchSeason ( anime , queryTitle , season ) {
2840 if ( anime . animeTitle . includes ( queryTitle ) ) {
2941 const title = anime . animeTitle . split ( "(" ) [ 0 ] . trim ( ) ;
@@ -51,17 +63,6 @@ function matchSeason(anime, queryTitle, season) {
5163
5264// Extracted function for GET /api/v2/search/anime
5365export async function searchAnime ( url ) {
54- const kan360Source = new Kan360Source ( ) ;
55- const vodSource = new VodSource ( ) ;
56- const renrenSource = new RenrenSource ( ) ;
57- const hanjutvSource = new HanjutvSource ( ) ;
58- const bahamutSource = new BahamutSource ( ) ;
59- const tencentSource = new TencentSource ( ) ;
60- const youkuSource = new YoukuSource ( ) ;
61- const iqiyiSource = new IqiyiSource ( ) ;
62- const mangoSource = new MangoSource ( ) ;
63- const bilibiliSource = new BilibiliSource ( ) ;
64-
6566 const queryTitle = url . searchParams . get ( "keyword" ) ;
6667 log ( "info" , `Search anime with keyword: ${ queryTitle } ` ) ;
6768
@@ -687,16 +688,6 @@ export async function getBangumi(path) {
687688
688689// Extracted function for GET /api/v2/comment/:commentId
689690export async function getComment ( path , queryFormat ) {
690- const renrenSource = new RenrenSource ( ) ;
691- const hanjutvSource = new HanjutvSource ( ) ;
692- const bahamutSource = new BahamutSource ( ) ;
693- const tencentSource = new TencentSource ( ) ;
694- const iqiyiSource = new IqiyiSource ( ) ;
695- const mangoSource = new MangoSource ( ) ;
696- const bilibiliSource = new BilibiliSource ( ) ;
697- const youkuSource = new YoukuSource ( ) ;
698- const otherSource = new OtherSource ( ) ;
699-
700691 const commentId = parseInt ( path . split ( "/" ) . pop ( ) ) ;
701692 let url = findUrlById ( commentId ) ;
702693 let title = findTitleById ( commentId ) ;
@@ -769,13 +760,6 @@ export async function getComment(path, queryFormat) {
769760
770761// Extracted function for GET /api/v2/comment?url=xxx
771762export async function getCommentByUrl ( videoUrl , queryFormat ) {
772- const tencentSource = new TencentSource ( ) ;
773- const iqiyiSource = new IqiyiSource ( ) ;
774- const mangoSource = new MangoSource ( ) ;
775- const bilibiliSource = new BilibiliSource ( ) ;
776- const youkuSource = new YoukuSource ( ) ;
777- const otherSource = new OtherSource ( ) ;
778-
779763 try {
780764 // 验证URL参数
781765 if ( ! videoUrl || typeof videoUrl !== 'string' ) {
0 commit comments