mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat(route): add 旅法师营地用户的帖子 (#7397)
Co-authored-by: auto-bot-ty <auto-bot-ty@git@com>
This commit is contained in:
co-authored by
auto-bot-ty
parent
cffbf904bc
commit
978dc93f08
@@ -2986,4 +2986,29 @@
|
||||
},
|
||||
],
|
||||
},
|
||||
'iyingdi.com': {
|
||||
_name: '旅法师营地',
|
||||
www: [
|
||||
{
|
||||
title: '分区',
|
||||
docs: 'https://docs.rsshub.app/game.html#lv-fa-shi-ying-di',
|
||||
source: '/tz/tag/:tag',
|
||||
target: '/lfsyd/tag/:tag',
|
||||
},
|
||||
{
|
||||
title: '用户发帖',
|
||||
docs: 'https://docs.rsshub.app/game.html#lv-fa-shi-ying-di',
|
||||
source: ['/tz/people/:id', '/tz/people/:id/*'],
|
||||
target: '/lfsyd/user/:id',
|
||||
},
|
||||
],
|
||||
mob: [
|
||||
{
|
||||
title: '分区',
|
||||
docs: 'https://docs.rsshub.app/game.html#lv-fa-shi-ying-di',
|
||||
source: '/fine/:tag',
|
||||
target: '/lfsyd/tag/:tag',
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
+17
-23
@@ -183,9 +183,9 @@ pageClass: routes
|
||||
|
||||
支持的主机平台:
|
||||
|
||||
| PS 4 | Xbox One | Switch | PC | Wii U | 3DS | PS Vita | iOS |
|
||||
| ---- | -------- | ------ | -- | ----- | --- | ------- | --- |
|
||||
| ps4 | xboxone | switch | pc | wii-u | 3ds | vita | ios |
|
||||
| PS 4 | Xbox One | Switch | PC | Wii U | 3DS | PS Vita | iOS |
|
||||
| ---- | -------- | ------ | --- | ----- | --- | ------- | --- |
|
||||
| ps4 | xboxone | switch | pc | wii-u | 3ds | vita | ios |
|
||||
|
||||
发行类型,默认为 `new`:
|
||||
|
||||
@@ -392,9 +392,9 @@ Example: `https://store.steampowered.com/search/?specials=1&term=atelier` 中的
|
||||
|
||||
<Route author="Arracc" example="/gamer/gnn/1" path="/gamer/gnn/:category?" :paramsDesc="['版块']">
|
||||
|
||||
| 首頁 | PC | TV 掌機 | 手機遊戲 | 動漫畫 | 主題報導 | 活動展覽 | 電競 |
|
||||
| ---- | -- | ------- | -------- | ------ | -------- | -------- | ---- |
|
||||
| 缺省 | 1 | 3 | 4 | 5 | 9 | 11 | 13 |
|
||||
| 首頁 | PC | TV 掌機 | 手機遊戲 | 動漫畫 | 主題報導 | 活動展覽 | 電競 |
|
||||
| ---- | --- | ------- | -------- | ------ | -------- | -------- | ---- |
|
||||
| 缺省 | 1 | 3 | 4 | 5 | 9 | 11 | 13 |
|
||||
|
||||
| Switch | PS5 | PS4 | XboxOne | XboxSX | PC 單機 | PC 線上 | iOS | Android | Web | 漫畫 | 動畫 |
|
||||
| ------ | --- | --- | ------- | ------ | ------- | ------- | --- | ------- | --- | ----- | ----- |
|
||||
@@ -456,34 +456,28 @@ Example: `https://store.steampowered.com/search/?specials=1&term=atelier` 中的
|
||||
|
||||
## 旅法师营地
|
||||
|
||||
### 旅法师营地
|
||||
|
||||
<Route author="qwertyuiop6" example="/lfsyd/1" path="/lfsyd/:typecode" :paramsDesc="['订阅分区类型']">
|
||||
|
||||
| 主页资讯 | 炉石传说 | 万智牌 | 昆特牌 | 游戏王 | 电子游戏 | 手机游戏 | 桌面游戏 |
|
||||
| -------- | -------- | ------ | ------ | ------ | -------- | -------- | -------- |
|
||||
| 1 | 2 | 3 | 14 | 16 | 4 | 22 | 9 |
|
||||
|
||||
| 影之诗 | Artifact | 玩家杂谈 | 营地电台 | 2047 | 魂武 |
|
||||
| ------ | -------- | -------- | -------- | ---- | ---- |
|
||||
| 17 | 67 | 21 | 5 | 62 | 68 |
|
||||
|
||||
</Route>
|
||||
|
||||
### 分区
|
||||
|
||||
<Route author="auto-bot-ty" example="/lfsyd/tag/17" path="/lfsyd/tag/:tag" :paramsDesc="['订阅分区类型']">
|
||||
<Route author="auto-bot-ty" example="/lfsyd/tag/17" path="/lfsyd/tag/:tag" :paramsDesc="['订阅分区类型']" radar="1" rssbud="1">
|
||||
|
||||
| 炉石传说 | 万智牌 | 游戏王 | 昆特牌 | 影之诗 | 符文之地传奇 | 阴阳师百闻牌 |
|
||||
| :------: | :----: | :----: | :----: | :----: | :----------: | :----------: |
|
||||
| 17 | 18 | 16 | 19 | 20 | 329 | 221 |
|
||||
| 17 | 18 | 16 | 19 | 20 | 329 | 221 |
|
||||
|
||||
| 英雄联盟 | 电子游戏 | 桌面游戏 | 卡牌游戏 | 玩家杂谈 | 二次元 |
|
||||
| :------: | :------: | :------: | :------: | :------: | :----: |
|
||||
| 112 | 389 | 24 | 102 | 23 | 117 |
|
||||
| 112 | 389 | 24 | 102 | 23 | 117 |
|
||||
|
||||
</Route>
|
||||
|
||||
### 用户的帖子
|
||||
|
||||
<Route author="auto-bot-ty" example="/lfsyd/user/55547" path="/lfsyd/user/:id" :paramsDesc="['用户 id']" radar="1" rssbud="1"/>
|
||||
|
||||
可以在用户主页的 URL 中找到
|
||||
|
||||
Example:`https://www.iyingdi.com/tz/people/55547` ,id 是 `55547`
|
||||
|
||||
## 米哈游
|
||||
|
||||
### 崩坏 2 - 游戏公告
|
||||
|
||||
@@ -346,6 +346,7 @@ router.get('/3dm/news', require('./routes/3dm/news_center'));
|
||||
|
||||
// 旅法师营地
|
||||
router.get('/lfsyd/:typecode', require('./routes/lfsyd/index'));
|
||||
router.get('/lfsyd/user/:id', require('./routes/lfsyd/user'));
|
||||
router.get('/lfsyd/tag/:tag', require('./routes/lfsyd/tag'));
|
||||
|
||||
// 喜马拉雅
|
||||
|
||||
+10
-11
@@ -1,11 +1,10 @@
|
||||
const got = require('@/utils/got');
|
||||
const util = require('./utils');
|
||||
const timezone = require('@/utils/timezone');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const tag_id = ctx.params.tag;
|
||||
const tag_list = {
|
||||
const tagId = ctx.params.tag;
|
||||
const tagList = {
|
||||
17: '炉石传说',
|
||||
18: '万智牌',
|
||||
16: '游戏王',
|
||||
@@ -20,13 +19,13 @@ module.exports = async (ctx) => {
|
||||
23: '玩家杂谈',
|
||||
117: '二次元',
|
||||
};
|
||||
const tag_name = tag_list[tag_id];
|
||||
const tagName = tagList[tagId];
|
||||
const rootUrl = 'https://www.iyingdi.com';
|
||||
const tagUrl = 'https://api.iyingdi.com/web/feed/tag-content-list';
|
||||
const form = {
|
||||
page: 1,
|
||||
size: 30,
|
||||
tag_id: tag_id,
|
||||
tag_id: tagId,
|
||||
timestamp: '',
|
||||
version: 0,
|
||||
};
|
||||
@@ -44,22 +43,22 @@ module.exports = async (ctx) => {
|
||||
form: util.getForm(form),
|
||||
});
|
||||
const list = response.data.list;
|
||||
const tag_json = JSON.parse(list[0].feed.tag_json);
|
||||
const tagJson = JSON.parse(list[0].feed.tag_json);
|
||||
|
||||
const articleList = list.map((item) => ({
|
||||
title: item.feed.title,
|
||||
pubDate: timezone(parseDate(item.feed.show_time * 1000), +8),
|
||||
pubDate: parseDate(item.feed.show_time * 1000),
|
||||
link: `${rootUrl}/tz/post/${item.feed.source_id}`,
|
||||
guid: item.feed.title,
|
||||
post_id: item.feed.source_id,
|
||||
postId: item.feed.source_id,
|
||||
}));
|
||||
|
||||
const items = await Promise.all(articleList.map(async (item) => await util.ProcessFeed(ctx, item)));
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${!tag_name ? tag_json[0].tag : tag_name} - 旅法师营地 `,
|
||||
link: `${rootUrl}/tz/tag/${tag_id}`,
|
||||
description: `${!tag_name ? tag_json[0].tag : tag_name} - 旅法师营地 `,
|
||||
title: `${!tagName ? tagJson[0].tag : tagName} - 旅法师营地 `,
|
||||
link: `${rootUrl}/tz/tag/${tagId}`,
|
||||
description: `${!tagName ? tagJson[0].tag : tagName} - 旅法师营地 `,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
const got = require('@/utils/got');
|
||||
const util = require('./utils');
|
||||
const { parseDate } = require('@/utils/parse-date');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
const rootUrl = 'https://www.iyingdi.com';
|
||||
const listUrl = 'https://api.iyingdi.com/web/user/event-list';
|
||||
const form = {
|
||||
event_types: 'content',
|
||||
page: 1,
|
||||
size: 15,
|
||||
timestamp: '',
|
||||
user_id: id,
|
||||
};
|
||||
|
||||
const response = await got({
|
||||
method: 'post',
|
||||
url: listUrl,
|
||||
headers: {
|
||||
Host: 'api.iyingdi.com',
|
||||
'Login-Token': 'nologin',
|
||||
Origin: rootUrl,
|
||||
Platform: 'pc',
|
||||
Referer: `${rootUrl}/tz/people/${id}/postList`,
|
||||
},
|
||||
form: util.getForm(form),
|
||||
});
|
||||
const list = response.data.data;
|
||||
const nickname = list[0].author.nickname;
|
||||
|
||||
const articleList = list.map((item) => ({
|
||||
title: item.event_data.title,
|
||||
pubDate: parseDate(item.event_data.show_time * 1000),
|
||||
link: `${rootUrl}/tz/post/${item.event_data.post_id}`,
|
||||
guid: item.event_data.title,
|
||||
postId: item.event_data.post_id,
|
||||
}));
|
||||
|
||||
const items = await Promise.all(articleList.map(async (item) => await util.ProcessFeed(ctx, item)));
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${nickname} - 旅法师营地 `,
|
||||
link: `${rootUrl}/tz/people/${id}`,
|
||||
description: `${nickname} - 旅法师营地`,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
+42
-12
@@ -1,14 +1,14 @@
|
||||
const cheerio = require('cheerio');
|
||||
const got = require('@/utils/got');
|
||||
const md5 = require('@/utils/md5');
|
||||
|
||||
const rootUrl = 'https://www.iyingdi.com';
|
||||
const ProcessFeed = async (ctx, item) => {
|
||||
const infoUrL = 'https://api.iyingdi.com/web/post/info';
|
||||
const rootUrl = 'https://www.iyingdi.com';
|
||||
const info_form = {
|
||||
post_id: item.post_id,
|
||||
const infoForm = {
|
||||
post_id: item.postId,
|
||||
timestamp: '',
|
||||
};
|
||||
|
||||
const description = await ctx.cache.tryGet(item.link, async () => {
|
||||
const response = await got({
|
||||
method: 'post',
|
||||
@@ -20,25 +20,55 @@ const ProcessFeed = async (ctx, item) => {
|
||||
Platform: 'pc',
|
||||
Referer: `${rootUrl}/`,
|
||||
},
|
||||
form: getForm(info_form),
|
||||
form: getForm(infoForm),
|
||||
});
|
||||
const content_body = JSON.parse(response.body);
|
||||
return content_body.post.content;
|
||||
return cleanHtml(JSON.parse(response.body).post.content);
|
||||
});
|
||||
|
||||
item.description = description;
|
||||
delete item.post_id;
|
||||
delete item.postId;
|
||||
return item;
|
||||
};
|
||||
|
||||
const getForm = function (form) {
|
||||
const key = 'b8d5b38577b8bb382b0c783b474b95f9';
|
||||
const getForm = function (form, type) {
|
||||
const key = type ? '8a11ed3712b699e749185674f1dc20b4' : 'b8d5b38577b8bb382b0c783b474b95f9';
|
||||
form.key = key;
|
||||
form.timestamp = Math.floor(new Date().getTime() / 1000);
|
||||
form.sign = md5(new URLSearchParams(form).toString());
|
||||
delete form.key;
|
||||
return form;
|
||||
};
|
||||
|
||||
const cleanHtml = function (htmlString) {
|
||||
const regex = new RegExp('(<p>|<div>)(.*?)?<strong>(标准|狂野)日报投稿.*?</strong>(.*?)?(</p>|</div>)(.|\n)*$');
|
||||
const $ = cheerio.load(htmlString.replace(regex, ''));
|
||||
$('.yingdi-car,.bbspost,.deck-set').each(function (i, e) {
|
||||
const className = $(e).attr('class');
|
||||
const dataId = $(e).attr('data-id');
|
||||
const decksUrl = `${rootUrl}/web/tools/hearthstone/decks/setdetail?setid=${dataId}`;
|
||||
const url = className === 'yingdi-card bbspost' ? `${rootUrl}/tz/post/${dataId}` : decksUrl;
|
||||
$(e).find('.card-status').remove();
|
||||
$(e).find('.card-info').wrap(`<a href = "${url}"></a>`);
|
||||
});
|
||||
|
||||
$('.yingdi-image.gif').each(function (i, e) {
|
||||
const imgsrc = $(e).attr('data-original');
|
||||
$(e).attr('src', imgsrc);
|
||||
});
|
||||
|
||||
$('.yingdi-audio').each(function (i, e) {
|
||||
$(e).find('.audio-cover').remove();
|
||||
$(e).find('.audio-area.hidden').attr('class', 'audio-area');
|
||||
});
|
||||
|
||||
// 用户头像
|
||||
$('.yingdi-card.user').remove();
|
||||
// 套牌代码复制
|
||||
$('.action-button').remove();
|
||||
// 投票
|
||||
$('.yingdi-ballot').remove();
|
||||
$('hr').remove();
|
||||
return $.html();
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
getForm,
|
||||
ProcessFeed,
|
||||
|
||||
Reference in New Issue
Block a user