mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-08 05:59:00 +08:00
feat: 掌上英雄联盟-推荐新闻 (#2511)
This commit is contained in:
@@ -253,6 +253,12 @@ Example: `https://store.steampowered.com/search/?specials=1&term=atelier` 中的
|
|||||||
|
|
||||||
</Route>
|
</Route>
|
||||||
|
|
||||||
|
## 掌上英雄联盟
|
||||||
|
|
||||||
|
### 推荐
|
||||||
|
|
||||||
|
<Route author="alizeegod" example="/lolapp/recommend" path="/lolapp/recommend"/>
|
||||||
|
|
||||||
## きららファンタジア|奇拉拉幻想曲
|
## きららファンタジア|奇拉拉幻想曲
|
||||||
|
|
||||||
### 公告
|
### 公告
|
||||||
|
|||||||
@@ -1449,4 +1449,7 @@ router.get('/lwn/alerts/:distributor', require('./routes/lwn/alerts'));
|
|||||||
// 唱吧
|
// 唱吧
|
||||||
router.get('/changba/:userid', require('./routes/changba/user'));
|
router.get('/changba/:userid', require('./routes/changba/user'));
|
||||||
|
|
||||||
|
// 掌上英雄联盟
|
||||||
|
router.get('/lolapp/recommend', require('./routes/lolapp/recommend'));
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|||||||
48
lib/routes/lolapp/recommend.js
Normal file
48
lib/routes/lolapp/recommend.js
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
const got = require('@/utils/got');
|
||||||
|
|
||||||
|
const sourceTimezoneOffset = -8;
|
||||||
|
module.exports = async (ctx) => {
|
||||||
|
const cid = 12;
|
||||||
|
const areaid = 2;
|
||||||
|
|
||||||
|
const url = 'http://qt.qq.com/lua/lol_news/recommend_refresh?cid=' + cid + '&plat=ios&version=9880&areaid=' + areaid;
|
||||||
|
const res = await got.get(url);
|
||||||
|
const articles = (res.data || {}).update_list || [];
|
||||||
|
const out = await Promise.all(
|
||||||
|
articles.map(async (article) => {
|
||||||
|
const link = article.article_url;
|
||||||
|
const cache = await ctx.cache.get(link);
|
||||||
|
if (cache) {
|
||||||
|
return JSON.parse(cache);
|
||||||
|
}
|
||||||
|
|
||||||
|
const guid = article.content_id;
|
||||||
|
const title = article.title;
|
||||||
|
const time = new Date(article.publication_date);
|
||||||
|
time.setTime(time.getTime() + (sourceTimezoneOffset - time.getTimezoneOffset() / 60) * 60 * 60 * 1000);
|
||||||
|
const pubDate = time.toUTCString();
|
||||||
|
|
||||||
|
// const detailJsonLink = article.detail_json;
|
||||||
|
// const detailRes = await got.get(detailJsonLink);
|
||||||
|
const description = article.image_url_big;
|
||||||
|
|
||||||
|
const item = {
|
||||||
|
title,
|
||||||
|
description,
|
||||||
|
pubDate,
|
||||||
|
link,
|
||||||
|
guid,
|
||||||
|
};
|
||||||
|
|
||||||
|
ctx.cache.set(link, JSON.stringify(item));
|
||||||
|
|
||||||
|
return item;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
ctx.state.data = {
|
||||||
|
title: '掌上英雄联盟 - 推荐',
|
||||||
|
link: 'http://lol.qq.com/app/index.html',
|
||||||
|
item: out,
|
||||||
|
};
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user