diff --git a/src/extractors/extractors.qrc b/src/extractors/extractors.qrc
index 9b15a63..9da24ed 100644
--- a/src/extractors/extractors.qrc
+++ b/src/extractors/extractors.qrc
@@ -1,48 +1,50 @@
airbaltic.json
airbaltic.js
airfrance.json
airfrance.js
amadeus.json
amadeus.js
americanairlines.json
americanairlines.js
aohostels.json
aohostels.js
booking.json
booking.js
brusselsairlines.json
brusselsairlines.js
brusselsairlines-receipt.js
czechrailways.json
czechrailways.js
deutschebahn.json
deutschebahn.js
eurowings.json
eurowings.js
eurowings-pkpass.js
fcmtravel.json
fcmtravel.js
generic.json
generic.js
+ hertz.js
+ hertz.json
iberia.json
iberia.js
klm.json
klm.js
lufthansa.json
lufthansa-pkpass.js
regiojet.json
regiojet.js
sas.json
sas-boardingpass.js
sas-receipt.js
sncf.json
sncf.js
swiss.json
swiss.js
swiss-pkpass.js
- hertz.js
- hertz.json
+ vueling.json
+ vueling.js
diff --git a/src/extractors/generic.json b/src/extractors/generic.json
index 8591b1c..395cc5a 100644
--- a/src/extractors/generic.json
+++ b/src/extractors/generic.json
@@ -1,13 +1,12 @@
{
"type": "pdf",
"filter": [
{ "header": "From", "match": "airberlin.com" },
{ "header": "From", "match": "britishairways.com" },
{ "header": "From", "match": "finnair.com" },
{ "header": "From", "match": "tap.pt" },
- { "header": "From", "match": "united.com" },
- { "header": "From", "match": "vueling.com" }
+ { "header": "From", "match": "united.com" }
],
"script": "generic.js",
"function": "parsePdfBoardingPass"
}
diff --git a/src/extractors/vueling.js b/src/extractors/vueling.js
new file mode 100644
index 0000000..69eef1d
--- /dev/null
+++ b/src/extractors/vueling.js
@@ -0,0 +1,58 @@
+/*
+ Copyright (c) 2017 Volker Krause
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Library General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or (at your
+ option) any later version.
+
+ This library is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
+ License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to the
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301, USA.
+*/
+
+function parseHtmlBooking(doc) {
+ var reservations = new Array();
+
+ var bookingRef = doc.eval("//td[@class=\"vuelo_confirmado_header\"]")[0].firstChild.content.trim();
+ if (!bookingRef)
+ return null;
+
+ var elems = doc.eval("//td[@class=\"vuelo_confirmado_card__subheader\"]");
+ for (var i = 0; i < elems.length; ++i) {
+ var elem = elems[i];
+ var detailsRoot = elem.parent.nextSibling;
+
+ var res = JsonLd.newObject("FlightReservation");
+ res.reservationNumber = bookingRef;
+ res.reservationFor = JsonLd.newObject("Flight");
+
+ var airportName = detailsRoot.eval(".//td[@class=\"vuelo_confirmado_card_details--city salida\"]")[0];
+ var iataCode = detailsRoot.eval(".//td[@class=\"vuelo_confirmado_card_details--iata\"]")[0];
+ res.reservationFor.departureAirport = JsonLd.newObject("Airport");
+ res.reservationFor.departureAirport.iataCode = iataCode.content.trim();
+ res.reservationFor.departureAirport.name = airportName.content.trim();
+ res.reservationFor.arrivalAirport = JsonLd.newObject("Airport");
+ res.reservationFor.arrivalAirport.iataCode = iataCode.nextSibling.content.trim();
+ res.reservationFor.arrivalAirport.name = airportName.nextSibling.content.trim();
+
+ var time = detailsRoot.eval(".//td[@class=\"vuelo_confirmado_card_details--time\"]")[0];
+ res.reservationFor.departureTime = JsonLd.toDateTime(elem.content.trim() + ' ' + time.content.trim().replace('h', ''), "dddd, dd MMMM yyyy HH:mm", "es");
+ res.reservationFor.arrivalTime = JsonLd.toDateTime(elem.content.trim() + ' ' + time.nextSibling.content.trim().replace('h', ''), "dddd, dd MMMM yyyy HH:mm", "es");
+
+ var flightNum = detailsRoot.eval(".//td[@class=\"v-middle vuelo_confirmado_card_details--numVuelo\"]")[0].content.trim();
+ res.reservationFor.flightNumber = flightNum.substr(2);
+ res.reservationFor.airline = JsonLd.newObject("Airline");
+ res.reservationFor.airline.iataCode = flightNum.substr(0, 2);
+
+ reservations.push(res);
+ }
+
+ return reservations;
+}
diff --git a/src/extractors/vueling.json b/src/extractors/vueling.json
new file mode 100644
index 0000000..077da4f
--- /dev/null
+++ b/src/extractors/vueling.json
@@ -0,0 +1,14 @@
+[
+ {
+ "type": "html",
+ "filter": [ { "header": "From", "match": "@vueling.com" } ],
+ "script": "vueling.js",
+ "function": "parseHtmlBooking"
+ },
+ {
+ "type": "pdf",
+ "filter": [{ "header": "From", "match": "@vueling.com" }],
+ "script": "generic.js",
+ "function": "parsePdfBoardingPass"
+ }
+]