Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KItinerary
Commits
c69d34ab
Commit
c69d34ab
authored
Jun 22, 2021
by
Nicolas Fella
Browse files
Add terminland extractor
Terminland is sending emails for covid test appointments
parent
15906f39
Pipeline
#67061
canceled with stages
Changes
3
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
src/lib/scripts/extractors.qrc
View file @
c69d34ab
...
...
@@ -103,6 +103,8 @@
<file>stansted-express.js</file>
<file>swiss.json</file>
<file>swiss.js</file>
<file>terminland-de.json</file>
<file>terminland-de.js</file>
<file>thalys.json</file>
<file>thalys.js</file>
<file>tierparkberlin.json</file>
...
...
src/lib/scripts/terminland-de.js
0 → 100644
View file @
c69d34ab
/*
SPDX-FileCopyrightText: 2020 Nicolas Fella <nicolas.fella@gmx.de>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
function
main
(
doc
)
{
var
res
=
JsonLd
.
newEventReservation
();
const
dateString
=
doc
.
eval
(
"
//div/div/span
"
)[
0
].
content
.
replace
(
"
\n
"
,
"
"
).
match
(
"
.*, (.*) Uhr
"
)[
1
]
const
addressBlock
=
doc
.
eval
(
"
//div/div
"
)[
2
].
content
.
split
(
"
\n
"
)
const
placeName
=
addressBlock
[
2
]
const
street
=
addressBlock
[
4
]
const
zipAndCity
=
addressBlock
[
5
]
const
zip
=
zipAndCity
.
match
(
/
([
0-9
]
*
)
/
)[
1
]
const
city
=
zipAndCity
.
match
(
/
[
0-9
]
*
(
.*
)
/
)[
1
]
const
firstName
=
doc
.
eval
(
"
//div/div/table/tr/td
"
)[
2
].
content
const
lastName
=
doc
.
eval
(
"
//div/div/table/tr/td
"
)[
5
].
content
const
cancelUrl
=
doc
.
eval
(
"
//div/div/div/a
"
)[
1
].
content
const
address
=
JsonLd
.
newObject
(
"
PostalAddress
"
)
address
.
addressCountry
=
"
DE
"
address
.
addressLocality
=
city
address
.
postalCode
=
zip
address
.
streetAddress
=
street
res
.
reservationFor
.
location
.
address
=
address
res
.
reservationFor
.
location
.
name
=
placeName
res
.
reservationFor
.
startDate
=
JsonLd
.
toDateTime
(
dateString
,
"
dd.MM.yyyy hh:mm
"
,
"
de
"
)
res
.
reservationFor
.
name
=
firstName
+
"
"
+
lastName
res
.
potentialAction
=
JsonLd
.
newObject
(
"
CancelAction
"
)
res
.
potentialAction
.
url
=
cancelUrl
return
res
}
src/lib/scripts/terminland-de.json
0 → 100644
View file @
c69d34ab
{
"filter"
:
[
{
"field"
:
"From"
,
"match"
:
"@terminland.de"
,
"mimeType"
:
"message/rfc822"
,
"scope"
:
"Ancestors"
}
],
"function"
:
"main"
,
"mimeType"
:
"text/html"
,
"script"
:
"terminland-de.js"
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment