Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryfloyd/afc8d87947a520e6094fec4878051ea8 to your computer and use it in GitHub Desktop.
Save ryfloyd/afc8d87947a520e6094fec4878051ea8 to your computer and use it in GitHub Desktop.
Basic concept for querying for Google Chrome updates based on current Chrome version/OS/arch
#!/usr/bin/python
import xml.etree.ElementTree as ET
import requests
import uuid
params = {'cup2hreq': 'foo', 'cup2key': 'bar'}
platform = 'mac'
os_version = '14.2'
target_version_prefix = '114'
xml = """
<request protocol="3.0" requestid="{%s}">
<os platform="%s" version="%s" />
<app appid="com.google.Chrome" lang="en-us">
<updatecheck targetversionprefix="%s"/>
</app>
</request>
""" % (str(uuid.uuid1()), platform, os_version, target_version_prefix)
r = requests.post('https://tools.google.com/service/update2', params=params, data=xml)
root = ET.fromstring(r.text)
dmg_url_list = []
for tag in root.iter('url'):
print(tag.attrib['codebase'])
dmg_url_list.append(tag.attrib['codebase'])
break
for tag in root.iter('package'):
print(tag.attrib['name'])
dmg_url_list.append(tag.attrib['name'])
dmg_url = ''.join(dmg_url_list)
print(dmg_url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment