Created
July 30, 2019 05:40
-
-
Save rhelmer/2487cb64683b0c09df304e20bdbfd27c 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 | |
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