rsshub
Version:
Make RSS Great Again!
73 lines (71 loc) • 2.61 kB
JavaScript
import "./config-C37vj7VH.mjs";
import "./logger-Czu8UMNd.mjs";
import { t as parseDate } from "./parse-date-BrP7mxXf.mjs";
import { t as cache_default } from "./cache-Bo__VnGm.mjs";
import "./proxy-Db7uGcYb.mjs";
import { n as puppeteer_default } from "./puppeteer-DGmvuGvT.mjs";
import * as cheerio from "cheerio";
//#region lib/routes/bluestacks/release.ts
const pageUrl = "https://support.bluestacks.com/hc/en-us/articles/360056960211-Release-Notes-BlueStacks-5";
const route = {
path: "/release/5",
categories: ["program-update"],
example: "/bluestacks/release/5",
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: true,
antiCrawler: true,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
radar: [{ source: ["bluestacks.com/hc/en-us/articles/360056960211-Release-Notes-BlueStacks-5", "bluestacks.com/"] }],
name: "BlueStacks 5 Release Notes",
maintainers: ["TonyRL"],
handler,
url: "bluestacks.com/hc/en-us/articles/360056960211-Release-Notes-BlueStacks-5"
};
async function handler() {
const browser = await puppeteer_default();
const page = await browser.newPage();
await page.setRequestInterception(true);
page.on("request", (request) => {
request.resourceType() === "document" || request.resourceType() === "script" ? request.continue() : request.abort();
});
await page.goto(pageUrl, { waitUntil: "domcontentloaded" });
const res = await page.evaluate(() => document.documentElement.innerHTML);
await page.close();
const $ = cheerio.load(res);
const items = $("div h3 a").toArray().map((item) => {
item = $(item);
return {
title: item.text(),
link: item.attr("href")
};
});
await Promise.all(items.map((item) => cache_default.tryGet(item.link, async () => {
const page$1 = await browser.newPage();
await page$1.setRequestInterception(true);
page$1.on("request", (request) => {
request.resourceType() === "document" || request.resourceType() === "script" ? request.continue() : request.abort();
});
await page$1.goto(item.link, { waitUntil: "domcontentloaded" });
const res$1 = await page$1.evaluate(() => document.documentElement.innerHTML);
const $$1 = cheerio.load(res$1);
await page$1.close();
item.description = $$1("div.article__body").html();
item.pubDate = parseDate($$1("div.meta time").attr("datetime"));
return item;
})));
await browser.close();
return {
title: $(".article__title").text().trim(),
description: $("meta[name=description]").text().trim(),
link: pageUrl,
image: $("link[rel=\"shortcut icon\"]").attr("href"),
item: items
};
}
//#endregion
export { route };