This commit is contained in:
Voussoir 2015-06-03 13:48:48 -07:00
parent e0540f3d13
commit 999006168c
2 changed files with 9 additions and 4 deletions

View file

@ -30,6 +30,8 @@ while True:
title = title[:34] + '-' title = title[:34] + '-'
try: try:
filepath = totaldl.handle_master(url, customname=title) filepath = totaldl.handle_master(url, customname=title)
if filepath is None:
continue
filepath = filepath.replace('\\', '/') filepath = filepath.replace('\\', '/')
filepath = filepath.split('/')[-1] filepath = filepath.split('/')[-1]
if '.mp4' in filepath: if '.mp4' in filepath:

View file

@ -70,7 +70,7 @@ def download_file(url, localname):
localname = localname.replace(':small', '') localname = localname.replace(':small', '')
if os.path.exists(localname): if os.path.exists(localname):
print('\t%s already exists!!' % localname) print('\t%s already exists!!' % localname)
return return localname
print('\tDownloading %s' % localname) print('\tDownloading %s' % localname)
downloading = request_get(url, stream=True) downloading = request_get(url, stream=True)
localfile = open(localname, 'wb') localfile = open(localname, 'wb')
@ -309,10 +309,13 @@ def handle_twitter(url, customname=None):
def handle_generic(url, customname=None): def handle_generic(url, customname=None):
try: try:
name = url.split('/')[-1] name = url.split('/')[-1]
ext = name.split('.')[-1]
if ext == name:
ext = '.html'
if customname: if customname:
name = '%s.%s' % (customname, name.split('.')[-1]) name = '%s.%s' % (customname, ext)
if '.' not in name: else:
name += '.html' name += ext
return download_file(url, name) return download_file(url, name)
except: except:
pass pass