fix(route): dcfever (#17179)

This commit is contained in:
Tony
2024-10-18 00:25:53 +08:00
committed by GitHub
parent 3d34710b6e
commit f455df8a35
2 changed files with 16 additions and 9 deletions
+3 -5
View File
@@ -29,16 +29,14 @@ async function handler(ctx) {
const response = await ofetch(link.href);
const $ = load(response);
const list = $('.item_list li a')
const list = $('.item_grid_wrap div a')
.toArray()
.filter((item) => $(item).attr('href') !== '/documents/advertising.php')
.map((item) => {
item = $(item);
item.find('.optional').remove();
return {
title: item.find('.trade_title').text(),
title: item.find('.lazyloadx').attr('alt'),
link: new URL(item.attr('href'), link.href).href,
author: item.find('.trade_info').text(),
author: item.find('.trade_info div span').eq(1).text(),
};
});
+13 -4
View File
@@ -63,11 +63,20 @@ const parseTradeItem = (item) =>
const response = await ofetch(item.link);
const $ = load(response);
$('.selector_text').remove();
$('.selector_image_div').each((_, div) => {
const photoSelector = $('#trading_item_section .description')
.contents()
.filter((_, e) => e.type === 'comment')
.toArray()
.map((e) => e.data)
.join('');
const $photo = load(photoSelector, null, false);
$photo('.selector_text').remove();
$photo('.selector_image_div').each((_, div) => {
delete div.attribs.onclick;
});
$('.desktop_photo_selector img').each((_, img) => {
$photo('.desktop_photo_selector img').each((_, img) => {
if (img.attribs.src.endsWith('_sqt.jpg')) {
img.attribs.src = img.attribs.src.replace('_sqt.jpg', '.jpg');
}
@@ -76,7 +85,7 @@ const parseTradeItem = (item) =>
item.description = art(path.join(__dirname, 'templates/trading.art'), {
info: $('.info_col'),
description: $('.description_text').html(),
photo: $('.desktop_photo_selector').html(),
photo: $photo('.desktop_photo_selector').html(),
});
return item;