mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-19 09:52:21 +08:00
add loveheaven
This commit is contained in:
@@ -61,6 +61,12 @@ For example:
|
||||
|
||||
</RouteEn>
|
||||
|
||||
## LoveHeaven
|
||||
|
||||
### Manga Updates
|
||||
|
||||
<RouteEn author="hoilc" example="/loveheaven/update/kimetsu-no-yaiba" path="/loveheaven/update/:slug" :paramsDesc="['Manga slug, can be found in URL, including neither `manga-` nor `.html`']" />
|
||||
|
||||
## nHentai
|
||||
|
||||
### Filter
|
||||
|
||||
@@ -79,6 +79,12 @@ pageClass: routes
|
||||
|
||||
</Route>
|
||||
|
||||
## LoveHeaven
|
||||
|
||||
### 漫画更新
|
||||
|
||||
<Route author="hoilc" example="/loveheaven/update/kimetsu-no-yaiba" path="/loveheaven/update/:slug" :paramsDesc="['漫画 slug,可在漫画页面URL中找到,不包括开头的`manga-`,也不包括末尾的`.html`']" />
|
||||
|
||||
## nHentai
|
||||
|
||||
### 分类筛选
|
||||
|
||||
@@ -2312,4 +2312,7 @@ router.get('/wolley/host/:host', require('./routes/wolley/host'));
|
||||
// 西安交大
|
||||
router.get('/xjtu/dean/:subpath+', require('./routes/universities/xjtu/dean'));
|
||||
|
||||
// LoveHeaven
|
||||
router.get('/loveheaven/update/:slug', require('./routes/loveheaven/update'));
|
||||
|
||||
module.exports = router;
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const chrono = require('chrono-node');
|
||||
|
||||
const base = 'https://loveheaven.net/';
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const slug = ctx.params.slug;
|
||||
|
||||
const url = `https://loveheaven.net/manga-${slug.replace(/^manga-/, '').replace(/\.html$/, '')}.html`;
|
||||
|
||||
const response = await got.get(url);
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const manga_name = $('.manga-info > h1').text();
|
||||
const manga_other_names = $('.manga-info > li:nth-child(3)').text();
|
||||
const manga_author = $('a.btn-info')
|
||||
.map(function() {
|
||||
return $(this).text();
|
||||
})
|
||||
.get()
|
||||
.join(', ');
|
||||
const manga_cover = $('img.thumbnail').attr('src');
|
||||
|
||||
const list = $('.tab-text .table > tbody > tr').get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${manga_name} - LoveHeaven`,
|
||||
description: manga_other_names,
|
||||
link: url,
|
||||
image: manga_cover,
|
||||
item: list.slice(0, 20).map((item) => {
|
||||
item = $(item);
|
||||
const entry = item.find('a');
|
||||
const humanized_date = item.find('time').text();
|
||||
return {
|
||||
title: entry.text(),
|
||||
author: manga_author,
|
||||
description: `<img src="${manga_cover}" style="max-width: 100%;">`,
|
||||
link: base + entry.attr('href'),
|
||||
pubDate: humanized_date ? chrono.parseDate(humanized_date) : new Date(),
|
||||
};
|
||||
}),
|
||||
};
|
||||
};
|
||||
@@ -65,6 +65,7 @@
|
||||
"aes-js": "3.1.2",
|
||||
"art-template": "4.13.2",
|
||||
"cheerio": "1.0.0-rc.3",
|
||||
"chrono-node": "1.4.3",
|
||||
"cloudscraper": "4.6.0",
|
||||
"co-redis": "2.1.1",
|
||||
"currency-symbol-map": "4.0.4",
|
||||
|
||||
Reference in New Issue
Block a user