catch keyboard in head request too
This commit is contained in:
parent
6b0d0b4db6
commit
2a66932bff
1 changed files with 4 additions and 1 deletions
|
@ -59,7 +59,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, allow_redirects=True)
|
||||
try:
|
||||
head = requests.head(url, allow_redirects=True)
|
||||
except KeyboardInterrupt:
|
||||
sys.exit(-1)
|
||||
modified = head.headers.get("Last-Modified")
|
||||
if modified:
|
||||
mtime = time.mktime(datetime.strptime(modified, "%a, %d %b %Y %X GMT").timetuple())
|
||||
|
|
Loading…
Reference in a new issue