Skip to content
GitLab
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
bc8b78d4
Commit
bc8b78d4
authored
Jun 17, 2020
by
Volker Krause
Browse files
Extract seat reservation information from Ouigo confirmations
CCBUG: 404451
parent
6a7869e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/extractors/sncf.js
View file @
bc8b78d4
...
...
@@ -131,11 +131,14 @@ function parseOuigoConfirmation(html)
var
productDts
=
html
.
eval
(
'
//*[@class="product-travel-date"]
'
);
var
productDetails
=
html
.
eval
(
'
//table[@class="product-details"]
'
);
var
passengerDetails
=
html
.
eval
(
'
//table[@class="passengers"]
'
);
for
(
productDetailIdx
in
productDetails
)
{
// date is in the table before us
var
dt
=
productDts
[
productDetailIdx
].
content
.
replace
(
/
\S
+
(
.*
)
/
,
"
$1
"
);
var
segmentDetail
=
productDetails
[
productDetailIdx
].
eval
(
"
.//td
"
)[
0
];
var
placement
=
passengerDetails
[
productDetailIdx
].
eval
(
'
.//td[@class="placement "]
'
);
// yes, there is a space behind placement there...
var
seat
=
placement
[
0
].
content
.
match
(
/Voiture
(
.*
?)
- Place
(
.*
?)
/
);
var
res
=
null
;
while
(
segmentDetail
&&
!
segmentDetail
.
isNull
)
{
var
cls
=
segmentDetail
.
attribute
(
"
class
"
);
...
...
@@ -144,6 +147,10 @@ function parseOuigoConfirmation(html)
res
.
reservationFor
.
departureTime
=
JsonLd
.
toDateTime
(
dt
+
segmentDetail
.
content
,
"
d MMMMhh'h'mm
"
,
"
fr
"
);
segmentDetail
=
segmentDetail
.
nextSibling
;
res
.
reservationFor
.
departureStation
.
name
=
segmentDetail
.
content
;
if
(
seat
)
{
res
.
reservedTicket
.
ticketedSeat
.
seatSection
=
seat
[
1
];
res
.
reservedTicket
.
ticketedSeat
.
seatNumber
=
seat
[
2
];
}
}
else
if
(
cls
.
includes
(
"
segment-arrival
"
))
{
res
.
reservationFor
.
arrivalTime
=
JsonLd
.
toDateTime
(
dt
+
segmentDetail
.
content
,
"
d MMMMhh'h'mm
"
,
"
fr
"
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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