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 fetchEvents = async (): Promise<MiastamaszerujaceEvent[]> => {
|
||||||
const events: 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 html = await (await fetch('https://miastamaszerujace.pl/')).text();
|
||||||
const dom = new JSDOM(html
|
const dom = new JSDOM(html
|
||||||
// manual fixes for irregular HTML
|
// manual fixes for irregular HTML
|
||||||
.replace(new RegExp('ref=newsfeed</a><br /><b>', 'g'), '</a></p><p><b>')
|
.replace(new RegExp('ref=newsfeed</a><br /><b>', 'g'), '</a></p><p><b>')
|
||||||
.replace(new RegExp('<span style="font-weight: 400;">(.*?)</span>', 'g'), '$1'));
|
.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"]');
|
const eventNodes = dom.window.document.querySelectorAll('[data-id="d4c3075"] p');
|
||||||
for (const eventImg of eventsImgs) {
|
for (const p of eventNodes) {
|
||||||
const p = eventImg.closest('p')!;
|
if (p.textContent!.includes('Daty kolejnych') ||
|
||||||
if (p.textContent!.includes('Daty kolejnych') || p.textContent!.includes('Marsz organizowany przez grupę współpracującą')) {
|
p.textContent!.includes('Marsz organizowany przez grupę współpracującą') ||
|
||||||
|
p.textContent!.includes('Opublikowane do tej pory')
|
||||||
|
) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,7 +44,9 @@ const fetchEvents = async (): Promise<MiastamaszerujaceEvent[]> => {
|
|||||||
.filter((c) => c.nodeType === 3 /* text node */ || c.nodeName === 'A')
|
.filter((c) => c.nodeType === 3 /* text node */ || c.nodeName === 'A')
|
||||||
.map((c) => c.textContent!.trim())
|
.map((c) => c.textContent!.trim())
|
||||||
.filter((t) => !!t)
|
.filter((t) => !!t)
|
||||||
.join(' ');
|
.join(' ')
|
||||||
|
.replace(/^– /, '')
|
||||||
|
;
|
||||||
|
|
||||||
let link = null;
|
let link = null;
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user