fix(route): iqiyi album (#11753)
This commit is contained in:
+9
-3
@@ -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="ranpox" example="/iqiyi/dongman/a_19rrh1sifx" path="/iqiyi/dongman/:id" :paramsDesc="['动漫 id, 可在该动漫主页 URL 中找到(不包括`.html`)']"/>
|
||||
<Route author="TonyRL" example="/iqiyi/album/神武天尊-2020-1b4lufwxd7h" path="/iqiyi/album/:id" :paramsDesc="['剧集 id, 可在该主页 URL 中找到']" radar="1">
|
||||
|
||||
::: tip 提示
|
||||
可抓取內容根据服务器所在地区而定
|
||||
:::
|
||||
|
||||
</Route>
|
||||
|
||||
## 哔嘀影视
|
||||
|
||||
|
||||
+2
-2
@@ -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'));
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: `http://www.iqiyi.com/${id}.html`,
|
||||
headers: {
|
||||
Host: 'www.iqiyi.com',
|
||||
Referer: `http://www.iqiyi.com/${id}.html`,
|
||||
},
|
||||
});
|
||||
|
||||
const data = response.data;
|
||||
const $ = cheerio.load(data);
|
||||
const description = $('.episodeIntro-brief').text();
|
||||
const list = $('li[data-albumlist-elem="playItem"]');
|
||||
|
||||
ctx.state.data = {
|
||||
title: $('title').text().split('-')[0],
|
||||
link: `http://www.iqiyi.com/${id}.html`,
|
||||
description,
|
||||
item:
|
||||
list &&
|
||||
list
|
||||
.map((index, item) => {
|
||||
const episode = $(item).find('p.site-piclist_info_title a').text().trim();
|
||||
const describe = $(item).find('p.site-piclist_info_describe a').text();
|
||||
const title = `${episode}-${describe}`;
|
||||
|
||||
return {
|
||||
title,
|
||||
description: `<img src="${$(item).find('.site-piclist_pic .site-piclist_pic_link img').attr('src')}">`,
|
||||
link: $(item).find('.site-piclist_pic .site-piclist_pic_link').attr('href'),
|
||||
};
|
||||
})
|
||||
.get()
|
||||
.reverse(),
|
||||
};
|
||||
};
|
||||
@@ -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,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
'/album/:id': ['TonyRL'],
|
||||
'/user/video/:uid': ['talengu'],
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
module.exports = {
|
||||
'iq.com': {
|
||||
_name: '爱奇艺',
|
||||
'.': [
|
||||
{
|
||||
title: '剧集',
|
||||
docs: 'https://docs.rsshub.app/multimedia.html#ai-qi-yi',
|
||||
source: ['/album/:id'],
|
||||
target: '/iqiyi/:category/:id',
|
||||
},
|
||||
],
|
||||
},
|
||||
'iqiyi.com': {
|
||||
_name: '爱奇艺',
|
||||
'.': [
|
||||
{
|
||||
title: '用户视频',
|
||||
docs: 'https://docs.rsshub.app/multimedia.html#ai-qi-yi',
|
||||
source: ['/u/:uid/*'],
|
||||
target: '/iqiyi/user/video/:uid',
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
module.exports = (router) => {
|
||||
router.get('/album/:id', require('./album'));
|
||||
router.get('/user/video/:uid', require('./video'));
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
<img src="https:{{ item.pic.replace('http:', 'https:') }}">
|
||||
Reference in New Issue
Block a user