mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-23 04:34:15 -04:00
(pl) miastamaszerujace 2025
This commit is contained in:
parent
08c7e37e28
commit
ac1e8677b0
@ -20,15 +20,20 @@ const year = Day.today().year;
|
||||
const fetchEvents = async (): Promise<MiastamaszerujaceEvent[]> => {
|
||||
const events: MiastamaszerujaceEvent[] = [];
|
||||
|
||||
// issue with third-party cert: Verification error: unable to verify the first certificate
|
||||
// browser and curl accepts the certificate, but node seems more picky
|
||||
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
|
||||
const html = await (await fetch('https://miastamaszerujace.pl/')).text();
|
||||
const dom = new JSDOM(html
|
||||
// manual fixes for irregular HTML
|
||||
.replace(new RegExp('ref=newsfeed</a><br /><b>', 'g'), '</a></p><p><b>')
|
||||
.replace(new RegExp('<span style="font-weight: 400;">(.*?)</span>', 'g'), '$1'));
|
||||
const eventsImgs = dom.window.document.querySelectorAll('img[src="https://miastamaszerujace.pl/wp-content/uploads/2021/11/Zasob-6@4x.png"]');
|
||||
for (const eventImg of eventsImgs) {
|
||||
const p = eventImg.closest('p')!;
|
||||
if (p.textContent!.includes('Daty kolejnych') || p.textContent!.includes('Marsz organizowany przez grupę współpracującą')) {
|
||||
const eventNodes = dom.window.document.querySelectorAll('[data-id="d4c3075"] p');
|
||||
for (const p of eventNodes) {
|
||||
if (p.textContent!.includes('Daty kolejnych') ||
|
||||
p.textContent!.includes('Marsz organizowany przez grupę współpracującą') ||
|
||||
p.textContent!.includes('Opublikowane do tej pory')
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -39,7 +44,9 @@ const fetchEvents = async (): Promise<MiastamaszerujaceEvent[]> => {
|
||||
.filter((c) => c.nodeType === 3 /* text node */ || c.nodeName === 'A')
|
||||
.map((c) => c.textContent!.trim())
|
||||
.filter((t) => !!t)
|
||||
.join(' ');
|
||||
.join(' ')
|
||||
.replace(/^– /, '')
|
||||
;
|
||||
|
||||
let link = null;
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user