rsshub
Version:
Make RSS Great Again!
41 lines (40 loc) • 1.8 kB
JavaScript
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs";
import { t as cache_default } from "./cache-CiDoUSLo.mjs";
import { load } from "cheerio";
//#region lib/routes/blur/index.ts
const route = {
path: "/",
categories: ["design"],
example: "/blur",
name: "Works",
maintainers: ["MisteryMonster"],
handler
};
async function handler() {
const rootUrl = "http://blur.com";
const $ = load(await rofetch(rootUrl));
const videostyle = "width=\"640\" height=\"360\"";
const imgstyle = "style=\"max-width: 650px; height: auto; object-fit: contain; flex: 0 0 auto;\"";
return {
title: "Blur Studio",
link: rootUrl,
item: await Promise.all($(".page-title a").toArray().map((item) => {
const link = $(item).attr("href");
return cache_default.tryGet(link, async () => {
const $2 = load(await rofetch(link));
const mainvideo = $2("div.project-title").attr("data-video");
let content = `Client:${$2("div.client").text()}<br>${$2("p").text()}`;
content += /\d+/.test(mainvideo ?? "") ? `<iframe ${videostyle} src='https://player.vimeo.com/video/${mainvideo}' frameborder='0' webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe><br>` : `<iframe ${videostyle} src='https://youtube.com/embed/${mainvideo}' frameborder='0' webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe><br>`;
for (const img of $2(".gridded img").toArray()) content += `<img ${imgstyle} src="${$2(img).attr("src")}"><br>`;
for (const video of $2(".gridded iframe").toArray()) content += `<iframe ${videostyle} src='${$2(video).attr("src")}' frameborder='0' webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe><br>`;
return {
title: $2("h1.page-title").text(),
description: content,
link
};
});
}))
};
}
//#endregion
export { route };