feat(route): add ntdm (#14979)
This commit is contained in:
parent
288f1d1fd7
commit
eab38324f2
|
|
@ -0,0 +1,6 @@
|
|||
import type { Namespace } from '@/types';
|
||||
|
||||
export const namespace: Namespace = {
|
||||
name: 'NT动漫',
|
||||
url: 'www.ntdm9.com',
|
||||
};
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
const rootUrl = 'https://www.ntdm9.com';
|
||||
|
||||
export { rootUrl };
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
import { Route } from '@/types';
|
||||
import got from '@/utils/got';
|
||||
import { rootUrl } from './utils';
|
||||
import cheerio from 'cheerio';
|
||||
|
||||
export const route: Route = {
|
||||
path: '/video/:id',
|
||||
categories: ['anime'],
|
||||
example: '/ntdm/video/20200035',
|
||||
parameters: { id: '番剧 id,对应详情 URL 中找到' },
|
||||
features: {
|
||||
requireConfig: false,
|
||||
requirePuppeteer: false,
|
||||
antiCrawler: false,
|
||||
supportBT: false,
|
||||
supportPodcast: false,
|
||||
supportScihub: false,
|
||||
},
|
||||
radar: [
|
||||
{
|
||||
source: ['ntdm9.com/video/:id'],
|
||||
},
|
||||
],
|
||||
name: '番剧详情',
|
||||
maintainers: ['alexhere'],
|
||||
handler,
|
||||
};
|
||||
|
||||
async function handler(ctx) {
|
||||
const id = ctx.req.param('id');
|
||||
const url = `${rootUrl}/video/${id}.html`;
|
||||
const response = await got(url);
|
||||
const $ = cheerio.load(response.data);
|
||||
|
||||
const dmtitle = $('.detail_imform_name').text();
|
||||
const dmdesc = $('.detail_imform_desc_pre').text();
|
||||
|
||||
const items = $('.movurl.mod ul')
|
||||
.first()
|
||||
.find('li')
|
||||
.toArray()
|
||||
.map((item) => {
|
||||
item = $(item);
|
||||
const a = item.find('a');
|
||||
return {
|
||||
title: a.text(),
|
||||
link: `${rootUrl}${a.attr('href')}`
|
||||
};
|
||||
})
|
||||
.reverse();
|
||||
return {
|
||||
title: `NT动漫 - ${dmtitle}`,
|
||||
link: `${rootUrl}/video/${id}.html`,
|
||||
description: dmdesc,
|
||||
item: items,
|
||||
};
|
||||
}
|
||||
Loading…
Reference in New Issue