rsshub
Version:
Make RSS Great Again!
65 lines (63 loc) • 2.14 kB
JavaScript
import "./esm-shims-CzJ_djXG.mjs";
import "./config-C37vj7VH.mjs";
import "./dist-BInvbO1W.mjs";
import "./logger-Czu8UMNd.mjs";
import { t as ofetch_default } from "./ofetch-BIyrKU3Y.mjs";
import { t as parseDate } from "./parse-date-BrP7mxXf.mjs";
//#region lib/routes/questn/community.ts
const route = {
path: "/community/:communityUrl",
name: "Community Events",
url: "app.questn.com",
maintainers: ["cxheng315"],
example: "/questn/community/gmnetwork",
parameters: { community_url: "Community URL" },
categories: ["other"],
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
radar: [{
source: ["app.questn.com/:communityUrl"],
target: "/community/:communityUrl"
}],
handler
};
async function handler(ctx) {
const url = "https://api.questn.com/consumer/explore/entity_list/";
const params = {
count: ctx.req.query("limit") || "20",
page: "1",
community_url: ctx.req.param("communityUrl") || "questn"
};
const data = await (await ofetch_default(`${url}?${new URLSearchParams(params)}`, {
method: "GET",
headers: { "Content-Type": "application/json" }
})).result.data;
const items = data.map((item) => ({
title: item.title,
link: `https://app.questn.com/quest/${item.id}`,
author: item.community_info ? item.community_info.name : "",
guid: item.id,
pubDate: parseDate(item.start_time * 1e3),
itunes_duration: item.end_time > 0 ? item.end_time - item.start_time : 0
}));
return {
title: `QuestN Community - ${data[0].community_info ? data[0].community_info.name : ""} Events`,
link: `https://app.questn.com/${ctx.req.param("community_url")}`,
description: data[0].community_info ? data[0].community_info.introduction : "",
image: data[0].community_info ? data[0].community_info.logo : "",
logo: data[0].community_info ? data[0].community_info.logo : "",
item: items && items.length > 0 ? items : [{
title: "No events found",
link: `https://app.questn.com/${ctx.req.param("community_url")}`,
description: "No events found"
}]
};
}
//#endregion
export { route };