parent
7be82ccdd0
commit
c9e423b8f1
|
|
@ -30,6 +30,16 @@ Full transcript support for better user experience.
|
|||
|
||||
<RouteEn author="nczitzk" example="/bandcamp/live" path="/bandcamp/live"/>
|
||||
|
||||
## Coomer
|
||||
|
||||
### Artist
|
||||
|
||||
<RouteEn author="nczitzk" example="/coomer/artist/belledelphine" path="/coomer/artist/:id" :paramsDesc="['Artist id, can be found in URL']"/>
|
||||
|
||||
### Recent Posts
|
||||
|
||||
<RouteEn author="nczitzk" example="/coomer/posts" path="/coomer/posts"/>
|
||||
|
||||
## EZTV
|
||||
|
||||
::: tip
|
||||
|
|
|
|||
|
|
@ -303,6 +303,16 @@ BT 之家的域名会变更,本路由以 <https://www.btbtt20.com> 为默认
|
|||
|
||||
</Route>
|
||||
|
||||
## Coomer
|
||||
|
||||
### Artist
|
||||
|
||||
<Route author="nczitzk" example="/coomer/artist/belledelphine" path="/coomer/artist/:id" :paramsDesc="['Artist id,可在对应页面中找到']"/>
|
||||
|
||||
### Recent Posts
|
||||
|
||||
<Route author="nczitzk" example="/coomer/posts" path="/coomer/posts"/>
|
||||
|
||||
## E-Hentai
|
||||
|
||||
### 分类
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
const fetchItems = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
|
||||
const currentUrl = `onlyfans/user/${id}`;
|
||||
|
||||
ctx.state.data = await fetchItems(ctx, currentUrl);
|
||||
};
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
module.exports = {
|
||||
'/artist/:id': ['nczitzk'],
|
||||
'/posts': ['nczitzk'],
|
||||
};
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
const fetchItems = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const currentUrl = 'posts';
|
||||
|
||||
ctx.state.data = await fetchItems(ctx, currentUrl);
|
||||
};
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
module.exports = {
|
||||
'coomer.party': {
|
||||
_name: 'Coomer',
|
||||
'.': [
|
||||
{
|
||||
title: 'Artist',
|
||||
docs: 'https://docs.rsshub.app/multimedia.html#coomer-artist',
|
||||
source: ['/onlyfans/user/:id', '/'],
|
||||
target: '/coomer/artist/:id',
|
||||
},
|
||||
{
|
||||
title: 'Recent Posts',
|
||||
docs: 'https://docs.rsshub.app/multimedia.html#coomer-recent-posts',
|
||||
source: ['/posts', '/'],
|
||||
target: '/coomer/posts',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
module.exports = function (router) {
|
||||
router.get('/artist/:id', require('./artist'));
|
||||
router.get('/posts', require('./posts'));
|
||||
};
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx, currentUrl) => {
|
||||
const rootUrl = 'https://coomer.party';
|
||||
currentUrl = `${rootUrl}/${currentUrl}`;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
let items = $('.post-card__link .fancy-link')
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
item = $(item);
|
||||
|
||||
return {
|
||||
link: `${rootUrl}${item.attr('href')}`,
|
||||
};
|
||||
});
|
||||
|
||||
items = await Promise.all(
|
||||
items.map((item) =>
|
||||
ctx.cache.tryGet(item.link, async () => {
|
||||
const detailResponse = await got({
|
||||
method: 'get',
|
||||
url: item.link,
|
||||
});
|
||||
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
|
||||
content('.ad-container').remove();
|
||||
|
||||
item.author = content('.post__user-name').text();
|
||||
item.title = content('.post__title span').first().text();
|
||||
item.pubDate = parseDate(content('.timestamp').attr('datetime'));
|
||||
item.description = content('.post__body').html();
|
||||
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
return {
|
||||
title: $('title').text(),
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue