diff --git a/lib/routes/dcfever/trading.ts b/lib/routes/dcfever/trading.ts index 6641f7f4e8bb80..daf1cc4e9b227c 100644 --- a/lib/routes/dcfever/trading.ts +++ b/lib/routes/dcfever/trading.ts @@ -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(), }; }); diff --git a/lib/routes/dcfever/utils.ts b/lib/routes/dcfever/utils.ts index 8f8527bbf96883..c2223147716658 100644 --- a/lib/routes/dcfever/utils.ts +++ b/lib/routes/dcfever/utils.ts @@ -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;