rsshub
Version:
Make RSS Great Again!
60 lines (58 loc) • 2.23 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 "./parse-date-BrP7mxXf.mjs";
import { r as getSubPath } from "./common-utils-vrWQFAEk.mjs";
import { load } from "cheerio";
//#region lib/routes/oesw/index.ts
const FEED_LANGUAGE = "de";
const FEED_LOGO = "https://www.oesw.at/fileadmin/Logos/OeSW_AG/OeSW-Logo2024-RGB.png";
const SITE_URL = "https://www.oesw.at";
const BASE_URL = `${SITE_URL}/immobilienangebot/`;
const route = {
name: "Immobilienangebot",
example: "/oesw/sofort-verfuegbar/objectType=1&financingType=2®ion=1020",
path: "*",
maintainers: ["sk22"],
categories: ["other"],
description: `Get your parameters on ${SITE_URL} under "Immobilienangebot".
Make sure to remove the \`?\` at the beginning from the query parameters!`,
async handler(ctx) {
const parts = getSubPath(ctx).split("/");
const listingPage = parts[1] || "immobiliensuche";
let params = parts[2] || "";
if (params.startsWith("&")) params = params.slice(1);
const link = `${BASE_URL}${listingPage}.html?${params}`;
const $ = load(await ofetch_default(link));
return {
title: $("title").text(),
language: FEED_LANGUAGE,
logo: FEED_LOGO,
allowEmpty: true,
item: $("li[data-objlist-url] > a").toArray().map((el) => {
const count = $(el).find(".boardPic > .count").text().trim();
const category = $(el).find(".boardPic > .label").toArray().map((l) => $(l).text().trim()).filter((l) => l.length);
const titles = [el.attribs["data-title2"].trim(), el.attribs["data-title"].trim()].filter((t) => t.length);
const imageSrc = el.attribs["data-largesrc"];
const image = imageSrc.startsWith("/") ? SITE_URL + imageSrc : imageSrc;
return {
guid: el.attribs.href + (count ? `#count-${count}` : ""),
title: (count ? `(${count}) ` : "") + titles.join(", "),
link: el.attribs.href,
description: el.attribs["data-description"],
category,
image,
content: {
html: el.attribs["data-description-long"],
text: el.attribs["data-description-long"]
}
};
}),
link
};
}
};
//#endregion
export { route };