Created
April 9, 2019 14:27
-
-
Save shuax/007d9ffe3b4b80184d8516abe60966e6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
requests.packages.urllib3.disable_warnings() | |
channels = [ | |
'56EB18F8-B008-4CBD-B6D2-8C97FE7E9062', | |
'2CD8A007-E189-409D-A2C8-9AF4EF3C72AA', | |
'0D50BFEC-CD6A-4F9A-964C-C7416E3ACB10', | |
'65C35B14-6C1D-4122-AC46-7148CC9D6497', | |
] | |
args = {"targetingAttributes":{}} | |
for channel in channels: | |
rep = requests.post('https://msedge.api.cdp.microsoft.com/api/v1/contents/Browser/namespaces/Default/names/{0}/versions/latest?action=select'.format(channel), json=args,verify=False) | |
print(rep.text) | |
if not rep.text: | |
continue | |
version = rep.json()['ContentId']['Version'] | |
file = rep.json()['Files'][0] | |
print(file, version) | |
rep = requests.post('https://msedge.api.cdp.microsoft.com/api/v1/contents/Browser/namespaces/Default/names/{1}/versions/{0}/files?action=GenerateDownloadInfo'.format(version, channel), json=args,verify=False) | |
url = rep.json()[0]['Url'] | |
# print(rep.json()) | |
print(url) | |
# break | |
# download = requests.get(url) | |
# with open(file, 'wb') as f: | |
# f.write(download.content) | |
# # version = rep.json()['ContentId']['Version'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment