allow redirects
This commit is contained in:
parent
7fec0d2dae
commit
b1f2b4b43d
1 changed files with 5 additions and 3 deletions
|
@ -53,9 +53,11 @@ def update_video(url, name):
|
||||||
if folder and not os.path.exists(folder):
|
if folder and not os.path.exists(folder):
|
||||||
os.makedirs(folder)
|
os.makedirs(folder)
|
||||||
if os.path.exists(name):
|
if os.path.exists(name):
|
||||||
head = requests.head(url)
|
head = requests.head(url, allow_redirects=True)
|
||||||
mtime = time.mktime(datetime.strptime(head.headers.get("Last-Modified"), "%a, %d %b %Y %X GMT").timetuple())
|
modified = head.headers.get("Last-Modified")
|
||||||
get = mtime > os.path.getmtime(name) or int(head.headers.get("Content-Length")) != os.path.getsize(name)
|
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:
|
else:
|
||||||
get = True
|
get = True
|
||||||
if get:
|
if get:
|
||||||
|
|
Loading…
Reference in a new issue