master
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] + '-'
try:
filepath = totaldl.handle_master(url, customname=title)
if filepath is None:
continue
filepath = filepath.replace('\\', '/')
filepath = filepath.split('/')[-1]
if '.mp4' in filepath:

View File

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