UNPKG

rsshub

Version:
71 lines (69 loc) 2.23 kB
import "./esm-shims-CzJ_djXG.mjs"; import "./config-C37vj7VH.mjs"; import "./dist-BInvbO1W.mjs"; import "./logger-Czu8UMNd.mjs"; import "./ofetch-BIyrKU3Y.mjs"; import { t as parseDate } from "./parse-date-BrP7mxXf.mjs"; import { t as cache_default } from "./cache-Bo__VnGm.mjs"; import "./helpers-DxBp0Pty.mjs"; import { t as got_default } from "./got-KxxWdaxq.mjs"; import { load } from "cheerio"; //#region lib/routes/qq88/index.ts const route = { path: "/:category?", categories: ["multimedia"], example: "/qq88", parameters: { category: "分类 id,见下表,默认为首页" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, name: "分类", maintainers: ["nczitzk"], handler, description: `| 首页 | オトナの土ドラ | 日剧 | 日剧 SP | | ---- | -------------- | ---- | ------- | | | 10 | 5 | 11 |` }; async function handler(ctx) { const category = ctx.req.param("category") ?? ""; const rootUrl = "https://qq88.info"; const currentUrl = category ? `${rootUrl}/?cat=${category}` : rootUrl; const $ = load((await got_default({ method: "get", url: currentUrl })).data); const list = $(".entry-title a").slice(0, 15).toArray().map((item) => { item = $(item); return { title: item.text(), link: item.attr("href"), pubDate: parseDate(item.parent().next().find(".mh-meta-date").eq(-1).text().split(":")[1]) }; }); const items = await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => { const content = load((await got_default({ method: "get", url: item.link })).data); const links = content(".entry-content").find("a[download]"); item.enclosure_type = "video/mp4"; item.enclosure_url = links.eq(-1).attr("href"); item.description = `<video controls><source src="${item.enclosure_url}"></video><br>`; links.each(function() { item.description += `<li><a href="${content(this).attr("href")}">${content(this).text()}</a></li>`; }); return item; }))); return { title: `${$(".page-title").text() || "首页"} - 秋爸日字`, link: currentUrl, item: items }; } //#endregion export { route };