diff --git a/lib/routes/163/dy2.ts b/lib/routes/163/dy2.ts index 50d7ebf902..527e94083f 100644 --- a/lib/routes/163/dy2.ts +++ b/lib/routes/163/dy2.ts @@ -11,7 +11,7 @@ export const route: Route = { path: '/dy2/:id', categories: ['new-media'], example: '/163/dy2/T1555591616739', - parameters: { id: 'id,该网易号主页网址最后一项html的文件名' }, + parameters: { id: 'id,该网易号主页网址最后一项 html 的文件名' }, features: { requireConfig: false, requirePuppeteer: false, @@ -21,7 +21,7 @@ export const route: Route = { supportScihub: false, }, name: '网易号(通用)', - maintainers: ['mjysci'], + maintainers: ['mjysci', 'lyqluis'], handler, description: `优先使用方法一,若是网易号搜索页面搜不到的小众网易号(文章页面不含\`data-wemediaid\`)则可使用此法。 触发反爬会只抓取到标题,建议自建。`, @@ -43,11 +43,12 @@ async function handler(ctx) { .toArray() .map((item) => { item = $(item); + const itemImg = item.find('a.img img'); return { title: item.find('h4 a').text(), link: item.find('a').first().attr('href'), pubDate: timezone(parseDate(item.find('.time').text()), 8), - imgsrc: item.find('a img').attr('src'), + imgsrc: itemImg.attr('src') ?? itemImg.attr('_src'), }; }); diff --git a/lib/routes/163/utils.ts b/lib/routes/163/utils.ts index 61fa5beae9..b9f9bc7d82 100644 --- a/lib/routes/163/utils.ts +++ b/lib/routes/163/utils.ts @@ -26,8 +26,9 @@ const parseDyArticle = (charset, item, tryGet) => } }); + const imgUrl = new URL(item.imgsrc); item.description = art(path.join(__dirname, 'templates/dy.art'), { - imgsrc: item.imgsrc?.split('?')[0], + imgsrc: imgUrl.searchParams.get('url'), postBody: $('.post_body').html(), });