mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-11 07:40:26 +08:00
fix(route): Fix pubDate and show full title w/ link in description (verfghbw) (#7191)
* Fix pubDate, show title w/ link in description * refactor(route): migrate to v2 Co-authored-by: TonyRL <TonyRL@users.noreply.github.com>
This commit is contained in:
@@ -3982,8 +3982,8 @@ router.get('/liyuan-forums/threads/user/:user_id', lazyloadRouteHandler('./route
|
|||||||
// router.get('/jisilu/reply/:user', lazyloadRouteHandler('./routes/jisilu/reply'));
|
// router.get('/jisilu/reply/:user', lazyloadRouteHandler('./routes/jisilu/reply'));
|
||||||
// router.get('/jisilu/topic/:user', lazyloadRouteHandler('./routes/jisilu/topic'));
|
// router.get('/jisilu/topic/:user', lazyloadRouteHandler('./routes/jisilu/topic'));
|
||||||
|
|
||||||
// Constitutional Court of Baden-Württemberg (Germany)
|
// Constitutional Court of Baden-Württemberg (Germany) migrated to v2
|
||||||
router.get('/verfghbw/press/:keyword?', lazyloadRouteHandler('./routes/verfghbw/press'));
|
// router.get('/verfghbw/press/:keyword?', lazyloadRouteHandler('./routes/verfghbw/press'));
|
||||||
|
|
||||||
// Topbook
|
// Topbook
|
||||||
router.get('/topbook/overview/:id?', lazyloadRouteHandler('./routes/topbook/overview'));
|
router.get('/topbook/overview/:id?', lazyloadRouteHandler('./routes/topbook/overview'));
|
||||||
|
|||||||
3
lib/v2/verfghbw/maintainer.js
Normal file
3
lib/v2/verfghbw/maintainer.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
module.exports = {
|
||||||
|
'/press/:keyword?': ['quinn-dev'],
|
||||||
|
};
|
||||||
@@ -1,13 +1,15 @@
|
|||||||
const got = require('@/utils/got');
|
const got = require('@/utils/got');
|
||||||
const cheerio = require('cheerio');
|
const cheerio = require('cheerio');
|
||||||
|
const { parseDate } = require('@/utils/parse-date');
|
||||||
|
|
||||||
module.exports = async (ctx) => {
|
module.exports = async (ctx) => {
|
||||||
const keyword = ctx.params.keyword;
|
const keyword = ctx.params.keyword;
|
||||||
|
const rootUrl = 'https://verfgh.baden-wuerttemberg.de';
|
||||||
|
|
||||||
let request = {
|
let request = {
|
||||||
url: 'https://verfgh.baden-wuerttemberg.de/de/presse-und-service/pressemitteilungen/',
|
url: `${rootUrl}/de/presse-und-service/pressemitteilungen/`,
|
||||||
headers: {
|
headers: {
|
||||||
Referer: 'https://verfgh.baden-wuerttemberg.de/de/presse-und-service/pressemitteilungen/',
|
Referer: `${rootUrl}/de/presse-und-service/pressemitteilungen/`,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -35,10 +37,16 @@ module.exports = async (ctx) => {
|
|||||||
.map((_, item) => {
|
.map((_, item) => {
|
||||||
item = $(item);
|
item = $(item);
|
||||||
|
|
||||||
|
const title = item.find('.pressListItemTeaser > h3').text().trim();
|
||||||
|
const link = rootUrl + '/' + item.find('.link-download').attr('href');
|
||||||
|
item.find('.pressListItemTeaser > h3').replaceWith((_, e) => `<p>${$(e).html()}</p>`);
|
||||||
|
item.find('a').each((_, e) => $(e).attr('href', rootUrl + '/' + $(e).attr('href')));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
title: item.find('.pressListItemTeaser > h3').text().trim(),
|
title,
|
||||||
link: new URL(item.find('.link-download').attr('href'), 'https://verfgh.baden-wuerttemberg.de/'),
|
link,
|
||||||
pubDate: new Date(item.find('.pressListItemDate > span').text()).toUTCString(),
|
description: item.find('.pressListItemTeaser').html(),
|
||||||
|
pubDate: parseDate(item.find('.pressListItemDate > span').text(), 'DD.MM.YYYY'),
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
.get();
|
.get();
|
||||||
13
lib/v2/verfghbw/radar.js
Normal file
13
lib/v2/verfghbw/radar.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
module.exports = {
|
||||||
|
'baden-wuerttemberg.de': {
|
||||||
|
_name: 'Constitutional Court of Baden-Württemberg (Germany)',
|
||||||
|
verfgh: [
|
||||||
|
{
|
||||||
|
title: 'Press releases',
|
||||||
|
docs: 'https://docs.rsshub.app/en/government.html#constitutional-court-of-baden-wurttemberg-germany',
|
||||||
|
source: ['/de/presse-und-service/pressemitteilungen/'],
|
||||||
|
target: '/verfghbw/press',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
3
lib/v2/verfghbw/router.js
Normal file
3
lib/v2/verfghbw/router.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
module.exports = (router) => {
|
||||||
|
router.get('/press/:keyword?', require('./press'));
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user