diff --git a/lib/routes/maoyan/box.ts b/lib/routes/maoyan/box.ts new file mode 100644 index 000000000..20fb76bb6 --- /dev/null +++ b/lib/routes/maoyan/box.ts @@ -0,0 +1,83 @@ +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + +export const route: Route = { + path: '/box', + categories: ['multimedia'], + example: '/maoyan/box', + parameters: {}, + features: { + requireConfig: false, + requirePuppeteer: false, + antiCrawler: false, + supportBT: false, + supportPodcast: false, + supportScihub: false, + }, + radar: [ + { + source: ['piaofang.maoyan.com/dashboard'], + target: '/box', + }, + ], + name: '实时票房榜', + maintainers: ['JackyST0'], + handler, +}; + +interface MovieItem { + movieInfo: { + movieId: number; + movieName: string; + releaseInfo: string; + }; + boxRate: string; + sumBoxDesc: string; + showCount: number; + showCountRate: string; + avgSeatView: string; + avgShowView: string; + splitBoxRate: string; +} + +interface BoxResponse { + movieList: { + status: boolean; + data: { + list: MovieItem[]; + }; + }; +} + +async function handler() { + const apiUrl = 'https://piaofang.maoyan.com/dashboard-ajax'; + + const response = await ofetch(apiUrl, { + headers: { + Referer: 'https://piaofang.maoyan.com/dashboard', + }, + }); + + const movies = response.movieList?.data?.list || []; + + const items = movies.map((movie, index) => ({ + title: `${index + 1}. ${movie.movieInfo.movieName} - ${movie.sumBoxDesc}`, + link: `https://www.maoyan.com/films/${movie.movieInfo.movieId}`, + description: ` +

${movie.movieInfo.movieName}

+

上映状态:${movie.movieInfo.releaseInfo}

+

累计票房:${movie.sumBoxDesc}

+

票房占比:${movie.boxRate}

+

排片场次:${movie.showCount} 场 (${movie.showCountRate})

+

上座率:${movie.avgSeatView}

+

场均人次:${movie.avgShowView}

+ `, + })); + + return { + title: '猫眼实时票房榜', + link: 'https://piaofang.maoyan.com/dashboard', + description: '猫眼电影实时票房排行榜', + item: items, + }; +} diff --git a/lib/routes/maoyan/coming.ts b/lib/routes/maoyan/coming.ts new file mode 100644 index 000000000..25520bf7d --- /dev/null +++ b/lib/routes/maoyan/coming.ts @@ -0,0 +1,70 @@ +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + +interface MovieItem { + id: number; + nm: string; + img: string; + sc: number; + star: string; + rt: string; + showInfo?: string; + wish: number; + comingTitle: string; +} + +interface ComingResponse { + coming: MovieItem[]; +} + +export const route: Route = { + path: '/coming', + categories: ['multimedia'], + example: '/maoyan/coming', + parameters: {}, + features: { + requireConfig: false, + requirePuppeteer: false, + antiCrawler: false, + supportBT: false, + supportPodcast: false, + supportScihub: false, + }, + radar: [ + { + source: ['www.maoyan.com/films?showType=2', 'www.maoyan.com/films'], + target: '/coming', + }, + ], + name: '即将上映', + maintainers: ['JackyST0'], + handler, +}; + +async function handler() { + const apiUrl = 'https://m.maoyan.com/ajax/comingList?ci=1&limit=30&movieIds=&token='; + + const response = await ofetch(apiUrl); + + const movies = response.coming || []; + + const items = movies.map((movie) => ({ + title: `[${movie.comingTitle}] ${movie.nm}`, + link: `https://www.maoyan.com/films/${movie.id}`, + description: ` + +

${movie.nm}

+

上映时间:${movie.rt}

+

主演:${movie.star}

+

想看人数:${movie.wish}

+ ${movie.showInfo ? `

${movie.showInfo}

` : ''} + `, + })); + + return { + title: '猫眼电影 - 即将上映', + link: 'https://www.maoyan.com/films?showType=2', + description: '猫眼电影即将上映列表', + item: items, + }; +} diff --git a/lib/routes/maoyan/hot.ts b/lib/routes/maoyan/hot.ts new file mode 100644 index 000000000..ac707dc0b --- /dev/null +++ b/lib/routes/maoyan/hot.ts @@ -0,0 +1,71 @@ +import type { Route } from '@/types'; +import ofetch from '@/utils/ofetch'; + +interface MovieItem { + id: number; + nm: string; + img: string; + sc: number; + star: string; + rt: string; + showInfo: string; + wish: number; + version?: string; +} + +interface HotResponse { + movieList: MovieItem[]; +} + +export const route: Route = { + path: '/hot', + categories: ['multimedia'], + example: '/maoyan/hot', + parameters: {}, + features: { + requireConfig: false, + requirePuppeteer: false, + antiCrawler: false, + supportBT: false, + supportPodcast: false, + supportScihub: false, + }, + radar: [ + { + source: ['www.maoyan.com/films?showType=1'], + target: '/hot', + }, + ], + name: '正在热映', + maintainers: ['JackyST0'], + handler, +}; + +async function handler() { + const apiUrl = 'https://m.maoyan.com/ajax/movieOnInfoList'; + + const response = await ofetch(apiUrl); + + const movies = response.movieList || []; + + const items = movies.map((movie) => ({ + title: `${movie.sc ? `[${movie.sc}分] ` : ''}${movie.nm}`, + link: `https://www.maoyan.com/films/${movie.id}`, + description: ` + +

${movie.nm}

+ ${movie.sc ? `

评分:${movie.sc}

` : ''} +

上映时间:${movie.rt}

+

主演:${movie.star}

+

想看人数:${movie.wish}

+

${movie.showInfo}

+ `, + })); + + return { + title: '猫眼电影 - 正在热映', + link: 'https://www.maoyan.com/films?showType=1', + description: '猫眼电影正在热映列表', + item: items, + }; +} diff --git a/lib/routes/maoyan/namespace.ts b/lib/routes/maoyan/namespace.ts new file mode 100644 index 000000000..362b0e6b9 --- /dev/null +++ b/lib/routes/maoyan/namespace.ts @@ -0,0 +1,7 @@ +import type { Namespace } from '@/types'; + +export const namespace: Namespace = { + name: '猫眼电影', + url: 'maoyan.com', + lang: 'zh-CN', +};