Skip to content

Instantly share code, notes, and snippets.

@rhelmer
Created July 30, 2019 05:40
Show Gist options
  • Save rhelmer/2487cb64683b0c09df304e20bdbfd27c to your computer and use it in GitHub Desktop.
Save rhelmer/2487cb64683b0c09df304e20bdbfd27c to your computer and use it in GitHub Desktop.
import requests
import click
import os
import hashlib
@click.command()
@click.argument("url")
def main(url=None):
data = requests.get(url).json()
platforms = data["vendors"]["gmp-widevinecdm"]["platforms"]
for platform in platforms:
if "alias" in platforms[platform]:
continue
else:
fileUrl = platforms[platform]["fileUrl"]
r = requests.get(fileUrl)
open("tmpfile", "wb").write(r.content)
statinfo = os.stat("tmpfile")
if statinfo.st_size != platforms[platform]["filesize"]:
print("filesize did not match:", platform)
exit()
m = hashlib.sha512()
m.update(open("tmpfile", "r").read())
if m.hexdigest() != platforms[platform]["hashValue"]:
print("hashsize did not match:", platform, m.hexdigest(), platforms[platform]["hashValue"])
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment