Reputation: 23
I am writing a simple program in python and I need to get the latest release version of Chrome. But I can not find anywhere how to get the latest version of Chrome. Is there a way to get the latest release version of Chrome programmatically?
Upvotes: 1
Views: 2326
Reputation: 317
As the accepted answer returns the latest version of the Chromedriver, rather than Chrome, here is how you can get the latest version of Chrome:
versionhistory
APIGoogle provides an API to get information on the version history of Chrome for different platforms (Windows, Linux etc.) and channels (dev, beta, stable etc.).
The URI pattern is:
https://versionhistory.googleapis.com/v1/chrome/platforms/<platform>/channels/<channel>/versions
To get information on the latest stable version of Chrome for Linux, for example, query:
https://versionhistory.googleapis.com/v1/chrome/platforms/linux/channels/stable/versions
This will return a JSON object containing information on all versions for that platform and channel. In our example it would look like this:
{
"versions": [
{
"name": "chrome/platforms/linux/channels/stable/versions/106.0.5249.119",
"version": "106.0.5249.119"
},
{
"name": "chrome/platforms/linux/channels/stable/versions/106.0.5249.103",
"version": "106.0.5249.103"
},
{
"name": "chrome/platforms/linux/channels/stable/versions/106.0.5249.91",
"version": "106.0.5249.91"
},
{
"name": "chrome/platforms/linux/channels/stable/versions/106.0.5249.61",
"version": "106.0.5249.61"
},
...
{
"name": "chrome/platforms/linux/channels/stable/versions/54.0.2840.71",
"version": "54.0.2840.71"
}
],
"nextPageToken": ""
}
import json
import requests
def get_chrome_latest_release(platform: str, channel: str):
url = f"https://versionhistory.googleapis.com/v1/chrome/platforms/{platform}/channels/{channel}/versions"
response = requests.request("GET", url)
json_results = json.loads(response.text)
return json_results['versions'][0]['version']
print(get_chrome_latest_release("linux", "stable"))
VERSION=$(wget -q -O - https://versionhistory.googleapis.com/v1/chrome/platforms/linux/channels/stable/versions | jq -r '.versions[0].version')
Note that this requires jq
for parsing the JSON response. If it is not available in your environment you install it with apt-get install jq
or apk add jq
. Alternatively, use another tool for parsing JSON.
Upvotes: 1
Reputation: 382
I just updated my browser and right now the latest version is 105.0.5195.102 however visiting that URL: https://chromedriver.storage.googleapis.com/LATEST_RELEASE returns this: 105.0.5195.52 which clearly is NOT the latest version.
Upvotes: 0
Reputation: 985
This syntax will allow you to get the latest version of chromedriver:
wget -q https://chromedriver.storage.googleapis.com/$(wget -q -O - https://chromedriver.storage.googleapis.com/LATEST_RELEASE)/chromedriver_linux64.zip
Upvotes: 1
Reputation: 737
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.
Upvotes: 5