feat(route): 新增魔都资源网 (#15974)

* feat(route): 新增魔都资源网

* fix dirname

* fix
This commit is contained in:
Hualiang 2024-06-25 02:18:45 +08:00 committed by GitHub
parent 72d1f85d2f
commit 19a7f67796
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 208 additions and 0 deletions

View File

@ -0,0 +1,84 @@
import { Result, Vod } from '@/routes/moduzy/type';
import { DataItem, Route } from '@/types';
import ofetch from '@/utils/ofetch';
import path from 'node:path';
import { parseDate } from '@/utils/parse-date';
import { art } from '@/utils/render';
import timezone from '@/utils/timezone';
import { getCurrentPath } from '@/utils/helpers';
const render = (vod: Vod, link: string) => art(path.join(getCurrentPath(import.meta.url), 'templates', 'vod.art'), { vod, link });
export const route: Route = {
path: '/:type/:hours?',
categories: ['multimedia'],
example: '/moduzy/2',
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
},
parameters: {
type: '类别ID具体见下表为 0 代表全部类别',
hours: '获取截止到几小时前的数据,默认不限',
},
radar: [
{
source: ['moduzy.cc', 'moduzy.net', 'moduzy.com', 'moduzy1.com', 'moduzy2.com', 'moduzy3.com', 'moduzy4.com', 'moduzy5.com', 'moduzy6.com', 'moduzy7.com', 'moduzy8.com', 'moduzy9.com', 'moduzy10.com'],
},
],
name: '最新资源',
maintainers: ['hualiong'],
url: 'moduzy.net',
description: `
:::warning
\`全部类别\`\`国产动漫\`因为该类型每天的更新量会大幅超过单次抓取的最大上限20条而被截断
********
:::
| | ID | | ID | | ID |
| ---- | ---- | ---- | ---- | ---- | ---- |
| | 1 | | 2 | | 3 |
| | 4 | | 5 | | 6 |
| | 10 | | 11 | | 12 |
| | 13 | | 14 | | 15 |
| | 16 | | 17 | | 18 |
| | 19 | | 20 | | 21 |
| | 22 | | 23 | | 24 |
| | 25 | | 26 | | 27 |
| | 28 | | 29 | | 30 |
| | 31 | | 32 | | 33 |
| | 34 | | 35 | | 36 |
| | 37 | | 0 | | |`,
handler: async (ctx) => {
const { type, hours = '' } = ctx.req.param();
const query = async (pg: number) =>
await ofetch<Result>('https://moduzy.net/api.php/provide/vod', {
parseResponse: JSON.parse,
query: { ac: 'detail', t: type || '', h: hours, pg },
});
const res = await query(1);
const items: DataItem[] = res.list.map((each) => ({
title: each.vod_name,
image: each.vod_pic,
link: `https://moduzy.net/vod/${each.vod_id}/`,
guid: each.vod_play_url.match(/https:\/\/.+?\.m3u8/g)?.slice(-1)[0],
pubDate: timezone(parseDate(each.vod_time, 'YYYY-MM-DD HH:mm:ss'), +8),
category: [each.type_name, ...each.vod_class.split(',')],
description: render(each, `https://moduzy.net/vod/${each.vod_id}/`) + each.vod_content,
}));
return {
title: `最新${type && items.length ? items[0].category![0] : '资源'} - 魔都资源网`,
link: 'https://moduzy.net',
allowEmpty: true,
language: 'zh-cn',
item: items,
};
},
};

View File

@ -0,0 +1,17 @@
import type { Namespace } from '@/types';
export const namespace: Namespace = {
name: '魔都资源网',
url: 'www.moduzy.com',
description: `
:::tip
使 \`moduzy.net\` 确保在中国大陆内的实例也能访问。如果你想直接访问源站可以通过以下域名:
- moduzy.com访
- moduzy.cc
- moduzy.net
- moduzy1.com - moduzy10.com访
[moduzy.vip](https://www.moduzy.vip)
:::`,
};

View File

@ -0,0 +1,12 @@
<a href="{{ link }}" title="进入官网查看"><img src="{{ vod.vod_pic }}" alt="{{ vod.vod_name }}" /></a>
<h1>{{ vod.vod_name }} <span style="font-size: 0.6em; color: darkred;">{{ vod.vod_remarks }}</span></h1>
<p><b>别名:</b>{{ vod.vod_sub }}</p>
<p><b>导演:</b>{{ vod.vod_director }}</p>
<p><b>主演:</b>{{ vod.vod_actor }}</p>
<p><b>类型:</b>{{ vod.vod_class }}</p>
<p><b>年份:</b>{{ vod.vod_year }}</p>
<p><b>地区:</b>{{ vod.vod_area }}</p>
<p><b>开播时间:</b>{{ vod.vod_pubdate }}</p>
<p><b>更新时间:</b>{{ vod.vod_time }}</p>
<p><b>资源主页:</b><a href="{{ link }}">{{ link }}</a></p>
<h3>剧情介绍</h3>

95
lib/routes/moduzy/type.ts Normal file
View File

@ -0,0 +1,95 @@
export type Result = {
code: number;
msg: string;
page: string;
pagecount: number;
limit: string;
total: number;
list: Array<Vod>;
};
export type Vod = {
vod_id: number;
type_id: number;
type_id_1: number;
group_id: number;
vod_name: string;
vod_sub: string;
vod_en: string;
vod_status: number;
vod_letter: string;
vod_color: string;
vod_tag: string;
vod_class: string;
vod_pic: string;
vod_pic_thumb: string;
vod_pic_slide: string;
vod_pic_screenshot: string;
vod_actor: string;
vod_director: string;
vod_writer: string;
vod_behind: string;
vod_blurb: string;
vod_remarks: string;
vod_pubdate: string;
vod_total: number;
vod_serial: string;
vod_tv: string;
vod_weekday: string;
vod_area: string;
vod_lang: string;
vod_year: string;
vod_version: string;
vod_state: string;
vod_author: string;
vod_jumpurl: string;
vod_tpl: string;
vod_tpl_play: string;
vod_tpl_down: string;
vod_isend: number;
vod_lock: number;
vod_level: number;
vod_copyright: number;
vod_points: number;
vod_points_play: number;
vod_points_down: number;
vod_hits: number;
vod_hits_day: number;
vod_hits_week: number;
vod_hits_month: number;
vod_duration: string;
vod_up: number;
vod_down: number;
vod_score: string;
vod_score_all: number;
vod_score_num: number;
vod_time: string;
vod_time_add: number;
vod_time_hits: number;
vod_time_make: number;
vod_trysee: number;
vod_douban_id: number;
vod_douban_score: string;
vod_reurl: string;
vod_rel_vod: string;
vod_rel_art: string;
vod_pwd: string;
vod_pwd_url: string;
vod_pwd_play: string;
vod_pwd_play_url: string;
vod_pwd_down: string;
vod_pwd_down_url: string;
vod_content: string;
vod_play_from: string;
vod_play_server: string;
vod_play_note: string;
vod_play_url: string;
vod_down_from: string;
vod_down_server: string;
vod_down_note: string;
vod_down_url: string;
vod_plot: number;
vod_plot_name: string;
vod_plot_detail: string;
type_name: string;
};