feat(route): picnob (#11988)
This commit is contained in:
parent
3c1aefc49f
commit
3c149b901c
|
|
@ -150,7 +150,7 @@ Type
|
|||
|
||||
Due to Instagram Private API restrictions, you have to setup your credentials on the server. 2FA is not supported. See [deployment guide](https://docs.rsshub.app/en/install/) for more.
|
||||
|
||||
If you don't want to setup credentials, you can use [Picuki](#picuki).
|
||||
If you don't want to setup credentials, you can use [Picnob](#picnob) or [Picuki](#picuki).
|
||||
|
||||
:::
|
||||
|
||||
|
|
@ -233,6 +233,12 @@ These feed do not include boosts (a.k.a. reblogs). RSSHub provides a feed for us
|
|||
|
||||
<RouteEn author="hoilc" example="/piapro/public/music/miku/2" path="/piapro/public/:type/:tag?/:category?" :paramsDesc="['work type, can be `music`,`illust`,`text`','`tag` parameter in url','category ID, `categoryId` parameter in url']"/>
|
||||
|
||||
## Picnob
|
||||
|
||||
### User Profile
|
||||
|
||||
<RouteEn author="TonyRL" example="/picnob/user/stefaniejoosten" path="/picuki/profile/:id" :paramsDesc="['Instagram id']" radar="1" rssbud="1" />
|
||||
|
||||
## Picuki
|
||||
|
||||
### User Profile
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
'/user/:id': ['TonyRL'],
|
||||
};
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
module.exports = {
|
||||
'picnob.com': {
|
||||
_name: 'Picnob',
|
||||
'.': [
|
||||
{
|
||||
title: 'User profile',
|
||||
docs: 'https://docs.rsshub.app/en/social-media.html#picnob',
|
||||
source: ['/profile/:id/*'],
|
||||
target: '/picnob/user/:id',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = (router) => {
|
||||
router.get('/user/:id', require('./user'));
|
||||
};
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
{{ if item.type === 'video' }}
|
||||
<video poster="{{ item.pic }}" controls>
|
||||
<source src="{{ item.video }}" type="video/mp4">
|
||||
</video>
|
||||
{{ else if item.type === 'img_multi' }}
|
||||
{{ each images i }}
|
||||
<a href="{{ i.ori }}"><img src="{{ i.url }}"></a>
|
||||
{{ /each }}
|
||||
{{ else if item.type === 'img_sig' }}
|
||||
<a href="{{ item.pic }}"><img src="{{ item.pic }}"></a>
|
||||
{{ /if }}
|
||||
<br>
|
||||
{{@ item.sum }}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
const { art } = require('@/utils/render');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const baseUrl = 'https://www.picnob.com';
|
||||
const { id } = ctx.params;
|
||||
const url = `${baseUrl}/profile/${id}/`;
|
||||
const { data: response } = await got(url);
|
||||
const $ = cheerio.load(response);
|
||||
|
||||
const profileName = $('h1.fullname').text();
|
||||
const userId = $('input[name=userid]').attr('value');
|
||||
|
||||
const { data } = await got(`${baseUrl}/api/posts`, {
|
||||
searchParams: {
|
||||
userid: userId,
|
||||
},
|
||||
});
|
||||
|
||||
const list = data.posts.items.map(async (item) => {
|
||||
const { shortcode, type } = item;
|
||||
const link = `${baseUrl}/post/${shortcode}/`;
|
||||
let images = [];
|
||||
if (type === 'img_multi') {
|
||||
images = await ctx.cache.tryGet(link, async () => {
|
||||
const { data } = await got(link);
|
||||
const $ = cheerio.load(data);
|
||||
return [
|
||||
...new Set(
|
||||
$('.post_slide a')
|
||||
.toArray()
|
||||
.map((a) => {
|
||||
a = $(a);
|
||||
return {
|
||||
ori: a.attr('href'),
|
||||
url: a.find('img').attr('data-src'),
|
||||
};
|
||||
})
|
||||
),
|
||||
];
|
||||
});
|
||||
}
|
||||
return {
|
||||
title: item.sum_pure,
|
||||
description: art(path.join(__dirname, 'templates/desc.art'), { item, images }),
|
||||
link,
|
||||
pubDate: parseDate(item.time, 'X'),
|
||||
};
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${profileName} (@${id}) - Picnob`,
|
||||
description: $('.info .sum').text(),
|
||||
link: url,
|
||||
image: $('.ava .pic img').attr('src'),
|
||||
item: list,
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue