Go Back  FlyerTalk Forums > Travel&Dining > Travel Tools
Reload this Page >

ITA-Matrix-PowerTools - Userscript for Orbitz/DL/UA/AA/BA/CZ/IB/LA/LH/LX/TK

ITA-Matrix-PowerTools - Userscript for Orbitz/DL/UA/AA/BA/CZ/IB/LA/LH/LX/TK

    Hide Wikipost
Old Jan 8, 19, 6:12 am   -   Wikipost
Please read: This is a community-maintained wiki post containing the most important information from this thread. You may edit the Wiki once you have been on FT for 90 days and have made 90 posts.
 
Last edit by: serfty
Wiki Link
Welcome to the ITA-Matrix-PowerTools
*** About ***
The ITA-Matrix-PowerTools are a user script maintained by fellow flyertalk members to enhance the already powerful Matrix of ITA Software by providing new features and booking links.

Features added to the itinerary details page:
  • convert times into 24h format
  • translation support
  • open fare rules in new window by default
  • price breakdown (base fare, taxes & carrier imposed surcharges)
  • editor mode (adjust cabin prior extraction)
  • multiple handy links (Seatguru, Planefinder, WhereToCredit)
  • new on page features like detailed mileage breakdown*, GCM-Map* and earned frequent flyer miles*
  • create links to various providers (OTAs / airlines / other tools) to try direct booking of your itinerary

Originally Posted by Error: Unable to find class IR6M2QD-k-i for itinRow.
If you see this error, currently you'll need to manually edit your installed script.

See posts from October 1st, 2018 for more information.
*requires background requests

The script may have lots of bugs and comes without warranty of any kind! Not all fares will be bookable or will price correctly in the booking engines. You are responsible for the money you spend - so double check your flights before purchasing AND use your sanity! Read this and the next two posts as an example: click

*** How it works ***
Using pure JavaScript we are "creating" some sort of hook that is periodically checking for page changes while working with the Matrix. As soon as you reload or leave the page the script stops (leaving the page or using the console-version) or starts from the beginning (using the userscript and perfoming a reload). Also this script is only running in these tabs/windows in which you are looking at the Matrix.
As soon as the script detects the itinerary page it reads its content - unless you activated the editor mode. It's parsing all the information found and creates - based on this information - several links to OTAs, airlines and other tools. Since we are able to remove, replace and add content to the page - we make them visible and clickable in a way you choose. By default there are no background requests.

*** How to get it running ***
There are two versions of this script:

Method 1: Console/Debug mode
You need to access the command line of your browser to execute the script. You can use either the regular version or the minified version. Just copy the entire text.

Firefox:
  1. Open the web console: developer.mozilla.org
  2. Switch to the console tab
  3. Paste the script into the command line: developer.mozilla.org
  4. Run it
Internet Explorer:
  1. Open the web console by pressing F12
  2. Switch to the console tab
  3. Paste the script into the command line - at the very bottom
  4. Run it by pressing the green triangle
Chrome:
  1. Open Chrome DevTools: developer.chrome.com
  2. Switch to the console tab
  3. Paste the script into the command line: developer.chrome.com
  4. Run it

Method 2: As a UserScript
It takes a moment to get it running but after that it will start automatically everytime you visit the Matrix and we will be able to store your settings. You will need to install a script manager.

Warning: Using a script manager and installing user scripts is a potential security risk - We need to mention it here.

Step 1: Install a script manager
Firefox Only: Greasemonkey also see Greasemonkey FAQ or tampermonkey.net also see Tampermonkey FAQ
Internet Explorer: Not supported
Chrome, Microsoft Edge, Safari, Opera Next, Firefox: tampermonkey.net also see Tampermonkey FAQ
Step 2: Install the script
See the FAQ of your script manager how to install the script.
It should be enough to visit the script HERE - you should be asked whether you want to install it - make sure your script manager is running.
*** How to use it ***
Once the script is running you should see a new line above the ITA logo:
Code:
Passengers (1a)                                 Settings (v0.18) (Cabin: Auto)
As long as you see this line, there is no need to reexecute the script. Make sure to get used to the "Settings"-feature -> just click on Settings. Within the settings menu you can configure the script towards your needs/preferences. Enabling/disabling features and/or setting standard editions of providers on the fly. When using a script manager these settings should be stored and automatically load as soon as you visit matrix.itasoftware.com - but the passengers as well as the cabin detection will not be stored!
Your settings are "reloaded" everytime the itinerary details show up! If you want to use other settings, just get back to the flight selection and reselect your flights - the new settings will be used. This belongs to the passengers and cabin detection as well

Passengers:
The passenger count will not be taken from your search results! Use the passenger config on the upper left and make sure they are set before you get to the itinerary details. We had to do it this way because some providers require the age of children. But always make sure to search for the equivalent passenger count. There might be seat availability for one passenger but not for two!

Cabin detection:
You should set the cabin on the upper right to the appropriate main cabin you are looking for. Sometimes you will have economy/business class segments in mainly business/first class itineraries. These mixed itineraries make it hard to autodetect the main cabin - so you can set it manually.

*** Background requests - Privacy issues ***
Some features require to contact other servers. As long as you do not activate any of the autoload features within the settings there won't be any automatic background requests. You will have to initiate them manually. The following list will tell which features are contacting what server and what information will be transferred. All websites will know you are using this script und you are currently using the Matrix - what by the way applies to the link targets you click as well.
  • Miles breakdown - contacting farefreaks.com (SSL) providing reduced route data
  • GCM-Map in inline mode - contacting gcmap.com (non SSL) providing full route data
  • WhereToCredit.com mileage accrual breakdown - contacting wheretocredit.com (non SSL or SSL - depending on whether you use the Matrix with or without SSL) providing full itinerary
  • farefreaks.com (advanced routing codes / flight manager) - contacting farefreaks.com (SSL) providing full itinerary

*** FT-Posts you should read ***
General statement regarding this script: click
How to fix class names yourself: click
Problems and limitations regarding pricing itins: click

*** Contributors ***
paul21, Steppo, IAkH, 18sas and others!

I'd like to give special thanks to paul21 for starting this idea.

*** Latest Version ***
GitHub Repo
or install/open directly
Installable/Executable Version
Executable Version minified

FYI
Steppo & IAkH have full access to this repository.

Discussion - written by paul21:
The original posting can be found here, related to building links on delta's booking engine. The script scrapes the flight info from the itinerary (flight numbers, dates, class of service, price) and builds a link string to two booking engines (Orbitz/Delta). These links are the same links used by Google Flights (owns ITA) , Kayak, et. al. to drive purchases. I used the Google referrer codes in the scripts, so they should get the commission. It's beyond me why ITA doesn't have some form of purchase link. This a userscript, and like an ad-blocker, it modifies the way a page is viewed by editing DOM objects in the browser. Keep in mind that this tool is meant to do something you already do yourself, but to save time in the process. Any tickets issued by Orbitz/DL via these links could be issued via phone or web search. If the links work, you are avoiding a phone booking fee potentially.
Print Wikipost

Reply

Old Oct 25, 14, 8:28 pm
  #1  
Original Poster
 
Join Date: Nov 2012
Location: Midwest
Programs: DL
Posts: 269
ITA-Matrix-PowerTools - Userscript for Orbitz/DL/UA/AA/BA/CZ/IB/LA/LH/LX/TK

Function:
Scrapes flight info from a ITA/Matrix Itinerary page and creates a clickable link to Orbitz/Cheaptix, United, and Delta for booking.

I've moved the usage information to the thread's wiki.

Last edited by paul21; Nov 11, 14 at 12:02 pm
paul21 is offline  
Reply With Quote
Old Oct 26, 14, 5:35 am
  #2  
 
Join Date: Oct 2013
Posts: 437
Awesome script and really cool idea!
However, I cant get it working :/

I tried via tampermonkey and greasemonkey as well as through the console in chrome and firefox.

No link gets created, but maybe its just me being too dumb.
When using the cmd line in the console in chrome, I get the following error:

undefined
Uncaught TypeError: Cannot read property 'toUpperCase' of undefined VM7065:2

In firefox I get:
undefined
TypeError: O is undefined


Another side note: Any chance you could include cheaptickets.com as well? Cheaptickets has exactly the same url structure as orbitz but most of the time it prices it a bit cheaper than orbitz and also gives better results when including many tricked routes, thanks!
fuyao is offline  
Reply With Quote
Old Oct 27, 14, 2:16 am
  #3  
Original Poster
 
Join Date: Nov 2012
Location: Midwest
Programs: DL
Posts: 269
Originally Posted by fuyao View Post
Awesome script and really cool idea!
However, I cant get it working :/

I tried via tampermonkey and greasemonkey as well as through the console in chrome and firefox.

No link gets created, but maybe its just me being too dumb.
When using the cmd line in the console in chrome, I get the following error:

undefined
Uncaught TypeError: Cannot read property 'toUpperCase' of undefined VM7065:2

In firefox I get:
undefined
TypeError: O is undefined


Another side note: Any chance you could include cheaptickets.com as well? Cheaptickets has exactly the same url structure as orbitz but most of the time it prices it a bit cheaper than orbitz and also gives better results when including many tricked routes, thanks!

What language, pricing, airports were you using? First or econ?
The regexp's I wrote are probably sensitive to some things in the airport names like non-us characters and non dollars.

There's also limits to the number of segments via the different methods...
UA seems to support 9-10
ORB/DL seems to support 7-8

Last edited by paul21; Oct 28, 14 at 12:09 pm Reason: Removed code for version control above
paul21 is offline  
Reply With Quote
Old Oct 28, 14, 8:24 am
  #4  
 
Join Date: Jan 2008
Location: KATL
Programs: DL DM/1MM
Posts: 1,920
Hi Paul- Thanks so much for putting this together. I've always wanted to do something like this but your method works better than anything I've come up with so far.

Can I request a fix? The script isn't working with AZ right now due to the dash in the airline name. I manually corrected for myself, but if you want to incorporate into your script the correction I made is:

Code:
var t = /\<td class=\"dijitReset carrier\"\>[A-z\s\.\,\-]*([0-9]+)/g;
Was tinkering around with building an array of the image alt tags to help isolate the flight number with more reliability, but the above is an easy fix for at least the AZ problem.
18sas is offline  
Reply With Quote
Old Oct 29, 14, 3:57 pm
  #5  
havnfn
 
Join Date: Sep 2011
Location: FL-MCO
Programs: Delta-DM; Hilton-Diamond; Hyatt-Diamond
Posts: 445
Brilliant!
ScrodmanFL is offline  
Reply With Quote
Old Oct 30, 14, 1:54 am
  #6  
Original Poster
 
Join Date: Nov 2012
Location: Midwest
Programs: DL
Posts: 269
I've added support for US Air links as well and incorporated 18sas's changes into version 0.2.
paul21 is offline  
Reply With Quote
Old Nov 1, 14, 3:43 pm
  #7  
 
Join Date: Jun 2013
Location: Somewhere between if and else
Posts: 142
Nice idea!
I did some work and added support for the german version of ita.
Give it a try
Code:
changed
var re=/(strong)*\>[A-Za-z\s/\,\.]*\((\w\w\w)\)[^\(]*\((\w\w\w)\)/g;
to
var re=/(strong)*\>[^\(\>]*\((\w{3})[^\(]*\((\w{3})/g;
changed
var re=/(strong)*\>[A-Za-z\s\/\,\.]*\(\w\w\w\)[A-Za-z\s\/\,\.]*\(\w\w\w\)\s*\-\s*\w*\,\s*(\w\w\w)\s([0-9]*)/g;
to
var re=/(strong)*\>[^\(\>]*\(\w{3}[^\(]*\(\w{3}[^\,]*\,\s*([a-zA-Z0-9]{1,3})\.?\s*([a-zA-Z0-9]{1,3})/g;
and much more...
You can find it here:
https://gist.github.com/anonymous/59fa19f78289571b9a49
Warning: Github is messing up special-chars like & in raw mode... what a pity

----- Edit ----
To deal with something like:
Scandinavian Airlines System (SAS) 903
you need
Code:
//Find Airports
var re=/(strong)*\>[^\(\<]*\((\w{3})[^\(\<]*\((\w{3})/g;
and
//Find Date
var re=/(strong)*\>[^\(\>]*\(\w{3}[^\(\<]*\(\w{3}[^\,]*\,\s*([a-zA-Z0-9]{1,3})\.?\s*([a-zA-Z0-9]{1,3})/g;
https://gist.github.com/anonymous/9261bd7620a4e246e63f

Last edited by Steppo; Nov 1, 14 at 7:43 pm Reason: Github Raw
Steppo is offline  
Reply With Quote
Old Nov 9, 14, 10:26 am
  #8  
 
Join Date: Jun 2013
Location: Somewhere between if and else
Posts: 142
Hopefully Paul21 is still interested and updating this thread.

I have done some work to bring this script to the next level.
2014-11-09 Edited by Steppo (Added monthly navigation to calendar, added retry for details if content is loading slow, added flights as object (see data var ) , added Farefreaks, added GCM)
I don't know if you ever encountered the following problem of the calendar view:
You are looking for a special fare, ita throws an error when the searched fare is unavailable for the given month. You have to go back to the search, change the month and search again.
To solve this i added a part to make the datechange form visible and added clickable month foward/backward icons. So you will be able to open the next month with just one click.

As soon as i fixed the issue with raw mode of Github, i will add the installable version for greasemonkey which has to be slightly different.
But for now you may edit the installed version by hand.

I rearranged most of the code structure but hopefully did not destroy something. I played around with some searches and everything worked well.

There is still a lot of work.. so keep going.

To use in console:
https://gist.github.com/anonymous/daaddea2c3b1ad556c8e

To use with greasemonkey:
Replace the current script with this ( But do NOT copy in raw mode!):
https://gist.github.com/anonymous/5d89dc45d588650460e0

Greetings
Steppo is offline  
Reply With Quote
Old Nov 10, 14, 5:45 am
  #9  
Original Poster
 
Join Date: Nov 2012
Location: Midwest
Programs: DL
Posts: 269
Originally Posted by Steppo View Post
Hopefully Paul21 is still interested and updating this thread.
Thanks for the additions Steppo!

I've setup a repository here:
https://github.com/paul21ft/ita-matrix-powertools

so you should be able to pull/push changes in a more centralized way.
paul21 is offline  
Reply With Quote
Old Nov 10, 14, 7:02 am
  #10  
 
Join Date: May 2009
Location: TXL/EWR
Posts: 440
For those not schooled in the ways... How does one download the script? Maybe it requires being logged in? Have greasemonkey installed but can't figure out how to "download" it.
Bigzamboni is offline  
Reply With Quote
Old Nov 10, 14, 8:06 am
  #11  
 
Join Date: Jun 2013
Location: Somewhere between if and else
Posts: 142
Originally Posted by Bigzamboni View Post
For those not schooled in the ways... How does one download the script? Maybe it requires being logged in? Have greasemonkey installed but can't figure out how to "download" it.
  1. Open ita-matrix-powertools on github:
    https://github.com/paul21ft/ita-matrix-powertools
  2. Choose: ita-matrix-powertools.user.js
  3. Click on RAW (seems to work now even with special-chars)
  4. You should be asked whether you want to install this script
  5. Install and you are done

or just try this link:
https://github.com/paul21ft/ita-matr...rtools.user.js
Steppo is offline  
Reply With Quote
Old Nov 10, 14, 9:47 am
  #12  
 
Join Date: Oct 2013
Location: RDU
Programs: AA PLT, Club Carlson GLD, IHG Spire, Lifemiles GLD, Hilton Gold
Posts: 338
This is an awesome idea. But I can't get it to work.

I have tampermonkey installed and I can see that the DL/ORB Itinary builder script is running. However, no link appears allowing me to book the the itinerary on orbitz.

In console mode, I also get an error. Any ideas what I might be doing wrong?
zgringo14 is offline  
Reply With Quote
Old Nov 10, 14, 10:01 am
  #13  
 
Join Date: Jun 2013
Location: Somewhere between if and else
Posts: 142
Originally Posted by zgringo14 View Post
This is an awesome idea. But I can't get it to work.
I have tampermonkey installed and I can see that the DL/ORB Itinary builder script is running. However, no link appears allowing me to book the the itinerary on orbitz.
In console mode, I also get an error. Any ideas what I might be doing wrong?
Would you mind to send me screenshots of your console showing which error you get? Are you sure tampermonkey is executing the script? It should throw at least one error on the resultpage if content could not be found. Can you see the two new links on the calendar-page?
Post it in public or via PM. As you like!
Steppo is offline  
Reply With Quote
Old Nov 10, 14, 10:08 am
  #14  
 
Join Date: Jul 2013
Location: SZX(HKG), SFO
Programs: UA1K, AAEXP, CZ G, MU PLT, CA PLT, Hyatt D, Hilton D, Marriott PP
Posts: 35
there is a problem for UA, if jump by HPMNK, we will not allow to use TC~

then, to paul21:
The script not work to me, but I am also a programmer, I corrected it.
some advise:
don't specify default value for the parameters of functions liked function x(y=0), maybe it needs very high version of js-engine to run, it did not work here to me.
the other problem here to me is "itaLocale undefined", I can see it is a global variable in the itinerary page, but I don't know why it can't be located in the script here to me, maybe lack of privilege?

Last edited by kulin; Nov 10, 14 at 10:20 am
kulin is offline  
Reply With Quote
Old Nov 11, 14, 6:58 am
  #15  
 
Join Date: Oct 2013
Location: RDU
Programs: AA PLT, Club Carlson GLD, IHG Spire, Lifemiles GLD, Hilton Gold
Posts: 338
screenshots

Originally Posted by Steppo View Post
Would you mind to send me screenshots of your console showing which error you get? Are you sure tampermonkey is executing the script? It should throw at least one error on the resultpage if content could not be found. Can you see the two new links on the calendar-page?
Post it in public or via PM. As you like!
Here is my intinerary page. You can see tampermonkey with a "1" in the corner.



Here are the tampermonkey options. The script is green.




If I click the script it goes red, which I assume means it is no longer running. so I think that part is working.



Here is the calendar screenshot. I'm not sure what links I should see there.



Does that help? Did I miss a step somewhere?

Thanks for your help!
zgringo14 is offline  
Reply With Quote

Thread Tools
Search this Thread
 
  • Ask a Question
    Get answers from community experts
Question Title:
Description:
Your question will be posted in: