rsshub
Version:
Make RSS Great Again!
58 lines (56 loc) • 2.08 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 { load } from "cheerio";
//#region lib/routes/wbv-gpa/index.ts
const FEED_LANGUAGE = "de";
const FEED_LOGO = "https://www.wbv-gpa.at/app/uploads/2024/01/cropped-WBV-Favicon-192x192.png";
const SITE_URL = "https://www.wbv-gpa.at";
const BASE_URL = `${SITE_URL}/angebote/`;
const route = {
name: "Angebote",
example: "/wbv-gpa/wohnungen/wien",
path: "/:category?/:state?",
maintainers: ["sk22"],
categories: ["other"],
description: `
Search housing by WBV-GPA, see "Angebote" menu item in https://www.wbv-gpa.at.
Filtering by state is done client-side.
`,
parameters: {
category: "Anything behind `/angebote/` in the URL. Default: `wohnungen`",
state: "Optionally filter by Austrian state (`wien`, `steiermark`, ...)"
},
radar: [{
source: [`${SITE_URL}/wohnungen/`, `${BASE_URL}/:category`],
target: "/:category"
}],
async handler(ctx) {
const category = ctx.req.param("category") || "wohnungen";
const state = ctx.req.param("state");
const link = BASE_URL + category;
const $ = load(await ofetch_default(link));
return {
title: $("title").text(),
language: FEED_LANGUAGE,
logo: FEED_LOGO,
allowEmpty: true,
item: $(".objects__list__rows__item.mix").toArray().map((el) => {
const $el = $(el);
const link$1 = $el.find("a").attr("href");
const title = $el.find(".objects__list__rows__item__info__cell:not(.desktop_only):not(.objects__list__rows__item__info__cell--link)").toArray().map((el$1) => $(el$1).text().trim()).join(", ");
const description = $el.find(".objects__list__rows__item__info__cell.desktop_only:not(.objects__list__rows__item__info__cell--link)").toArray().map((el$1) => $(el$1).text().trim()).join(", ");
return state && !$el.hasClass(state) ? false : {
title,
description,
link: link$1
};
}).filter((item) => item !== false),
link
};
}
};
//#endregion
export { route };