fix(route): picnob. Change source to 'pixwox.com'. (#15180)

This commit is contained in:
MichealDeath 2024-04-10 18:31:02 +08:00 committed by GitHub
parent a0ea082fad
commit 049cb18153
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 18 additions and 5 deletions

View File

@ -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'),