File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,11 +15,23 @@ export function parseEpisodes(playUrl: string): Episode[] {
1515 const episodes = playUrl . split ( '#' ) . filter ( Boolean ) ;
1616
1717 return episodes . map ( ( episode , index ) => {
18- const [ name , url ] = episode . split ( '$' ) ;
18+ const parts = episode . split ( '$' ) ;
19+ let name : string , url : string ;
20+
21+ if ( parts . length > 1 ) {
22+ name = parts [ 0 ] ;
23+ url = parts [ 1 ] ;
24+ } else {
25+ // If no '$' separator, treat the whole thing as the URL
26+ url = parts [ 0 ] ;
27+ name = `第 ${ index + 1 } 集` ;
28+ }
29+
1930 // Clean up URL: remove double slashes but keep protocol (http:// or https://)
2031 const cleanUrl = ( url || '' ) . replace ( / ( [ ^ : ] ) \/ \/ / g, '$1/' ) ;
32+
2133 return {
22- name : name || `Episode ${ index + 1 } ` ,
34+ name : name || `第 ${ index + 1 } 集 ` ,
2335 url : cleanUrl ,
2436 index,
2537 } ;
@@ -29,3 +41,4 @@ export function parseEpisodes(playUrl: string): Episode[] {
2941 return [ ] ;
3042 }
3143}
44+
You can’t perform that action at this time.
0 commit comments