Skip to content

Commit a890e99

Browse files
eve2ptpEvilmass
authored andcommitted
fix jable
Unexpected string concatenation of literals.
1 parent dfe8723 commit a890e99

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/routes/jable/index.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,19 @@ const GOT_HEADERS = {
5454

5555
async 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 {

0 commit comments

Comments
 (0)