mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat(route): iwara用户订阅列表 (#10517)
* feat(route): iwara用户订阅列表 * Update Error message in iwara subscription Co-authored-by: FeCCC <964575805@qq.com>
This commit is contained in:
@@ -327,6 +327,18 @@ pageClass: routes
|
||||
|
||||
</Route>
|
||||
|
||||
### 用户订阅列表
|
||||
|
||||
<Route author="FeCCC" example="/iwara/subscriptions" path="/iwara/subscriptions" radar="1" rssbud="1" selfhost="1">
|
||||
|
||||
::: warning 注意
|
||||
|
||||
用户动态需要 iwara 登录后的 Cookie 值,所以只能自建,详情见[部署页面](/install/#route-specific-configurations)的配置模块。
|
||||
|
||||
:::
|
||||
|
||||
</Route>
|
||||
|
||||
## Kemono
|
||||
|
||||
### Posts
|
||||
|
||||
@@ -36,6 +36,18 @@ For more tags, please go to [Search torrent](https://bangumi.moe/search/index)
|
||||
|
||||
</RouteEn>
|
||||
|
||||
### User Subscriptions
|
||||
|
||||
<RouteEn author="FeCCC" example="/iwara/subscriptions" path="/iwara/subscriptions" radar="1" rssbud="1" selfhost="1">
|
||||
|
||||
::: warning
|
||||
|
||||
This route requires Cookie, therefore it's only available when self-hosting, refer to the [Deploy Guide](/en/install/#route-specific-configurations) for route-specific configurations.
|
||||
|
||||
:::
|
||||
|
||||
</RouteEn>
|
||||
|
||||
## Kemono
|
||||
|
||||
### Posts
|
||||
|
||||
@@ -626,6 +626,10 @@ See docs of the specified route and `lib/config.js` for detailed information.
|
||||
|
||||
Warning: Two Factor Authentication is **not** supported.
|
||||
|
||||
- Iwara:
|
||||
|
||||
- `IWARA_COOKIE`: Cookie of Iwara User
|
||||
|
||||
- Last.fm
|
||||
|
||||
- `LASTFM_API_KEY`: Last.fm API Key
|
||||
|
||||
@@ -663,6 +663,10 @@ RSSHub 支持使用访问密钥 / 码,白名单和黑名单三种方式进行
|
||||
|
||||
注意,暂**不支持**两步验证。
|
||||
|
||||
- Iwara:
|
||||
|
||||
- `IWARA_COOKIE`: Iwara 登录后的 Cookie 值
|
||||
|
||||
- Last.fm 全部路由:[申请地址](https://www.last.fm/api/)
|
||||
|
||||
- `LASTFM_API_KEY`: Last.fm API Key
|
||||
|
||||
@@ -178,6 +178,9 @@ const calculateValue = () => {
|
||||
password: envs.IG_PASSWORD,
|
||||
proxy: envs.IG_PROXY,
|
||||
},
|
||||
iwara: {
|
||||
cookie: envs.IWARA_COOKIE,
|
||||
},
|
||||
lastfm: {
|
||||
api_key: envs.LASTFM_API_KEY,
|
||||
},
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
module.exports = {
|
||||
'/users/:username?/:type?': ['Fatpandac'],
|
||||
'/subscriptions': ['FeCCC'],
|
||||
};
|
||||
|
||||
@@ -14,6 +14,12 @@ module.exports = {
|
||||
source: '/users/:username',
|
||||
target: '/iwara/users/:username?/image',
|
||||
},
|
||||
{
|
||||
title: '用户订阅列表',
|
||||
docs: 'https://docs.rsshub.app/anime.html#iwara',
|
||||
source: '',
|
||||
target: '/iwara/subscriptions',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
module.exports = function (router) {
|
||||
router.get('/users/:username?/:type?', require('./index'));
|
||||
router.get('/subscriptions', require('./subscriptions'));
|
||||
};
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
const got = require('@/utils/got');
|
||||
const config = require('@/config').value;
|
||||
const cheerio = require('cheerio');
|
||||
const { art } = require('@/utils/render');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const rootUrl = `https://ecchi.iwara.tv/subscriptions`;
|
||||
const cookie = config.iwara.cookie;
|
||||
|
||||
if (cookie === undefined) {
|
||||
throw Error('Iwara subscription RSS is disabled due to the lack of <a href="https://docs.rsshub.app/install/#pei-zhi-bu-fen-rss-mo-kuai-pei-zhi">relevant config</a>');
|
||||
}
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: rootUrl,
|
||||
headers: {
|
||||
Cookie: cookie,
|
||||
},
|
||||
});
|
||||
const $ = cheerio.load(response.data);
|
||||
const username = $('a.btn.btn-info.btn-sm.user').text().trim();
|
||||
const list = $('div.views-column');
|
||||
|
||||
const items = list
|
||||
.map((_, item) => {
|
||||
const imageUrl = 'https:' + $(item).find('img').attr('src');
|
||||
const type = $(item).find('div.field').hasClass('field-type-video') ? 'Video' : 'Image';
|
||||
return {
|
||||
title: $(item).find('h3.title').text(),
|
||||
author: username,
|
||||
link: rootUrl + $(item).find('h3.title > a').attr('href'),
|
||||
category: type,
|
||||
description: art(path.join(__dirname, 'templates/subscriptions.art'), {
|
||||
type,
|
||||
imageUrl,
|
||||
}),
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${username}'s iwara Subscription`,
|
||||
link: rootUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
<h3>{{ type }}</h3><br><img src="{{ imageUrl }}">
|
||||
Reference in New Issue
Block a user