else
handle generic
This commit is contained in:
parent
999006168c
commit
2b08697321
1 changed files with 12 additions and 6 deletions
|
@ -308,14 +308,20 @@ def handle_twitter(url, customname=None):
|
||||||
|
|
||||||
def handle_generic(url, customname=None):
|
def handle_generic(url, customname=None):
|
||||||
try:
|
try:
|
||||||
name = url.split('/')[-1]
|
|
||||||
ext = name.split('.')[-1]
|
|
||||||
if ext == name:
|
|
||||||
ext = '.html'
|
|
||||||
if customname:
|
if customname:
|
||||||
name = '%s.%s' % (customname, ext)
|
name = customname
|
||||||
else:
|
else:
|
||||||
name += ext
|
name = url.split('/')[-1]
|
||||||
|
|
||||||
|
base = name.split('.')[0]
|
||||||
|
ext = name.split('.')[-1]
|
||||||
|
if ext in [base, '']:
|
||||||
|
ext = 'html'
|
||||||
|
print(base)
|
||||||
|
print(ext)
|
||||||
|
|
||||||
|
name = '%s.%s' % (base, ext)
|
||||||
|
|
||||||
return download_file(url, name)
|
return download_file(url, name)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in a new issue