fix(route/picnob): fix image and video selector (#22757)
This commit is contained in:
@@ -67,13 +67,18 @@ async function handler(ctx) {
|
||||
const coverLink = $item.find('.cover_link').attr('href');
|
||||
const image = $item.find('.cover .cover_link img');
|
||||
const alt = image.attr('alt') || '';
|
||||
const downloadUrl = new URL($item.find('.downbtn').attr('href')!, baseUrl);
|
||||
downloadUrl.searchParams.delete('dl');
|
||||
const fullImage = new URL(image.attr('data-src')!);
|
||||
fullImage.searchParams.set('o', Buffer.from(downloadUrl.href).toString('base64'));
|
||||
const sum = $item.find('.sum');
|
||||
const title = sum.text().split('\n', 1)[0] || alt;
|
||||
const content = sum.html()?.replaceAll('\n', '<br>') || alt;
|
||||
const isVideo = $item.find('.corner .icon_video, .corner .icon_tv').length;
|
||||
|
||||
return {
|
||||
title,
|
||||
description: `<img src="${image.attr('data-src')}"><br>${content}`,
|
||||
description: `<img src="${isVideo ? image.attr('data-src') : fullImage.href}"><br>${content}`,
|
||||
link: `${baseUrl}${coverLink}`,
|
||||
guid: coverLink?.split('/', 3)?.[2],
|
||||
pubDate: parseRelativeDate($item.find('.time .txt').text()),
|
||||
@@ -114,7 +119,7 @@ async function handler(ctx) {
|
||||
return $item.html() || '';
|
||||
})
|
||||
.join('')
|
||||
: $('.view .video').html() || '';
|
||||
: $('.view video').prop('outerHTML') || '';
|
||||
|
||||
item.description = `${media}<br>${item.description}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user