Friday, September 13, 2013

How to get the historical FIFA rankings for a country

FIFA, the world's football association have issued a set of international rankings once a month since August 1993 but have not made them available to developers, either through an API or downloadable files (e.g. csv, excel spreadsheet, etc).
However, it is possible to access the rankings for a country in an xml file using Firefox and the Firebug plug in.
First, open fifa.com and click on the relevant association's page, e.g. Scotland: http://www.fifa.com/associations/association=sco/index.html
When the page opens, click the "Rankings" link: http://www.fifa.com/associations/association=sco/ranking/gender=m/index.html
Right click on "Rankings Evolution" and select "Inspect element with Firebug"
The parent element of the div containing the "Rankings Evolution" text box is a div with a class type of "box". Right click on this and select "Copy HTML".
Paste the HTML into a text editor (notepad, gEdit, Kate, etc).
Search for the text "new SWFObject(" (without the quotes) and copy the first parameter, e.g. /flash/maranking/marankbrowser.swf?t1=sco&g=m&a=1&v=2&lang=e&environment=PROD
Add this to http://www.fifa.com to create the URL for the flash object: http://www.fifa.com/flash/maranking/marankbrowser.swf?t1=sco&g=m&a=1&v=2&lang=e&environment=PROD
Open a new tab and activate firebug. Click the Net tab and ensure it is enabled. Note that two requests are sent to the server, flashranking.xml and association=sco.xml. Right click on association=sco.xml and select "Copy Repsonse Body".
Open a text editor and paste in the response body. Each entry is in the format

No comments: