mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-10-24 12:15:32 +08:00
fix(route/kadokawa): fix image attr (#22394)
This commit is contained in:
@@ -25,7 +25,7 @@ export const handler = async (ctx) => {
|
||||
.map((item) => {
|
||||
item = $(item);
|
||||
|
||||
const image = item.find('div.List-item-excerpt img').prop('src')?.split(/\?/, 1)[0] ?? undefined;
|
||||
const image = item.find('div.List-item-excerpt img').prop('data-src')?.split(/\?/, 1)[0] ?? undefined;
|
||||
const title = item.find('h2.List-item-title').text();
|
||||
const description = renderDescription({
|
||||
images: image
|
||||
@@ -51,9 +51,6 @@ export const handler = async (ctx) => {
|
||||
image,
|
||||
banner: image,
|
||||
language,
|
||||
enclosure_url: image,
|
||||
enclosure_type: image ? `image/${image.split(/\./).pop()}` : undefined,
|
||||
enclosure_title: title,
|
||||
};
|
||||
});
|
||||
|
||||
@@ -64,6 +61,11 @@ export const handler = async (ctx) => {
|
||||
|
||||
const $$ = load(detailResponse);
|
||||
|
||||
$$('div.Post-content img[data-src]').each((_, img) => {
|
||||
$$(img).prop('src', $$(img).prop('data-src').split(/\?/, 1)[0]);
|
||||
$$(img).removeAttr('data-src');
|
||||
});
|
||||
|
||||
const title = $$('h1.Post-title').text().trim();
|
||||
const description = renderDescription({
|
||||
description: $$('div.Post-content').html(),
|
||||
@@ -80,9 +82,6 @@ export const handler = async (ctx) => {
|
||||
item.image = image;
|
||||
item.banner = image;
|
||||
item.language = language;
|
||||
item.enclosure_url = image;
|
||||
item.enclosure_type = image ? `image/${image.split(/\./).pop()}` : undefined;
|
||||
item.enclosure_title = title;
|
||||
|
||||
return item;
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user