UNPKG

rsshub

Version:
45 lines (44 loc) 1.41 kB
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs"; import { load } from "cheerio"; //#region lib/routes/secshi/index.ts const route = { path: "/:category?", categories: ["multimedia"], example: "/secshi", parameters: { category: "分类,见下表,默认为 `1`" }, description: `| 电影 | 电视剧 | 动漫 | 综艺 | 短剧 | 网飞 | | ---- | ------ | ---- | ---- | ---- | ---- | | 1 | 2 | 3 | 4 | 5 | 30 |`, features: { antiCrawler: true }, name: "分类", maintainers: ["8430177"], handler, url: "www.secshi.com" }; async function handler(ctx) { const { category = "1" } = ctx.req.param(); const baseUrl = "https://www.secshi.com"; const link = `${baseUrl}/go/${category}.html`; const initResponse = await rofetch.raw(link, { ignoreResponseError: true, redirect: "manual" }); const cookie = initResponse.headers.getSetCookie().map((c) => c.split(";", 1)[0]).join("; "); const $ = load(initResponse.ok ? initResponse._data : await rofetch(link, { headers: { Cookie: cookie } })); const items = $("ul.hl-vod-list li.hl-list-item").toArray().map((item) => { const a = $(item).find("a.hl-item-thumb"); return { title: a.attr("title"), link: new URL(a.attr("href"), baseUrl).href, image: a.attr("data-original") }; }); return { title: $("head title").text(), link, language: "zh-CN", item: items }; } //#endregion export { route };