2

How to get the latest version of firefox? This URL was found, but is there no API? I would like to get the latest version, e.g. 58.0.2 so this could be used for other purposes. Just latest is insufficient as I require the version in one of my ansible roles to lookup the checksum.


At the moment I am considering to parse https://www.mozilla.org/en-US/firefox/releases/

2

You do not want to be parsing HTML in a programmatic way. Avoid it at all costs, if you can. It would be a nightmare to support on-going. There's actually a JSON output that Mozilla provides of all the versions:

https://product-details.mozilla.org/1.0/firefox_versions.json

Edit: Here is a simple bash script example that will always return the latest Firefox version. Make sure you have jq & curl installed on your system:

curl -s https://product-details.mozilla.org/1.0/firefox_versions.json | jq -r .LATEST_FIREFOX_VERSION

This returns:

58.0.2

4
  • Huh? I don't understand what you are saying. That is a JSON file that you can programmatically parse LATEST_FIREFOX_VERSION to get the latest version. That file is used to find the latest version. You don't need to know the version before you read that file. Just pull out the value for LATEST_FIREFOX_VERSION in your script that you write. I've updated my answer to show a code example of this.
    – BoomShadow
    Feb 21 '18 at 16:16
  • 1
    Ah, you're right. Brain fart. Sorry. Feb 21 '18 at 17:03
  • @BoomShadow I totally agree. Perhaps you could answer this question as well?
    – 030
    Feb 25 '18 at 10:03
  • @BoomShadow and perhaps you could answer this question too.
    – 030
    Feb 25 '18 at 17:32
3

I pulled this from the Firefox Chef cookbook (in particular this .rb file). This an example of the request they use to get the latest version based on OS and language.

https://download.mozilla.org/?product=firefox-latest#&os=win#&lang=#en-US

It adheres to the following format:

https://download.mozilla.org/?product=firefox-{VERSION_NUMBER}#&os={OS_ABBREVIATION}#&lang=#{LANGUAGE_ABBREVIATION}

I searched around for official api documentation, but couldn't find anything. If I do, I will post a link to it in this answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.