File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,6 +76,27 @@ async function extractAnimeInfo(id) {
7676 animeInfo [ key ] = value ;
7777 } ) ;
7878
79+ const trailers = [ ] ;
80+ $ ( '.block_area-promotions-list .screen-items .item' ) . each ( ( _ , element ) => {
81+ const el = $ ( element ) ;
82+ const title = el . attr ( 'data-title' ) ;
83+ const url = el . attr ( 'data-src' ) ;
84+ if ( url ) {
85+ const fullUrl = url . startsWith ( '//' ) ? `https:${ url } ` : url ;
86+ let videoId = null ;
87+ const match = fullUrl . match ( / \/ e m b e d \/ ( [ ^ ? & ] + ) / ) ;
88+ if ( match && match [ 1 ] ) {
89+ videoId = match [ 1 ] ;
90+ }
91+ trailers . push ( {
92+ title : title || null ,
93+ url : fullUrl ,
94+ thumbnail : videoId ? `https://img.youtube.com/vi/${ videoId } /hqdefault.jpg` : null
95+ } ) ;
96+ }
97+ } ) ;
98+ animeInfo . trailers = trailers ;
99+
79100 const season_id = formatTitle ( title , data_id ) ;
80101 animeInfo [ "Overview" ] = overviewElement . text ( ) . trim ( ) ;
81102 animeInfo [ "tvInfo" ] = tvInfo ;
You can’t perform that action at this time.
0 commit comments