feat(route/wogem): Add route for WOGEM.at housing cooperative (#20555)

* feat(category): add housing category

* feat(route/wogem): add route for wogem.at

* Revert "feat(category): add housing category"

This reverts commit 953f59421717592dc5d8f2e0d8c42b5d54c77c72.

* feat(route/wogem): change category

* fix(route/wogem): remove redundant filter parameter

---------

Co-authored-by: Samuel Kaiser <samuel.kaiser@timetoact.at>
This commit is contained in:
sk22
2025-11-28 00:15:13 +08:00
committed by GitHub
co-authored by Samuel Kaiser
parent 255b97559e
commit a590f9a723
2 changed files with 60 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
import { load } from 'cheerio';
import type { Data, DataItem, Route } from '@/types';
import ofetch from '@/utils/ofetch';
const FEED_TITLE = 'WOGEM' as const;
const FEED_LANGUAGE = 'de' as const;
const FEED_LOGO = 'https://www.wogem.at/de/favicon.ico';
const BASE_URL = 'https://www.wogem.at/de/' as const;
export const route: Route = {
name: 'Angebote',
example: '/wogem/angebote?filter=Graz',
path: '/:page?',
maintainers: ['sk22'],
categories: ['other'],
description: `Pass in the name of the php file, e.g. \`angebote\` for \`/de/angebote.php\`\`.`,
parameters: {
page: 'Page name, e.g. `angebote` for `angebote.php. Defaults to `angebote`',
},
async handler(ctx) {
const page = ctx.req.param('page') || 'angebote';
const link = `${BASE_URL}${page}.php`;
const response = await ofetch(link);
const $ = load(response);
const heading = $('h1').text().split('\n')[0].trim();
const items = $('.col-md-12 > h3 > a')
.toArray()
.map((el) => {
const $el = $(el);
const href = $el.attr('href');
const title = $el.text();
return {
title,
link: href?.startsWith('?') ? link + href : href,
// no pubDate or image :(
} satisfies DataItem;
});
return {
title: `${heading} - ${FEED_TITLE}`,
language: FEED_LANGUAGE,
logo: FEED_LOGO,
allowEmpty: true,
item: items,
link,
} satisfies Data;
},
};
+7
View File
@@ -0,0 +1,7 @@
import type { Namespace } from '@/types';
export const namespace: Namespace = {
name: 'WOGEM',
url: 'wogem.at',
description: 'Gemeinnützige Wohn-, Bau- und Siedlungsgesellschaft m.b.H',
};