Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(route): 轻之国度 文章更新阅读 #11848 #13938

Merged
merged 28 commits into from
Dec 10, 2023
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
a7c14f7
add router 关于bilibili票务
nightmare-mio Nov 24, 2023
30ba3ad
bilibili票务基础模板
nightmare-mio Nov 24, 2023
b1bff9b
add bilibili会员购票务 maintainer
nightmare-mio Nov 24, 2023
259c69b
add cookie
nightmare-mio Nov 24, 2023
9fb0296
doc文档,radar
nightmare-mio Nov 24, 2023
15055b8
add 补充内容
nightmare-mio Nov 24, 2023
0993eb4
修改doc条目顺序,优化代码
nightmare-mio Nov 25, 2023
69116ef
fix:修复doc文旦错误,移除作者备注
nightmare-mio Nov 25, 2023
1c1f1f4
fix: delete radar.js中的多余文字
nightmare-mio Nov 25, 2023
fcd385e
fix: 修复错误
nightmare-mio Nov 25, 2023
d7f7f0e
Merge branch 'DIYgod:master' into master
nightmare-mio Nov 27, 2023
80fbe80
开坑,轻之国度。
nightmare-mio Nov 27, 2023
89593dc
轻之国度,主体完成
nightmare-mio Nov 29, 2023
b6141c9
fix: router.js
nightmare-mio Nov 29, 2023
fa17505
Merge branch 'DIYgod:master' into master
nightmare-mio Nov 30, 2023
9781e13
添加文章正文内容
nightmare-mio Dec 1, 2023
a0ab697
Merge branch 'master' of https://github.com/nightmare-mio/RSSHub
nightmare-mio Dec 1, 2023
1defb84
文档补全
nightmare-mio Dec 1, 2023
1123b4c
cookie可从环境变量赋值
nightmare-mio Dec 1, 2023
2eefd11
fix:补充说明
nightmare-mio Dec 1, 2023
d979fa7
fix:补充说明
nightmare-mio Dec 1, 2023
f8f1c1c
fix:puppeteer浏览器没有关闭的问题
nightmare-mio Dec 3, 2023
55f58e2
fix: 作者名字写错了
nightmare-mio Dec 3, 2023
2c0d330
fix: delete tpye in route,modify case
nightmare-mio Dec 7, 2023
86c458f
fix: puppeteer change to got
nightmare-mio Dec 7, 2023
bf4d95d
fix:remove collctions and puppeteer
nightmare-mio Dec 9, 2023
44bc76c
fix: add cookie doc
nightmare-mio Dec 9, 2023
3f66a7a
fix: website can not run beacuse '
nightmare-mio Dec 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@ const calculateValue = () => {
lastfm: {
api_key: envs.LASTFM_API_KEY,
},
lightnovel: {
cookie: envs.SECURIT_KEY,
nightmare-mio marked this conversation as resolved.
Show resolved Hide resolved
},
manhuagui: {
cookie: envs.MHGUI_COOKIE,
},
Expand Down
59 changes: 59 additions & 0 deletions lib/v2/lightnovel/lightNovel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
const { parseDate } = require('@/utils/parse-date');
const got = require('@/utils/got');
const cheerio = require('cheerio');
const config = require('@/config').value;

module.exports = async (ctx) => {
const baseUrl = 'https://www.lightnovel.us';
const { type, keywords, security_key = config.lightNovel.cookie } = ctx.params;
const { data: response } = await got({
method: 'POST',
url: `${baseUrl}/proxy/api/search/search-result`,
headers: {
// 此处是为什么
'User-Agent': config.trueUA,
},
json: {
is_encrypted: 0,
platform: 'pc',
client: 'web',
sign: '',
gz: 0,
d: {
q: keywords,
type: 0,
page: 1,
security_key,
},
},
});
const list = response.data.articles
?.map((item) => ({
nightmare-mio marked this conversation as resolved.
Show resolved Hide resolved
title: item.title,
link: `${baseUrl}/cn/detail/${item.aid}`,
pubDate: parseDate(item.time),
author: item.author,
}))
.slice(0, ctx.query.limit ? parseInt(ctx.query.limit) : 5);

const items = await Promise.all(
list.map((item) =>
ctx.cache.tryGet(item.link, async () => {
const { data: response } = await got({
method: 'GET',
url: item.link,
});
nightmare-mio marked this conversation as resolved.
Show resolved Hide resolved

const $ = cheerio.load(response);
item.description = $('#article-main-contents').html();
return item;
})
)
);

ctx.state.data = {
title: `轻之国度-追踪${keywords}更新-${type} `,
link: baseUrl,
item: items,
};
};
3 changes: 3 additions & 0 deletions lib/v2/lightnovel/maintainer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
'/:keywords/:security_key': ['nightmare-mio'],
nightmare-mio marked this conversation as resolved.
Show resolved Hide resolved
};
13 changes: 13 additions & 0 deletions lib/v2/lightnovel/radar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
'lightNovel.us': {
_name: '轻之国度',
'.': [
{
title: '文章更新阅读',
docs: 'https://docs.rsshub.app/routes/annime#wen-zhang-geng-xing-yue-du',
nightmare-mio marked this conversation as resolved.
Show resolved Hide resolved
source: '/',
target: '/lightNovel/:keywords/:security_key',
nightmare-mio marked this conversation as resolved.
Show resolved Hide resolved
},
],
},
};
3 changes: 3 additions & 0 deletions lib/v2/lightnovel/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = function (router) {
router.get('/:keywords/:security_key?', require('./lightNovel'));
};
6 changes: 6 additions & 0 deletions website/docs/routes/anime.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,12 @@ You can use some RSS parsing libraries (like `feedpraser` in `Python`) to receiv

<Route author="junfengP" path="/manxiaosi/book/:id" example="/manxiaosi/book/90" paramsDesc={['漫画id,漫画主页的地址栏中']} radar="1" rssbud="1"/>

## 轻之国度 {#qing-zhi-guo-du}

### 文章更新阅读 {#wen-zhang-geng-xing-yue-du}

<Route author="nightmare-mio" path="/lightnovel/:keywords/:security_key" example="/lightnovel/歡迎來到實力至上主義的教室/3cfc2dc63f3575ee42e12823188ad1b5:1709125:0" paramsDesc={['关键字,可以模糊匹配,但最好精确匹配。默认为文章类型','cookie,由于文章有防爬,所以必须携带cookie请求。route中的cookie优先级高于环境变量cookie,取token中的security_key值']} radar="1" rssbud="1"/>
nightmare-mio marked this conversation as resolved.
Show resolved Hide resolved

## 三界异次元 {#san-jie-yi-ci-yuan}

### 三界异次元 {#san-jie-yi-ci-yuan-san-jie-yi-ci-yuan}
Expand Down
Loading