mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
@@ -485,6 +485,28 @@ Sources
|
||||
|
||||
<Route author="zytomorrow" path="/shuhui/comics/:id" example="/shuhui/comics/1" :paramsDesc="['漫画id,漫画主页的地址栏中最后一位数字']" radar="1" rssbud="1"/>
|
||||
|
||||
## 腾讯动漫
|
||||
|
||||
### 排行榜
|
||||
|
||||
<Route author="nczitzk" example="/ac/rank" path="/ac/rank/:type?/:time?" :paramsDesc="['分类,见下表,默认为月票榜']" radar="1" rssbud="1">
|
||||
|
||||
| 月票榜 | 飙升榜 | 新作榜 | 畅销榜 | TOP100 | 男生榜 | 女生榜 |
|
||||
| ------ | ------ | ------ | ------ | ------ | ------ | ------ |
|
||||
| mt | rise | new | pay | top | male | female |
|
||||
|
||||
::: tip 提示
|
||||
|
||||
`time` 参数仅在 `type` 参数选为 **月票榜** 的时候生效。
|
||||
|
||||
:::
|
||||
|
||||
</Route>
|
||||
|
||||
### 漫画
|
||||
|
||||
<Route author="nczitzk" example="/ac/comic/531490" path="/ac/comic/:id" :paramsDesc="['编号,可在对应页 URL 中找到']" radar="1" rssbud="1"/>
|
||||
|
||||
## 忧郁的 loli
|
||||
|
||||
### 文章
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
const { rootUrl, mobileRootUrl } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const id = ctx.params.id;
|
||||
|
||||
const currentUrl = `${rootUrl}/Comic/comicInfo/id/${id}`;
|
||||
const mobileCurrentUrl = `${mobileRootUrl}/comic/index/id/${id}`;
|
||||
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: mobileCurrentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const author = $('.author-wr')
|
||||
.toArray()
|
||||
.map((a) => $(a).text().trim())
|
||||
.join(', ');
|
||||
|
||||
const items = $('.reverse .bottom-chapter-item .chapter-link')
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
item = $(item);
|
||||
|
||||
return {
|
||||
author,
|
||||
title: item.text(),
|
||||
description: `<img src="${item.find('.cover-image').attr('src')}">`,
|
||||
link: `${rootUrl}${item.attr('href').replace(/chapter/, 'ComicView')}`,
|
||||
};
|
||||
});
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${$('h1').text()} - 腾讯动漫`,
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
description: `<p>${$('.head-info-desc').text()}</p>`,
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
const { rootUrl, ProcessItems } = require('./utils');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const titles = {
|
||||
mt: '月票榜',
|
||||
rise: '飙升榜',
|
||||
new: '新作榜',
|
||||
pay: '畅销榜',
|
||||
top: 'TOP100',
|
||||
male: '男生榜',
|
||||
female: '女生榜',
|
||||
};
|
||||
|
||||
const type = ctx.params.type ?? 'mt';
|
||||
const time = ctx.params.time ?? 'cur';
|
||||
|
||||
const currentUrl = `${rootUrl}/Rank/comicRank/type/${type}`;
|
||||
|
||||
ctx.state.data = await ProcessItems(ctx, currentUrl, time, titles[type]);
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
{{ if image !== '' }}
|
||||
<img src="{{ image }}">
|
||||
{{ /if }}
|
||||
{{ if description !== '' }}
|
||||
<p>{{ description }}</p>
|
||||
{{ /if }}
|
||||
{{ each chapters chapter }}
|
||||
<div><img src="{{ chapter.image }}"/><a href="{{ chapter.link }}">{{ chapter.title }}</a></div>
|
||||
{{/each}}
|
||||
@@ -0,0 +1,71 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
const { art } = require('@/utils/render');
|
||||
const path = require('path');
|
||||
|
||||
const rootUrl = 'https://ac.qq.com';
|
||||
const mobileRootUrl = 'https://m.ac.qq.com';
|
||||
|
||||
module.exports = {
|
||||
rootUrl,
|
||||
mobileRootUrl,
|
||||
ProcessItems: async (ctx, currentUrl, time, title) => {
|
||||
const response = await got({
|
||||
method: 'get',
|
||||
url: currentUrl,
|
||||
});
|
||||
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
let items = $(`${time ? `.${time}-month-data ` : ''}.text-overflow`)
|
||||
.slice(0, ctx.query.limit ? parseInt(ctx.query.limit) : 30)
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
item = $(item);
|
||||
|
||||
return {
|
||||
title: item.text(),
|
||||
guid: `${rootUrl}${item.attr('href')}`,
|
||||
link: `${mobileRootUrl}${item.attr('href').replace(/Comic\/ComicInfo/, 'comic/index')}`,
|
||||
};
|
||||
});
|
||||
|
||||
items = await Promise.all(
|
||||
items.map((item) =>
|
||||
ctx.cache.tryGet(item.guid, async () => {
|
||||
const detailResponse = await got({
|
||||
method: 'get',
|
||||
url: item.link,
|
||||
});
|
||||
|
||||
const content = cheerio.load(detailResponse.data);
|
||||
|
||||
item.link = item.guid;
|
||||
item.author = content('.author-wr')
|
||||
.toArray()
|
||||
.map((a) => $(a).text().trim())
|
||||
.join(', ');
|
||||
item.description = art(path.join(__dirname, 'templates/description.art'), {
|
||||
image: content('.head-cover')?.attr('src') ?? '',
|
||||
description: content('.head-info-desc')?.text() ?? '',
|
||||
chapters: content('.reverse .bottom-chapter-item .chapter-link')
|
||||
.toArray()
|
||||
.map((chapter) => ({
|
||||
link: content(chapter).attr('href'),
|
||||
title: content(chapter).find('.comic-title')?.text() ?? '',
|
||||
image: content(chapter).find('.cover-image')?.attr('src') ?? '',
|
||||
})),
|
||||
});
|
||||
|
||||
return item;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
return {
|
||||
title: `${title} - 腾讯动漫`,
|
||||
link: currentUrl,
|
||||
item: items,
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -1,3 +1,5 @@
|
||||
module.exports = {
|
||||
'/ac/comic/:id': ['nczitzk'],
|
||||
'/ac/rank/:type?/:time?': ['nczitzk'],
|
||||
'/live/:id': ['nczitzk'],
|
||||
};
|
||||
|
||||
@@ -1,6 +1,20 @@
|
||||
module.exports = {
|
||||
'qq.com': {
|
||||
_name: '腾讯网',
|
||||
ac: [
|
||||
{
|
||||
title: '排行榜',
|
||||
docs: 'https://docs.rsshub.app/anime.html#teng-xun-dong-man-pai-hang-bang',
|
||||
source: ['/Rank/comicRank/type/:type', '/'],
|
||||
target: '/qq/ac/rank/:type?/:time?',
|
||||
},
|
||||
{
|
||||
title: '漫画',
|
||||
docs: 'https://docs.rsshub.app/anime.html#teng-xun-dong-man-man-hua',
|
||||
source: ['/Comic/ComicInfo/id/:id', '/'],
|
||||
target: '/qq/ac/comic/:id',
|
||||
},
|
||||
],
|
||||
live: [
|
||||
{
|
||||
title: '企鹅直播',
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
module.exports = function (router) {
|
||||
router.get('/ac/comic/:id?', require('./ac/comic'));
|
||||
router.get('/ac/rank/:type?/:time?', require('./ac/rank'));
|
||||
router.get('/live/:id', require('./live'));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user