rsshub
Version:
Make RSS Great Again!
44 lines (42 loc) • 1.33 kB
JavaScript
import "./dist-Bog6z_OM.mjs";
import "./config-MQ-7ebJ_.mjs";
import "./logger-C4avouvV.mjs";
import "./ofetch-DKl_Ma9g.mjs";
import "./parse-date-r5WDWHno.mjs";
import "./is-worker-DESPicPc.mjs";
import "./cache-SV6W5EPy.mjs";
import "./helpers-Bo4JQYdN.mjs";
import { t as got_default } from "./got-CO-ndVl2.mjs";
import { i as getArticleList, n as cookieJar, r as getArticle, t as baseUrl } from "./utils-9e_EwON4.mjs";
import { load } from "cheerio";
//#region lib/routes/nature/news-and-comment.ts
const route = {
path: "/news-and-comment/:journal?",
radar: [{
source: [
"nature.com/latest-news",
"nature.com/news",
"nature.com/"
],
target: "/news"
}],
name: "Unknown",
maintainers: ["y9c", "TonyRL"],
handler,
url: "nature.com/latest-news"
};
async function handler(ctx) {
const pageURL = `${baseUrl}/${ctx.req.param("journal")}/news-and-comment`;
const pageCapture = load((await got_default(pageURL, { cookieJar })).data);
const pageDescription = pageCapture("meta[name=description]").attr("content") || "Nature, a nature research journal";
let items = getArticleList(pageCapture);
items = await Promise.all(items.map((item) => getArticle(item)));
return {
title: pageCapture("title").text(),
description: pageDescription,
link: pageURL,
item: items
};
}
//#endregion
export { route };