mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
add iwara (#8735)
Co-authored-by: Tony <TonyRL@users.noreply.github.com> Co-authored-by: DIYgod <diy.d.god@gmail.com>
This commit is contained in:
@@ -253,6 +253,18 @@ pageClass: routes
|
||||
|
||||
</Route>
|
||||
|
||||
## iwara
|
||||
|
||||
### 用户
|
||||
|
||||
<Route author="Fatpandac" example="/iwara/users/kelpie/video" path="/iwara/users/:username/:type?" :paramsDesc="['用户昵称', 'type 默认为 video']" radar="1" rssbud="1">
|
||||
|
||||
| type | 视频 | 图片 |
|
||||
| :--: | :---: | :---: |
|
||||
| 参数 | video | image |
|
||||
|
||||
</Route>
|
||||
|
||||
## Kemono
|
||||
|
||||
### Posts
|
||||
|
||||
@@ -79,3 +79,15 @@ For example: https://www.webtoons.com/zh-hant/drama/gongzhuweimian/list?title_no
|
||||
### [Naver](https://comic.naver.com)
|
||||
|
||||
<RouteEn author="zfanta" example="/webtoons/naver/651673" path="/webtoons/naver/:titleId" :paramsDesc="['titleId of naver webtoon']" />
|
||||
|
||||
## iwara
|
||||
|
||||
### User
|
||||
|
||||
<RouteEn author="Fatpandac" example="/iwara/users/kelpie/video" path="/iwara/users/:username/:type?" :paramsDesc="['username, can find in userpage', 'video by default']" radar="1" rssbud="1">
|
||||
|
||||
| type | video | image |
|
||||
| :--: | :---: | :---: |
|
||||
| | video | image |
|
||||
|
||||
</RouteEn>
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
const rootUrl = 'https://ecchi.iwara.tv';
|
||||
|
||||
const typeMap = {
|
||||
video: 'Videos',
|
||||
image: 'Images',
|
||||
};
|
||||
|
||||
const selectorMap = {
|
||||
video: 'div.node.node-video.node-teaser.node-teaser.clearfix',
|
||||
image: 'div.node.node-image.node-teaser.node-teaser.clearfix',
|
||||
};
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const username = ctx.params.username;
|
||||
const type = ctx.params.type ?? 'video';
|
||||
const userUrl = `${rootUrl}/users/${username}`;
|
||||
|
||||
const response = await got.get(userUrl);
|
||||
const $ = cheerio.load(response.data);
|
||||
const list = $(selectorMap[type]);
|
||||
|
||||
const items = list
|
||||
.map((_, item) => {
|
||||
const imageUrl = 'https:' + $(item).find('img').attr('src');
|
||||
return {
|
||||
title: $(item).find('h3.title').text(),
|
||||
author: username,
|
||||
link: rootUrl + $(item).find('h3.title > a').attr('href'),
|
||||
description: `<img src="${imageUrl}">`,
|
||||
};
|
||||
})
|
||||
.get();
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${username}'s iwara - ${typeMap[type]}`,
|
||||
link: userUrl,
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
'/users/:username?/:type?': ['Fatpandac'],
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
module.exports = {
|
||||
'iwara.tv': {
|
||||
_name: 'iwara',
|
||||
ecchi: [
|
||||
{
|
||||
title: '用户视频',
|
||||
docs: '',
|
||||
source: '/users/:username',
|
||||
target: '/iwara/users/:username?/video',
|
||||
},
|
||||
{
|
||||
title: '用户图片',
|
||||
docs: '',
|
||||
source: '/users/:username',
|
||||
target: '/iwara/users/:username?/image',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = function (router) {
|
||||
router.get('/users/:username?/:type?', require('./index'));
|
||||
};
|
||||
Reference in New Issue
Block a user