Get Latest Release Version Number for Chrome Browser

Get latest release version number for chrome browser

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.

how to programmatically identify latest version of chrome

After some googling, there seems to be no free API providing this.

Here is a candidate and they provide the latest version through api but you need to signup to get access to the api and if you need that info much you need to pay.

https://developers.whatismybrowser.com/api/

But why not try a simple way ourselves to get it from other sources?
I found two sources where I can get the latest chrome version.

First, the official link from Chrome team.

https://chromedriver.storage.googleapis.com/LATEST_RELEASE

But this does not give the version numbers for different platforms.

Second, checking https://www.whatismybrowser.com/guides/the-latest-version/chrome, we see that they provide the latest chrome versions for different platforms and we can scrape them using BeautifulSoup.

I wrote two simple Python functions getting the latest versions from the above sources.

import requests
from bs4 import BeautifulSoup as bs

def get_chrome_version():
url = "https://www.whatismybrowser.com/guides/the-latest-version/chrome"
response = requests.request("GET", url)

soup = bs(response.text, 'html.parser')
rows = soup.select('td strong')
version = {}
version['windows'] = rows[0].parent.next_sibling.next_sibling.text
version['macos'] = rows[1].parent.next_sibling.next_sibling.text
version['linux'] = rows[2].parent.next_sibling.next_sibling.text
version['android'] = rows[3].parent.next_sibling.next_sibling.text
version['ios'] = rows[4].parent.next_sibling.next_sibling.text
return version

def get_chrome_latest_release():
url = "https://chromedriver.storage.googleapis.com/LATEST_RELEASE"
response = requests.request("GET", url)
return response.text

print(get_chrome_version())
print(get_chrome_latest_release())

The test result is as follows.

78.0.3904.70
{'windows': '78.0.3904.97', 'macos': '78.0.3904.97', 'linux': '78.0.3904.97', 'android': '78.0.3904.96', 'ios': '78.0.3904.84'}

Hope this helps you get an idea.
You can use the function as it is or maybe you can find another better source.

Is there any way to get the latest chrome version?

The official link from Chrome team.
https://chromedriver.storage.googleapis.com/LATEST_RELEASE

This gives the latest Chrome release version

I wrote a simple Python function getting the latest versions from the above source.

import requests

def get_chrome_latest_release():
url = "https://chromedriver.storage.googleapis.com/LATEST_RELEASE"
response = requests.request("GET", url)
return response.text

print(get_chrome_latest_release())

The test result is as follows.

78.0.3904.70

Hope this helps.

How to periodically check latest stable version of chrome?

You can get the current Chrome versions from this endpoint:

https://versionhistory.googleapis.com/v1/chrome/platforms/win/channels/stable/versions

For more information on that, see the Chrome Version Guide Docs.

And to check this periodically would depend on how/ where you are running this code, if you provide more info to your question I can give you a sample code snippet.

getting current and previous version number on Google Chrome Extension

The API that gets invoked on upgrade is chrome.runtime.onInstalled.

chrome.runtime.onInstalled.addListener(details => {
if (details.reason === "update") {
let newVersion = chrome.runtime.getManifest().version;
console.log(`Updated from ${details.previousVersion} to ${newVersion}`);
}
});

You could make your logic dependent on that, but it's fragile. Your storage schema isn't likely to change every version, and you need to account for users that don't do every single upgrade but jump versions (e.g. a machine was offline for a long time). Also, there are no built-in functions to compare version strings.

It's much better to store the version of your storage schema with the data itself, and trigger data migration from onInstalled.

var defaults = {
someData: "reasonableDefault",
/* ... */
storageSchema: 5 // Increment this when data format changes
};

chrome.runtime.onInstalled.addListener(details => {
if (details.reason === "update") {
migrateData(doSomeInitialization);
}
});

function migrateData(callback) {
// This pulls stored values, falling back to defaults, if none
chrome.storage.local.get(defaults, data => {
let migrated = false;
while (!migrated) {
switch (data.storageSchema) {
case 1:
/* modify data to migrate from 1 to 2 */
data.storageSchema = 2;
break;
/* ... */
case 4:
/* modify data to migrate from 4 to 5 */
data.storageSchema = 5;
break;
case defaults.storageSchema: // Expected; we're done migrating
migrated = true;
break;
default:
throw new Error(`Unrecognized storage schema ${data.storageSchema}!`);
}
}
chrome.storage.local.set(data, callback);
});
}

Note that you will need some special logic for the case storageSchema was not used in an older version; otherwise, this code will supply the default value (as it's not in storage) and no migration will take place. So it's best to implement this before your first version goes public.

One thing to note is that Firefox WebExtensions don't support onInstalled yet (as of 2016-11-01) (Edit: RESOLVED FIXED in FF 52), but this function is safe to run on every extension start. onInstalled is just an optimization.

How to get the version number of Google Chrome installed on OS?

I managed to get it to work like this:

    public static void chromeVersion() throws IOException {

Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("reg query " + "HKEY_CURRENT_USER\\Software\\Google\\Chrome\\BLBeacon " + "/v version");
BufferedReader stdInput = new BufferedReader(new
InputStreamReader(proc.getInputStream()));

BufferedReader stdError = new BufferedReader(new
InputStreamReader(proc.getErrorStream()));

// Read the output from the command
System.out.println("Here is the standard output of the command:\n");
String s = null;
while ((s = stdInput.readLine()) != null) {
System.out.println(s);
}

// Read any errors from the attempted command
System.out.println("Here is the standard error of the command (if any):\n");
while ((s = stdError.readLine()) != null) {
System.out.println(s);
}

}

This will print:

Here is the standard output of the command:

HKEY_CURRENT_USER\Software\Google\Chrome\BLBeacon
version REG_SZ 93.0.4577.82

Here is the standard error of the command (if any):


Related Topics



Leave a reply



Submit