Hafenkranich
Hafenkranich

Reputation: 1744

Get latest release version number for chrome browser

I am trying to figure out a rather stable way to programmatically determine the latest release version number of the chrome browser.

It doesn't have to be failproof as it's only a nice-to-have-feature I can blend out whenever the result looks "suspicious".

So I ended up fetching git files.

My first approach was to fetch this file:

https://chromium.googlesource.com/chromium/src.git/+/master/chrome/VERSION?format=TEXT

Which gives the latest version number.
From there on the solution is just a preg_match_all away ... Unfortunately its not the latest release version but the latest dev version.

There seems to be no "release" branch nor a "release" tag or something else I can think of neither.

You might answer "why?"... I know about feature detection, I know browser sniffing can be fooled and I am aware of the fact that (every) browser will notify their users when it's time to update. Still makes sense in my case. On the other hand its solely for display purposes. Nothing is going to depend on it later on – promise :-)

Any – even the faintest – ideas are highly appreciated!

Upvotes: 13

Views: 12486

Answers (6)

alfreire
alfreire

Reputation: 109

https://cdn.jsdelivr.net/gh/berstend/chrome-versions/data/stable/all/version/latest.json

$response = Invoke-RestMethod -Uri "https://cdn.jsdelivr.net/gh/berstend/chrome-versions/data/stable/all/version/latest.json" -UseBasicParsing
$ver = $response.windows.version
$ver

#-------------------------------------------------------------

https://chromiumdash.appspot.com/fetch_releases?channel=Stable&platform=Windows&num=1

$response = Invoke-RestMethod -Uri "https://chromiumdash.appspot.com/fetch_releases?channel=Stable&platform=Windows&num=1" -UseBasicParsing
$ver = $response.version
$ver

Upvotes: 1

rks
rks

Reputation: 622

The ChromiumDash also makes the data available via an API. You can use that to fetch the latest tag for a platform and a channel.

Eg: https://chromiumdash.appspot.com/fetch_releases?channel=Stable&platform=Windows&num=1

Returns

[
  {
    "channel": "Stable", 
    "chromium_main_branch_position": 950365, 
    "hashes": {
      "angle": "343b7bb57268e1cb47da26fcb0ed40fe47e8ff5d", 
      "chromium": "cab11adacc41ee856c79e669c2fd38d8864e52c4", 
      "dawn": "1b1b658d365591b6a8d4bfb0c3524832c89afc99", 
      "devtools": "b6f648d8921ea8be8f2b32c2061fec7503b56610", 
      "pdfium": "27cabf3dae38d0634a53316da0ad069bf0413495", 
      "skia": "a6986cd7224f104044fd5bc29cb5f80796d76f5a", 
      "v8": "db77a493a5595b835655b243202ac0c2fb1898a6", 
      "webrtc": "a6b138d6b4ef3a5b2c87f899b67f3b5c8dd3c002"
    }, 
    "milestone": 98, 
    "platform": "Windows", 
    "previous_version": "98.0.4758.81", 
    "time": 1643754840000, 
    "version": "98.0.4758.82"
  }
]

Upvotes: 7

umut
umut

Reputation: 91

I've found the following endpoints from OmahaProxy that give the latest stable versions of the respective OS.

Upvotes: 9

twk
twk

Reputation: 3120

Feel free to use my online service vergrabber to get latest versions of different kind of software in json format. It's available at http://vergrabber.kingu.pl/vergrabber.json

Upvotes: 5

David Bokan
David Bokan

Reputation: 2297

The Chrome team uses the OmahaProxy dashboard to keep track of current versions in stable/beta/dev/canary. If you can scrape that you can get whatever version number you're looking for.

Upvotes: 15

peixotorms
peixotorms

Reputation: 1283

If you're on debian based linux, you could install and update your chrome once a day, and somehow parse the version number, but this is not realtime.

For example:

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
dpkg -i google-chrome-stable_current_amd64.deb

Which will give a log like this:

(Reading database ... 113338 files and directories currently installed.)
Preparing to unpack google-chrome-stable_current_amd64.deb ...
Unpacking google-chrome-stable (48.0.2564.97-1) over (47.0.2526.111-1) ...
Setting up google-chrome-stable (48.0.2564.97-1) ...
Processing triggers for menu (2.1.47) ...

Then just parse it.

Upvotes: 1

Related Questions