webpeel 0.21.75 → 0.21.76
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/domain-extractors.js +30 -17
- package/package.json +1 -1
|
@@ -5987,24 +5987,37 @@ async function googleFlightsExtractor(_html, url) {
|
|
|
5987
5987
|
return null;
|
|
5988
5988
|
unique.sort((a, b) => a.price - b.price);
|
|
5989
5989
|
// Helper: get airline booking URL
|
|
5990
|
-
function getAirlineBookingUrl(airline, from, to) {
|
|
5991
|
-
|
|
5992
|
-
const
|
|
5990
|
+
function getAirlineBookingUrl(airline, from, to, dateStr) {
|
|
5991
|
+
// Parse date from "Sat, Apr 4" → "2026-04-04" or "04/04/2026" etc.
|
|
5992
|
+
const months = { Jan: '01', Feb: '02', Mar: '03', Apr: '04', May: '05', Jun: '06', Jul: '07', Aug: '08', Sep: '09', Oct: '10', Nov: '11', Dec: '12' };
|
|
5993
|
+
let isoDate = '';
|
|
5994
|
+
let mmddDate = '';
|
|
5995
|
+
const dm = dateStr.match(/(\w{3})\s+(\d{1,2})/);
|
|
5996
|
+
if (dm) {
|
|
5997
|
+
const mon = months[dm[1]] || '01';
|
|
5998
|
+
const day = dm[2].padStart(2, '0');
|
|
5999
|
+
const year = new Date().getFullYear(); // current year
|
|
6000
|
+
isoDate = `${year}-${mon}-${day}`;
|
|
6001
|
+
mmddDate = `${mon}/${day}/${year}`;
|
|
6002
|
+
}
|
|
6003
|
+
const fromUp = from.toUpperCase();
|
|
6004
|
+
const toUp = to.toUpperCase();
|
|
6005
|
+
// Deep links with pre-filled origin, destination, date, 1 passenger
|
|
5993
6006
|
const urlMap = {
|
|
5994
|
-
'United': `https://www.united.com/en
|
|
5995
|
-
'Delta': `https://www.delta.com/flight-search/
|
|
5996
|
-
'JetBlue': `https://www.jetblue.com/booking/flights`,
|
|
5997
|
-
'American': `https://www.aa.com/booking/find-flights`,
|
|
5998
|
-
'Spirit': `https://www.spirit.com/book/flights`,
|
|
5999
|
-
'Frontier': `https://www.flyfrontier.com/booking
|
|
6000
|
-
'Southwest': `https://www.southwest.com/air/booking
|
|
6001
|
-
'Breeze': `https://www.flybreeze.com/home`,
|
|
6002
|
-
'Alaska': `https://www.alaskaair.com/
|
|
6003
|
-
'Hawaiian': `https://www.hawaiianairlines.com/book
|
|
6004
|
-
'Sun Country': `https://www.suncountry.com/booking/search`,
|
|
6005
|
-
'Avelo': `https://www.aveloair.com/book`,
|
|
6007
|
+
'United': `https://www.united.com/ual/en/us/flight-search/book-a-flight/results/rev?f=${fromUp}&t=${toUp}&d=${isoDate}&tt=1&at=1&sc=7&px=1&taxng=1&newHP=True&clm=7&st=bestmatches&tqp=A`,
|
|
6008
|
+
'Delta': `https://www.delta.com/flight-search/book-a-flight?departure=${fromUp}&arrival=${toUp}&departureDate=${mmddDate}&paxCount=1&tripType=ONE_WAY`,
|
|
6009
|
+
'JetBlue': `https://www.jetblue.com/booking/flights?from=${fromUp}&to=${toUp}&depart=${isoDate}&is498=true&is498=${true}&pax=1`,
|
|
6010
|
+
'American': `https://www.aa.com/booking/find-flights?origin=${fromUp}&destination=${toUp}&departureDate=${isoDate}&tripType=OneWay&pax=1`,
|
|
6011
|
+
'Spirit': `https://www.spirit.com/book/flights?origin=${fromUp}&destination=${toUp}&departureDate=${isoDate}&adults=1&tripType=oneWay`,
|
|
6012
|
+
'Frontier': `https://www.flyfrontier.com/booking/flights?origin=${fromUp}&destination=${toUp}&date=${isoDate}&adults=1`,
|
|
6013
|
+
'Southwest': `https://www.southwest.com/air/booking/select.html?originationAirportCode=${fromUp}&destinationAirportCode=${toUp}&departureDate=${isoDate}&adultPassengersCount=1&tripType=oneway`,
|
|
6014
|
+
'Breeze': `https://www.flybreeze.com/home?from=${fromUp}&to=${toUp}&depart=${isoDate}&pax=1`,
|
|
6015
|
+
'Alaska': `https://www.alaskaair.com/shopping/flights?A=${fromUp}&B=${toUp}&DT=${isoDate}&FT=ow&C=1`,
|
|
6016
|
+
'Hawaiian': `https://www.hawaiianairlines.com/book/results?origin=${fromUp}&destination=${toUp}&departDate=${isoDate}&adults=1&tripType=ow`,
|
|
6017
|
+
'Sun Country': `https://www.suncountry.com/booking/search?from=${fromUp}&to=${toUp}&depart=${isoDate}&passengers=1`,
|
|
6018
|
+
'Avelo': `https://www.aveloair.com/book?from=${fromUp}&to=${toUp}&depart=${isoDate}`,
|
|
6006
6019
|
};
|
|
6007
|
-
return urlMap[airline] || `https://www.google.com/
|
|
6020
|
+
return urlMap[airline] || `https://www.google.com/travel/flights?q=${encodeURIComponent(`${airline} flights ${from} to ${to} ${dateStr}`)}`;
|
|
6008
6021
|
}
|
|
6009
6022
|
// Parse route from URL
|
|
6010
6023
|
const u = new URL(url);
|
|
@@ -6018,7 +6031,7 @@ async function googleFlightsExtractor(_html, url) {
|
|
|
6018
6031
|
];
|
|
6019
6032
|
for (let idx = 0; idx < unique.length; idx++) {
|
|
6020
6033
|
const f = unique[idx];
|
|
6021
|
-
const bookingUrl = getAirlineBookingUrl(f.airline, f.fromAirport, f.toAirport);
|
|
6034
|
+
const bookingUrl = getAirlineBookingUrl(f.airline, f.fromAirport, f.toAirport, f.departDate);
|
|
6022
6035
|
md.push(`## ${idx + 1}. ${f.airline} — ${f.priceStr}`);
|
|
6023
6036
|
md.push(`🕐 Depart **${f.departTime}** → Arrive **${f.arriveTime}**${f.departDate ? ` · ${f.departDate}` : ''}`);
|
|
6024
6037
|
md.push(`🛫 ${f.fromAirport} → ${f.toAirport} · ${f.duration} · ${f.stops}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webpeel",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.76",
|
|
4
4
|
"description": "Fast web fetcher for AI agents - stealth mode, crawl mode, page actions, structured extraction, PDF parsing, smart escalation from simple HTTP to headless browser",
|
|
5
5
|
"author": "Jake Liu",
|
|
6
6
|
"license": "AGPL-3.0-only",
|