Skip to content

Commit

Permalink
Merge pull request #1347 from DIYgod/master
Browse files Browse the repository at this point in the history
[pull] master from diygod:master
  • Loading branch information
pull[bot] authored Apr 10, 2024
2 parents 20041fb + 049cb18 commit 3fbe6df
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/routes/freewechat/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ async function handler(ctx) {
$('.js_img_placeholder').remove();
$('amp-img').each((_, e) => {
e = $(e);
e.replaceWith(`<img src="${new URL(e.attr('src'), response.url).href}" width="${e.attr('width')}" height="${e.attr('height')}" decoding="async">`);
e.replaceWith(`<img src="${new URL(e.attr('src'), item.link).href}" width="${e.attr('width')}" height="${e.attr('height')}" decoding="async">`);
});
$('amp-video').each((_, e) => {
e = $(e);
Expand Down
7 changes: 5 additions & 2 deletions lib/routes/gcores/category.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = `<img src="https://image.gcores.com/${articleData.attributes.cover}" />`;
Expand Down Expand Up @@ -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 };
Expand Down
23 changes: 18 additions & 5 deletions lib/routes/picnob/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}/`;

Expand All @@ -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;
}
Expand Down Expand Up @@ -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'),
Expand Down

0 comments on commit 3fbe6df

Please sign in to comment.