rsshub
Version:
Make RSS Great Again!
68 lines (66 loc) • 2.18 kB
JavaScript
import "./dist-Bog6z_OM.mjs";
import { t as config } from "./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 { t as config_not_found_default } from "./config-not-found-zoFMPvbz.mjs";
import { i as queryToInteger, t as fallback } from "./readable-social-CExV9fL0.mjs";
import { t as utils_default } from "./utils-B0n2y57r.mjs";
//#region lib/routes/tumblr/tagged.ts
const route = {
path: "/tagged/:tag",
categories: ["social-media"],
example: "/tumblr/tagged/nature",
parameters: { tag: "Tag name (see `https://www.tumblr.com/docs/en/api/v2#tagged--get-posts-with-tag`)" },
radar: [],
features: {
requireConfig: [
{
name: "TUMBLR_CLIENT_ID",
description: "Please see above for details."
},
{
name: "TUMBLR_CLIENT_SECRET",
description: "Please see above for details."
},
{
name: "TUMBLR_REFRESH_TOKEN",
description: "Please see above for details."
}
],
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
name: "Tagged Posts",
maintainers: ["PolarisStarnor"],
handler
};
async function handler(ctx) {
if (!config.tumblr || !config.tumblr.clientId) throw new config_not_found_default("Tumblr RSS is disabled due to the lack of <a href=\"https://docs.rsshub.app/deploy/config#route-specific-configurations\">relevant config</a>");
const tag = ctx.req.param("tag");
const limit = fallback(void 0, queryToInteger(ctx.req.query("limit")), 20);
const posts = (await got_default.get("https://api.tumblr.com/v2/tagged", {
searchParams: {
tag,
api_key: utils_default.generateAuthParams(),
limit
},
headers: await utils_default.generateAuthHeaders()
})).data.response.map((post) => utils_default.processPost(post));
return {
title: `Tumblr - ${tag}`,
description: `Tumblr posts tagged #${tag}`,
link: `https://tumblr.com/tagged/${tag}`,
item: posts,
allowEmpty: true
};
}
//#endregion
export { route };