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
2ffa3e1f
Commit
2ffa3e1f
authored
Dec 16, 2020
by
Vitaliy Ry
Committed by
Volker Krause
Dec 18, 2020
Browse files
Agoda extractor (Russian only)
parent
58fbd72e
Pipeline
#44534
passed with stage
in 10 minutes and 41 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/extractors/agoda.js
0 → 100644
View file @
2ffa3e1f
/*
SPDX-FileCopyrightText: 2020 Vitaliy Ry vit@ntcsys.ru
SPDX-License-Identifier: LGPL-2.0-or-later
*/
function
main
(
content
)
{
var
res
=
JsonLd
.
newLodgingReservation
();
var
bookingRef
=
content
.
eval
(
"
//span[@id='lblBookingIdData']
"
);
var
arrivalDate
=
content
.
eval
(
"
//span[@id='lblCheckInData']
"
);
var
arrivalTime
=
content
.
eval
(
"
//span[@id='lblHotelCheckInData']
"
);
var
departureDate
=
content
.
eval
(
"
//span[@id='lblCheckOutData']
"
);
var
departureTime
=
content
.
eval
(
"
//span[@id='lblHotelCheckOutData']
"
);
var
hotelName
=
content
.
eval
(
"
//span[@id='lblHotelNameData']
"
);
var
hotelAddress
=
content
.
eval
(
"
//span[@id='lblHotelAddressData']
"
);
var
hotelCoordinates
=
content
.
eval
(
"
//a[@id='linkMap']/@href
"
);
var
gpsCoordinates
=
hotelCoordinates
[
0
].
content
.
match
(
/
(\d
+
\.\d
+,
\d
+
\.\d
+
)
/
)[
0
].
split
(
"
,
"
);
var
d1
=
arrivalDate
[
0
].
content
.
match
(
/
(
.*
\d{4})
/
)[
0
]
+
arrivalTime
[
0
].
content
.
match
(
/
(\d{2}
:
\d{2})
/
)[
0
];
var
d2
=
departureDate
[
0
].
content
.
match
(
/
(
.*
\d{4})
/
)[
0
]
+
departureTime
[
0
].
content
.
match
(
/
(\d{2}
:
\d{2})
/
)[
0
];
res
.
reservationNumber
=
bookingRef
[
0
].
content
;
res
.
reservationFor
.
name
=
hotelName
[
0
].
content
;
res
.
reservationFor
.
address
.
streetAddress
=
hotelAddress
[
0
].
content
;
res
.
checkinTime
=
JsonLd
.
toDateTime
(
d1
,
"
dd MMMM yyyyhh:mm
"
,
"
ru
"
);
res
.
checkoutTime
=
JsonLd
.
toDateTime
(
d2
,
"
dd MMMM yyyyhh:mm
"
,
"
ru
"
);
res
.
reservationFor
.
geo
.
latitude
=
gpsCoordinates
[
0
];
res
.
reservationFor
.
geo
.
longitude
=
gpsCoordinates
[
1
];
return
res
;
}
src/extractors/agoda.json
0 → 100644
View file @
2ffa3e1f
{
"filter"
:
[
{
"header"
:
"From"
,
"match"
:
"@agoda.com"
,
"type"
:
"Email"
}
],
"function"
:
"main"
,
"script"
:
"agoda.js"
,
"type"
:
"Html"
}
src/extractors/extractors.qrc
View file @
2ffa3e1f
...
...
@@ -6,6 +6,8 @@
<file>acprail.js</file>
<file>aerlingus.json</file>
<file>aerlingus.js</file>
<file>agoda.json</file>
<file>agoda.js</file>
<file>airbaltic.json</file>
<file>airbaltic.js</file>
<file>aircoach-ie.json</file>
...
...
Write
Preview
Supports
Markdown
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