UNPKG

rsshub

Version:
72 lines (70 loc) 2.32 kB
import { n as init_esm_shims, t as __dirname } from "./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 art } from "./render-BQo6B4tL.mjs"; import { t as got_default } from "./got-KxxWdaxq.mjs"; import path from "node:path"; import { load } from "cheerio"; import CryptoJS from "crypto-js"; //#region lib/routes/qq/fact/index.ts init_esm_shims(); const getRequestToken = () => { return CryptoJS.DES.encrypt(`${Date.now().toString()}-sgn51n6r6q97o6g3`, "jzhotdata").toString(); }; const baseUrl = "https://vp.fact.qq.com"; const route = { path: "/fact", categories: ["other"], example: "/qq/fact", parameters: {}, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["vp.fact.qq.com/home", "vp.fact.qq.com/"] }], name: "最新辟谣", maintainers: ["hoilc"], handler, url: "vp.fact.qq.com/home" }; async function handler() { const { data: response } = await got_default(`${baseUrl}/api/article/list`, { headers: { Referer: `${baseUrl}/home` }, searchParams: { page: 1, locale: "zh-CN", token: getRequestToken() } }); const list = response.data.list.map((item) => ({ title: `【${item.explain}${item.title}`, description: `<img src="${item.cover}"><br>${item.abstract}`, pubDate: parseDate(item.date, "YYYY-MM-DD"), author: `${item.Author.name} - ${item.Author.desc}`, category: item.tag, link: `${baseUrl}/article?id=${item.id}` })); const items = await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => { const $ = load((await got_default(item.link)).data); const { initialState } = JSON.parse($("#__NEXT_DATA__").text()).props.pageProps; item.description = art(path.join(__dirname, "templates/article-05e51c88.art"), { data: initialState }); item.pubDate = parseDate(initialState.createdAt); return item; }))); return { title: "较真查证平台 - 腾讯新闻", link: `${baseUrl}/home`, item: items }; } //#endregion export { route };