- print('Downloading and checksumming %s...' %filename)
- url = 'http://youtube-dl.org/downloads/%s/%s' % (version, filename)
- data = urllib.request.urlopen(url).read()
- sha256sum = hashlib.sha256(data).hexdigest()
- new_version[key] = (url, sha256sum)
+ url = 'https://yt-dl.org/downloads/%s/%s' % (version, filename)
+ fn = os.path.join(build_dir, filename)
+ with open(fn, 'rb') as f:
+ data = f.read()
+ if not data:
+ raise ValueError('File %s is empty!' % fn)
+ sha256sum = hashlib.sha256(data).hexdigest()
+ new_version[key] = (url, sha256sum)