UNPKG

rsshub

Version:
61 lines (60 loc) 2.29 kB
import { t as rofetch } from "./ofetch-C3ts-Hud.mjs"; import { t as parseDate } from "./parse-date-Cr0wQjV_.mjs"; import { load } from "cheerio"; //#region lib/routes/sigsac/ccs.ts const url = "https://www.sigsac.org/"; const route = { path: "/ccs", categories: ["journal"], example: "/sigsac/ccs", radar: [{ source: ["sigsac.org/ccs.html", "sigsac.org/"] }], name: "The ACM Conference on Computer and Communications Security", maintainers: ["ZeddYu"], handler, url: "sigsac.org/ccs.html", description: "Return results from 2020" }; async function handler() { const last = (/* @__PURE__ */ new Date()).getFullYear() + 1; const yearList = Array.from({ length: last - 2020 }, (_, v) => `${url}ccs/CCS${v + 2020}/`); const urlList = (await Promise.allSettled(yearList.map((url) => rofetch(url)))).map((response, i) => { if (response.status !== "fulfilled") return; const $ = load(response.value); return $("a:contains(\"Accepted Papers\")").attr("href") && new URL($("a:contains(\"Accepted Papers\")").attr("href"), yearList[i]).href; }).filter(Boolean); const items = (await Promise.allSettled(urlList.map((url) => rofetch(url)))).flatMap((response, i) => { if (response.status !== "fulfilled") return []; const $ = load(response.value); const link = urlList[i]; const paperSection = $("div.papers-item").toArray().map((item) => { const $item = $(item); const title = $item.find("b").text().trim(); return { title, author: $item.find("p").text().trim().replaceAll("\n", "").replaceAll(/\s+/g, " "), link: `${link}#${title}`, pubDate: parseDate(link.match(/CCS(\d{4})/)[1], "YYYY") }; }); const paperTable = $("tbody tr").toArray().slice(1).map((item) => { const $item = $(item); const title = $item.find("td").eq(0).text().trim(); return { title, author: $item.find("td").eq(1).text().trim().replaceAll("\n", "").replaceAll(/\s+/g, " "), link: `${link}#${title}`, pubDate: parseDate(link.match(/CCS(\d{4})/)[1], "YYYY") }; }); return paperSection.length ? paperSection : paperTable; }); return { title: "ACM CCS", link: url, description: "The ACM Conference on Computer and Communications Security (CCS) Accepted Papers", allowEmpty: true, item: items }; } //#endregion export { route };