Skip to content

Commit

Permalink
Merge pull request #774 from DIYgod/master
Browse files Browse the repository at this point in the history
[pull] master from diygod:master
  • Loading branch information
pull[bot] authored Feb 1, 2023
2 parents e7cfa2a + fa151ae commit 937fa4d
Show file tree
Hide file tree
Showing 30 changed files with 397 additions and 187 deletions.
12 changes: 9 additions & 3 deletions docs/multimedia.md
Original file line number Diff line number Diff line change
Expand Up @@ -1211,11 +1211,17 @@ JavDB 有多个备用域名,本路由默认使用永久域名 <https://javdb.c

### 用户视频

<Route author="talengu" example="/iqiyi/user/video/2289191062" path="/iqiyi/user/video/:uid" :paramsDesc="['用户名']" />
<Route author="talengu" example="/iqiyi/user/video/2289191062" path="/iqiyi/user/video/:uid" :paramsDesc="['用户名']" radar="1"/>

### 动漫
### 剧集

<Route author="TonyRL" example="/iqiyi/album/神武天尊-2020-1b4lufwxd7h" path="/iqiyi/album/:id" :paramsDesc="['剧集 id, 可在该主页 URL 中找到']" radar="1">

::: tip 提示
可抓取內容根据服务器所在地区而定
:::

<Route author="ranpox" example="/iqiyi/dongman/a_19rrh1sifx" path="/iqiyi/dongman/:id" :paramsDesc="['动漫 id, 可在该动漫主页 URL 中找到(不包括`.html`)']"/>
</Route>

## 哔嘀影视

Expand Down
14 changes: 7 additions & 7 deletions docs/other.md
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ type 为 all 时,category 参数不支持 cost 和 free

### 发现用户

<Route author="sanmmm" example="/afdian/explore/hot/所有" path="/afdian/explore/:type/:category?" :paramsDesc="['分类', '目录类型, 默认为 `所有`']">
<Route author="sanmmm" example="/afdian/explore/hot/所有" path="/afdian/explore/:type/:category?" :paramsDesc="['分类', '目录类型默认为 `所有`']">
分类

| 推荐 | 最热 |
Expand All @@ -413,7 +413,7 @@ type 为 all 时,category 参数不支持 cost 和 free

### 用户动态

<Route author="sanmmm" example="/afdian/dynamic/@afdian" path="/afdian/dynamic/:uid?" :paramsDesc="['用户id, 用户动态页面url里可找到']"/>
<Route author="sanmmm" example="/afdian/dynamic/@afdian" path="/afdian/dynamic/:uid?" :paramsDesc="['用户id用户动态页面url里可找到']"/>

## 澳門特別行政區政府各公共部門獎助貸學金服務平台

Expand All @@ -427,15 +427,15 @@ type 为 all 时,category 参数不支持 cost 和 free

</Route>

## 百度搜索风云榜
## 百度热搜

### 榜单

<Route author="xyqfer" example="/baidu/topwords/1" path="/baidu/topwords/:boardId?" :paramsDesc="['榜单 id, 默认为`1`']">
<Route author="xyqfer" example="/baidu/top" path="/baidu/top/:board?" :paramsDesc="['榜单默认为 `realtime`']" radar="1">

| 实时热点 | 今日热点 | 七日热点 | 民生热点 | 娱乐热点 | 体育热点 |
| ---- | ---- | ---- | ---- | ---- | ---- |
| 1 | 341 | 42 | 342 | 344 | 11 |
| 热搜榜 | 小说榜 | 电影榜 | 电视剧榜 | 汽车榜 | 游戏榜 |
| -------- | ----- | ----- | -------- | --- | ---- |
| realtime | novel | movie | teleplay | car | game |

</Route>

Expand Down
4 changes: 2 additions & 2 deletions docs/social-media.md
Original file line number Diff line number Diff line change
Expand Up @@ -1183,11 +1183,11 @@ YouTube 官方亦有提供频道 RSS,形如 <https://www.youtube.com/feeds/vid

### 出版專題

<Route author="Maecenas" example="/vocus/publication/bass" path="/vocus/publication/:id" :paramsDesc="['出版專題 id,可在出版專題主页的 URL 找到']"/>
<Route author="Maecenas" example="/vocus/publication/bass" path="/vocus/publication/:id" :paramsDesc="['出版專題 id,可在出版專題主页的 URL 找到']" radar="1"/>

### 用户个人文章

<Route author="LogicJake" example="/vocus/user/tsetyan" path="/vocus/user/:id" :paramsDesc="['用户 id,可在用户主页的 URL 找到']"/>
<Route author="LogicJake" example="/vocus/user/tsetyan" path="/vocus/user/:id" :paramsDesc="['用户 id,可在用户主页的 URL 找到']" radar="1"/>

## 即刻

Expand Down
10 changes: 6 additions & 4 deletions lib/middleware/parameter.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,11 @@ module.exports = async (ctx, next) => {

item.description = $('body').html() + '' + (config.suffix || '');

const quote = item._extra?.links?.find((e) => e.type === 'quote');
if (quote && $('.rsshub-quote').length) {
quote.content_html = $.html($('.rsshub-quote'));
if (item._extra?.links && $('.rsshub-quote').length) {
item._extra?.links?.map((e) => {
e.content_html = $.html($('.rsshub-quote'));
return e;
});
}
}
return item;
Expand Down Expand Up @@ -271,7 +273,7 @@ module.exports = async (ctx, next) => {
});

item.author = author || (parsed_result ? parsed_result.author : '');
item.description = parsed_result ? entities.decodeXML(parsed_result.content) : description;
item.description = parsed_result && parsed_result.content.length > 40 ? entities.decodeXML(parsed_result.content) : description;
});
await Promise.all(tasks);
}
Expand Down
10 changes: 5 additions & 5 deletions lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ router.get('/geektime/news', lazyloadRouteHandler('./routes/geektime/news'));
router.get('/qdaily/:type/:id', lazyloadRouteHandler('./routes/qdaily/index'));

// 爱奇艺
router.get('/iqiyi/dongman/:id', lazyloadRouteHandler('./routes/iqiyi/dongman'));
router.get('/iqiyi/user/video/:uid', lazyloadRouteHandler('./routes/iqiyi/video'));
// router.get('/iqiyi/dongman/:id', lazyloadRouteHandler('./routes/iqiyi/dongman'));
// router.get('/iqiyi/user/video/:uid', lazyloadRouteHandler('./routes/iqiyi/video'));

// 南方周末
router.get('/infzm/:id', lazyloadRouteHandler('./routes/infzm/news'));
Expand Down Expand Up @@ -950,7 +950,7 @@ router.get('/geekpark/breakingnews', lazyloadRouteHandler('./routes/geekpark/bre

// 百度
router.get('/baidu/doodles', lazyloadRouteHandler('./routes/baidu/doodles'));
router.get('/baidu/topwords/:boardId?', lazyloadRouteHandler('./routes/baidu/topwords'));
// router.get('/baidu/topwords/:boardId?', lazyloadRouteHandler('./routes/baidu/topwords'));
router.get('/baidu/daily', lazyloadRouteHandler('./routes/baidu/daily'));

// 搜狗
Expand Down Expand Up @@ -1505,8 +1505,8 @@ router.get('/bupt/news', lazyloadRouteHandler('./routes/universities/bupt/news')
router.get('/bupt/funbox', lazyloadRouteHandler('./routes/universities/bupt/funbox'));

// VOCUS 方格子
router.get('/vocus/publication/:id', lazyloadRouteHandler('./routes/vocus/publication'));
router.get('/vocus/user/:id', lazyloadRouteHandler('./routes/vocus/user'));
// router.get('/vocus/publication/:id', lazyloadRouteHandler('./routes/vocus/publication'));
// router.get('/vocus/user/:id', lazyloadRouteHandler('./routes/vocus/user'));

// 一亩三分地 1point3acres
router.get('/1point3acres/blog/:category?', lazyloadRouteHandler('./routes/1point3acres/blog'));
Expand Down
38 changes: 0 additions & 38 deletions lib/routes/baidu/topwords.js

This file was deleted.

42 changes: 0 additions & 42 deletions lib/routes/iqiyi/dongman.js

This file was deleted.

19 changes: 0 additions & 19 deletions lib/routes/vocus/publication.js

This file was deleted.

29 changes: 0 additions & 29 deletions lib/routes/vocus/utils.js

This file was deleted.

1 change: 1 addition & 0 deletions lib/v2/baidu/maintainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ module.exports = {
'/tieba/post/:id': ['u3u'],
'/tieba/post/lz/:id': ['u3u'],
'/tieba/user/:uid': ['igxlin', 'nczitzk'],
'/top/:board?': ['xyqfer'],
};
8 changes: 8 additions & 0 deletions lib/v2/baidu/radar.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,13 @@ module.exports = {
},
},
],
top: [
{
title: '热搜榜单',
docs: 'https://docs.rsshub.app/other.html#bai-du-re-sou',
source: ['/board'],
target: (_, url) => `/baidu/top/${new URL(url).searchParams.get('tab')}`,
},
],
},
};
1 change: 1 addition & 0 deletions lib/v2/baidu/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ module.exports = (router) => {
router.get('/tieba/post/:id', require('./tieba/post'));
router.get('/tieba/post/lz/:id', require('./tieba/post'));
router.get('/tieba/user/:uid', require('./tieba/user'));
router.get('/top/:board?', require('./top'));
};
9 changes: 9 additions & 0 deletions lib/v2/baidu/templates/top.art
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{ if item.img }}
<img src="{{ item.img }}"><br>
{{ /if }}
{{ if item.show }}
{{ each item.show s }}
{{ s }}<br>
{{ /each }}
{{ /if }}
{{ item.desc }}
34 changes: 34 additions & 0 deletions lib/v2/baidu/top.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { art } = require('@/utils/render');
const path = require('path');

module.exports = async (ctx) => {
const { board = 'realtime' } = ctx.params;
const link = `https://top.baidu.com/board?tab=${board}`;
const { data: response } = await got(link);

const $ = cheerio.load(response);

const { data } = JSON.parse(
$('#sanRoot')
.contents()
.filter((e) => e.nodeType === 8)
.prevObject[0].data.match(/s-data:(.*)/)[1]
);

const items = data.cards[0].content.map((item) => ({
title: item.word,
description: art(path.join(__dirname, 'templates/top.art'), {
item,
}),
link: item.rawUrl,
}));

ctx.state.data = {
title: `${data.curBoardName} - 百度热搜`,
description: $('meta[name="description"]').attr('content'),
link,
item: items,
};
};
62 changes: 62 additions & 0 deletions lib/v2/iqiyi/album.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { parseDate } = require('@/utils/parse-date');
const { art } = require('@/utils/render');
const path = require('path');

module.exports = async (ctx) => {
const { id } = ctx.params;

const { data: response } = await got(`https://www.iq.com/album/${id}`);

const $ = cheerio.load(response);
const nextData = JSON.parse($('#__NEXT_DATA__').text());
const { album } = nextData.props.initialState;

const {
data: { data: baseInfo },
} = await got(`https://pcw-api.iqiyi.com/album/album/baseinfo/${album.videoAlbumInfo.albumId}`);

if (Object.keys(album.cacheAlbumList).length === 0) {
throw Error(`${baseInfo.name} is not available in this server region.`);
}

let pos = 1;
let hasMore = false;
let epgs = [];
do {
const {
data: { data },
// eslint-disable-next-line no-await-in-loop
} = await got(`https://pcw-api.iq.com/api/v2/episodeListSource/${album.videoAlbumInfo.albumId}`, {
searchParams: {
platformId: 3,
modeCode: 'intl',
langCode: 'zh_cn',
endOrder: album.videoAlbumInfo.maxOrder,
startOrder: pos,
},
});
epgs = [...epgs, ...data.epg];
pos = data.pos;
hasMore = data.hasMore;
} while (hasMore);

const items = epgs.map((item) => ({
title: item.name,
description: art(path.join(__dirname, 'templates/album.art'), {
item,
}),
link: `https://www.iq.com/play/${item.playLocSuffix}`,
pubDate: parseDate(item.initIssueTime),
}));

ctx.state.data = {
title: baseInfo.name,
description: baseInfo.description,
image: album.videoAlbumInfo.albumFocus1024,
link: `https://www.iq.com/album/${album.videoAlbumInfo.albumLocSuffix}`,
item: items,
allowEmpty: true,
};
};
4 changes: 4 additions & 0 deletions lib/v2/iqiyi/maintainer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
'/album/:id': ['TonyRL'],
'/user/video/:uid': ['talengu'],
};
Loading

1 comment on commit 937fa4d

@vercel
Copy link

@vercel vercel bot commented on 937fa4d Feb 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.