From 15476262c88c6ead84c69c16eb333872e38b14b3 Mon Sep 17 00:00:00 2001 From: Vinfall <91039000+Vinfall@users.noreply.github.com> Date: Wed, 10 Apr 2024 08:52:11 +0000 Subject: [PATCH 1/3] feat(route): add author in gcores (#15032) * feat(route): add author in /gcores/catetory * refactor: add author in /gcores/category The order of `included` in response should be not considered as fixed. --- lib/routes/gcores/category.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/routes/gcores/category.ts b/lib/routes/gcores/category.ts index 269a2a8d1a439d..ef1813025b58dd 100644 --- a/lib/routes/gcores/category.ts +++ b/lib/routes/gcores/category.ts @@ -77,9 +77,11 @@ async function handler(ctx) { const itemPage = itemRes.data; const $ = load(itemPage); - let articleData = await got(`https://www.gcores.com/gapi/v1${item.url}?include=media`); + const articleRaw = await got(`https://www.gcores.com/gapi/v1${item.url}?include=media,category,user`); + const articleData = articleRaw.data.data; + const articleMeta = articleRaw.data.included.find((i) => i.type === 'users' && i.id === articleData.relationships.user.data.id); + const author = articleMeta.attributes.nickname; - articleData = articleData.data.data; let cover; if (articleData.attributes.cover) { cover = ``; @@ -127,6 +129,7 @@ async function handler(ctx) { description: cover + content, link: articleUrl, guid: articleUrl, + author, pubDate: new Date(articleData.attributes['published-at']), }; return category === 'news' ? basicItem : { ...basicItem, category: item.category }; From a0ea082fad755bc9219768957063115eb8566366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Terence=E5=AD=AB?= <527028803@qq.com> Date: Wed, 10 Apr 2024 17:16:55 +0800 Subject: [PATCH 2/3] fix(route): freewechat (#15179) --- lib/routes/freewechat/profile.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/routes/freewechat/profile.ts b/lib/routes/freewechat/profile.ts index 16f96fa8501bf7..515c06d686bfeb 100644 --- a/lib/routes/freewechat/profile.ts +++ b/lib/routes/freewechat/profile.ts @@ -65,7 +65,7 @@ async function handler(ctx) { $('.js_img_placeholder').remove(); $('amp-img').each((_, e) => { e = $(e); - e.replaceWith(``); + e.replaceWith(``); }); $('amp-video').each((_, e) => { e = $(e); From 049cb1815344b89563f5fd720cc8e464cfc9e21e Mon Sep 17 00:00:00 2001 From: MichealDeath <2664779@qq.com> Date: Wed, 10 Apr 2024 18:31:02 +0800 Subject: [PATCH 3/3] fix(route): picnob. Change source to 'pixwox.com'. (#15180) --- lib/routes/picnob/user.ts | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/lib/routes/picnob/user.ts b/lib/routes/picnob/user.ts index c64d1761630753..28ffd40f7c1292 100644 --- a/lib/routes/picnob/user.ts +++ b/lib/routes/picnob/user.ts @@ -13,18 +13,31 @@ import puppeteer from '@/utils/puppeteer'; export const route: Route = { path: '/user/:id', + categories: ['social-media'], + example: '/picnob/user/xlisa_olivex', + parameters: { id: 'Instagram id' }, + features: { + requireConfig: false, + requirePuppeteer: true, + antiCrawler: true, + supportBT: false, + supportPodcast: false, + supportScihub: false, + }, radar: [ { source: ['picnob.com/profile/:id/*'], + target: '/user/:id', }, ], - name: 'Unknown', + name: 'User Profile - Picnob', maintainers: ['TonyRL', 'micheal-death'], handler, }; async function handler(ctx) { - const baseUrl = 'https://www.picnob.com'; + // NOTE: 'picnob' is still available, but all requests to 'picnob' will be redirected to 'pixwox' eventually + const baseUrl = 'https://www.pixwox.com'; const id = ctx.req.param('id'); const url = `${baseUrl}/profile/${id}/`; @@ -40,8 +53,8 @@ async function handler(ctx) { }, }); html = data; - } catch (error) { - if (error.message.includes('code 403')) { + } catch (error: any) { + if (error.message.includes('403')) { html = await puppeteerGet(url, browser); usePuppeteer = true; } @@ -84,7 +97,7 @@ async function handler(ctx) { ...new Set( $('.post_slide a') .toArray() - .map((a) => { + .map((a: any) => { a = $(a); return { ori: a.attr('href'),