File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -54,14 +54,19 @@ const GOT_HEADERS = {
5454
5555async function handler ( ctx ) {
5656 const { query } = ctx . req . param ( ) ;
57+ const params = new URLSearchParams ( {
58+ mode : 'async' ,
59+ function : 'get_block' ,
60+ block_id : 'list_videos_videos_list_search_result' ,
61+ q : query ,
62+ sort_by : 'post_date' ,
63+ } ) ;
5764 const encodedQuery = encodeURIComponent ( query ) ;
58-
59- const apiUrl = `https://jable.tv/search/${ encodedQuery } /` + `?mode=async&function=get_block&block_id=list_videos_videos_list_search_result` + `&q=${ encodedQuery } &sort_by=post_date` ;
60-
65+ const apiUrl = `https://jable.tv/search/${ encodedQuery } /?${ params . toString ( ) } ` ;
6166 const response = await got ( apiUrl , { headers : GOT_HEADERS } ) ;
6267 const $ = load ( response . data ) ;
6368
64- const pageAuthor = $ ( 'section.content-header h2' ) . first ( ) . text ( ) . trim ( ) || query ;
69+ const author = $ ( 'section.content-header h2' ) . first ( ) . text ( ) . trim ( ) || query ;
6570
6671 const items = await Promise . all (
6772 $ ( '.video-img-box' )
@@ -86,7 +91,6 @@ async function handler(ctx) {
8691
8792 return cache . tryGet ( `jable:video:${ videoId } ` , async ( ) => {
8893 let pubDate ;
89- const author = pageAuthor ;
9094 let videoUrl ;
9195
9296 try {
You can’t perform that action at this time.
0 commit comments