mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-15 01:30:33 +08:00
feat(route): add s-hentai (#8146)
This commit is contained in:
@@ -122,6 +122,18 @@ Refer to [Pornhub F.A.Qs](https://help.pornhub.com/hc/en-us/articles/36004432703
|
|||||||
- `cn` (Chinese), for Pornhub in China <https://cn.pornhub.com/>;
|
- `cn` (Chinese), for Pornhub in China <https://cn.pornhub.com/>;
|
||||||
- `jp` (Japanese), for Pornhub in Japan <https://jp.pornhub.com/> etc.
|
- `jp` (Japanese), for Pornhub in Japan <https://jp.pornhub.com/> etc.
|
||||||
|
|
||||||
|
## s-hentai
|
||||||
|
|
||||||
|
### Category
|
||||||
|
|
||||||
|
<RouteEn author="nczitzk" example="/s-hentai" path="/hentai/:id?" :paramsDesc="['id, see below, ready-to-download by default']">
|
||||||
|
|
||||||
|
| Doujin | HCG | Games・Animes | Voices・ASMR | Ready to Download |
|
||||||
|
| ------ | --- | ------------- | ------------ | ----------------- |
|
||||||
|
| 1 | 2 | 3 | 4 | ready-to-download |
|
||||||
|
|
||||||
|
</RouteEn>
|
||||||
|
|
||||||
## Sankaku Complex
|
## Sankaku Complex
|
||||||
|
|
||||||
### Post
|
### Post
|
||||||
|
|||||||
@@ -628,6 +628,18 @@ pageClass: routes
|
|||||||
|
|
||||||
<Route author="monner-henster" example="/rs05/rs05" path="/rs05/rs05"/>
|
<Route author="monner-henster" example="/rs05/rs05" path="/rs05/rs05"/>
|
||||||
|
|
||||||
|
## s-hentai
|
||||||
|
|
||||||
|
### Category
|
||||||
|
|
||||||
|
<Route author="nczitzk" example="/s-hentai" path="/s-hentai/:id?" :paramsDesc="['id,见下表,默认为 ready-to-download']">
|
||||||
|
|
||||||
|
| Doujin | HCG | Games・Animes | Voices・ASMR | Ready to Download |
|
||||||
|
| ------ | --- | ------------- | ------------ | ----------------- |
|
||||||
|
| 1 | 2 | 3 | 4 | ready-to-download |
|
||||||
|
|
||||||
|
</Route>
|
||||||
|
|
||||||
## Sankaku Complex
|
## Sankaku Complex
|
||||||
|
|
||||||
### Post
|
### Post
|
||||||
|
|||||||
@@ -4246,4 +4246,7 @@ router.get('/biodiscover/:channel?', lazyloadRouteHandler('./routes/biodiscover'
|
|||||||
// 香港經濟日報
|
// 香港經濟日報
|
||||||
router.get('/hket/:category?', lazyloadRouteHandler('./routes/hket/index'));
|
router.get('/hket/:category?', lazyloadRouteHandler('./routes/hket/index'));
|
||||||
|
|
||||||
|
// s-hentai
|
||||||
|
router.get('/s-hentai/:id?', lazyloadRouteHandler('./routes/s-hentai'));
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|||||||
64
lib/routes/s-hentai/index.js
Normal file
64
lib/routes/s-hentai/index.js
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
const got = require('@/utils/got');
|
||||||
|
const cheerio = require('cheerio');
|
||||||
|
const { parseDate } = require('@/utils/parse-date');
|
||||||
|
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const id = ctx.params.id || 'ready-to-download';
|
||||||
|
|
||||||
|
const rootUrl = 'https://s-hentai.org';
|
||||||
|
const currentUrl = `${rootUrl}/${id === 'ready-to-download' ? id : `menu/${id}`}`;
|
||||||
|
|
||||||
|
const response = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: currentUrl,
|
||||||
|
});
|
||||||
|
|
||||||
|
const $ = cheerio.load(response.data);
|
||||||
|
|
||||||
|
const list = $('.block-product')
|
||||||
|
.slice(0, ctx.query.limit ? parseInt(ctx.query.limit) : 20)
|
||||||
|
.map((_, item) => {
|
||||||
|
item = $(item);
|
||||||
|
|
||||||
|
const a = item.find('.name-product a');
|
||||||
|
|
||||||
|
return {
|
||||||
|
title: a.text(),
|
||||||
|
link: a.attr('href'),
|
||||||
|
pubDate: parseDate(item.find('.post-date').text().trim().split(' ')[0], 'YYYY年MM月DD日'),
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.get();
|
||||||
|
|
||||||
|
const items = await Promise.all(
|
||||||
|
list.map((item) =>
|
||||||
|
ctx.cache.tryGet(item.link, async () => {
|
||||||
|
const detailResponse = await got({
|
||||||
|
method: 'get',
|
||||||
|
url: item.link,
|
||||||
|
});
|
||||||
|
|
||||||
|
const content = cheerio.load(detailResponse.data);
|
||||||
|
|
||||||
|
const images = content('#sync1');
|
||||||
|
const description = content('#description-deital');
|
||||||
|
|
||||||
|
content('.single-support').remove();
|
||||||
|
|
||||||
|
item.enclosure_url = content('.file-download-comment a').eq(0).attr('href');
|
||||||
|
item.enclosure_type = 'application/x-bittorrent';
|
||||||
|
|
||||||
|
item.description = (images ? images.html() : '') + content('.detial-short').html() + (description ? description.html() : '');
|
||||||
|
item.category = detailResponse.data.match(/<a href="https:\/\/s-hentai\.org\/category\/\d+">(.*)<\/a>/g).map((category) => category.match(/>(.*)</)[1]);
|
||||||
|
|
||||||
|
return item;
|
||||||
|
})
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: `${$('title').text().trim().split('|')[0]} | S-HENTAI.ORG`,
|
||||||
|
link: currentUrl,
|
||||||
|
item: items,
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user