allow redirects
This commit is contained in:
parent
7fec0d2dae
commit
b1f2b4b43d
1 changed files with 5 additions and 3 deletions
|
@ -53,8 +53,10 @@ 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())
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue