Commit ef4fe346 authored by Volker Krause's avatar Volker Krause
Browse files

Add event reservation extractor for German Red Cross blood donor service

parent 505a3b69
Pipeline #59837 passed with stages
in 11 minutes and 58 seconds
/*
SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
function parseReservation(html) {
var h4s = html.eval('//h4');
var res = JsonLd.newEventReservation();
res.reservationFor.name = h4s[0].content;
var dt = h4s[1].content.match(/(\d+\.\d+\.\d+) - (\d+:\d+)/);
res.reservationFor.startDate = JsonLd.toDateTime(dt[1] + dt[2], "dd.MM.yyyyhh:mm", "de");
res.reservationFor.location.name = h4s[2].content;
var addr = h4s[2].nextSibling.content.match(/(.*)\n+(.*)/);
res.reservationFor.location.address.streetAddress = addr[1];
res.reservationFor.location.address.addressLocality = addr[2];
var links = html.eval('//a');
res.modifyReservationUrl = links[links.length - 1].attribute('href');
return res;
}
{
"filter": [
{
"field": "From",
"match": "noreply@spenderservice.net",
"mimeType": "message/rfc822",
"scope": "Parent"
}
],
"function": "parseReservation",
"mimeType": "text/html",
"script": "drk-blutspendedienst.js"
}
......@@ -37,6 +37,8 @@
<file>deutschebahn.js</file>
<file>dinnerbooking.json</file>
<file>dinnerbooking.js</file>
<file>drk-blutspendedienst.json</file>
<file>drk-blutspendedienst.js</file>
<file>easyairportparking.json</file>
<file>easyairportparking-pkpass.js</file>
<file>easyjet.json</file>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment