diff --git a/cdoseaplay/update.py b/cdoseaplay/update.py index 8a6a594..2948e98 100755 --- a/cdoseaplay/update.py +++ b/cdoseaplay/update.py @@ -53,9 +53,11 @@ def update_video(url, name): if folder and not os.path.exists(folder): os.makedirs(folder) if os.path.exists(name): - head = requests.head(url) - mtime = time.mktime(datetime.strptime(head.headers.get("Last-Modified"), "%a, %d %b %Y %X GMT").timetuple()) - get = mtime > os.path.getmtime(name) or int(head.headers.get("Content-Length")) != os.path.getsize(name) + head = requests.head(url, allow_redirects=True) + modified = head.headers.get("Last-Modified") + if modified: + mtime = time.mktime(datetime.strptime(modified, "%a, %d %b %Y %X GMT").timetuple()) + get = mtime > os.path.getmtime(name) or int(head.headers.get("Content-Length")) != os.path.getsize(name) else: get = True if get: