else
totaldl 5
This commit is contained in:
parent
84ae46ac1f
commit
9668eec5c4
1 changed files with 26 additions and 10 deletions
|
@ -33,6 +33,8 @@ VIMEO_DICT_END = ',"hls"'
|
||||||
VIMEO_PRIORITY = ['hd', 'sd', 'mobile']
|
VIMEO_PRIORITY = ['hd', 'sd', 'mobile']
|
||||||
# Download files in this priority
|
# Download files in this priority
|
||||||
|
|
||||||
|
LIVELEAK_YOUTUBEIFRAME = 'youtube.com/embed'
|
||||||
|
|
||||||
DO_GENERIC = True
|
DO_GENERIC = True
|
||||||
# If true, attempt to download whatever URL goes in
|
# If true, attempt to download whatever URL goes in
|
||||||
# Else, only download from the explicitly supported sites
|
# Else, only download from the explicitly supported sites
|
||||||
|
@ -189,14 +191,23 @@ def handle_liveleak(url, customname=None):
|
||||||
name += '.mp4'
|
name += '.mp4'
|
||||||
pagedata = request_get(url)
|
pagedata = request_get(url)
|
||||||
pagedata = pagedata.text
|
pagedata = pagedata.text
|
||||||
pagedata = pagedata.split('file: "')[1]
|
if LIVELEAK_YOUTUBEIFRAME in pagedata:
|
||||||
pagedata = pagedata.split('",')[0]
|
pagedata = pagedata.split('\n')
|
||||||
pagedata = pagedata.split('.')
|
pagedata = [line for line in pagedata if LIVELEAK_YOUTUBEIFRAME in line]
|
||||||
for spoti in range(len(pagedata)):
|
pagedata = pagedata[0]
|
||||||
if 'h264_' in pagedata[spoti]:
|
pagedata = pagedata.split('src="')[1]
|
||||||
pagedata[spoti] = 'h264_720p'
|
pagedata = pagedata.split('"')[0]
|
||||||
pagedata = '.'.join(pagedata)
|
print('\tFound youtube embed')
|
||||||
download_file(pagedata, name)
|
handle_master(pagedata)
|
||||||
|
else:
|
||||||
|
pagedata = pagedata.split('file: "')[1]
|
||||||
|
pagedata = pagedata.split('",')[0]
|
||||||
|
pagedata = pagedata.split('.')
|
||||||
|
for spoti in range(len(pagedata)):
|
||||||
|
if 'h264_' in pagedata[spoti]:
|
||||||
|
pagedata[spoti] = 'h264_720p'
|
||||||
|
pagedata = '.'.join(pagedata)
|
||||||
|
download_file(pagedata, name)
|
||||||
|
|
||||||
|
|
||||||
def handle_youtube(url, customname=None):
|
def handle_youtube(url, customname=None):
|
||||||
|
@ -214,6 +225,8 @@ def handle_generic(url, customname=None):
|
||||||
name = url.split('/')[-1]
|
name = url.split('/')[-1]
|
||||||
if customname:
|
if customname:
|
||||||
name = '%s.%s' % (customname, name.split('.')[-1])
|
name = '%s.%s' % (customname, name.split('.')[-1])
|
||||||
|
if '.' not in name:
|
||||||
|
name += '.html'
|
||||||
download_file(url, name)
|
download_file(url, name)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
@ -277,6 +290,9 @@ def test(imgur=True, gfycat=True, vimeo=True, liveleak=True, youtube=True, gener
|
||||||
# LiveLeak standard link
|
# LiveLeak standard link
|
||||||
handle_master('http://www.liveleak.com/view?i=9d1_1429192014')
|
handle_master('http://www.liveleak.com/view?i=9d1_1429192014')
|
||||||
|
|
||||||
|
# Liveleak article with youtube embed
|
||||||
|
handle_master('http://www.liveleak.com/view?i=ab8_1367941301')
|
||||||
|
|
||||||
# LiveLeak standard link with customname
|
# LiveLeak standard link with customname
|
||||||
handle_master('http://www.liveleak.com/view?i=9d1_1429192014', customname='liveleak')
|
handle_master('http://www.liveleak.com/view?i=9d1_1429192014', customname='liveleak')
|
||||||
|
|
||||||
|
@ -305,6 +321,6 @@ if __name__ == '__main__':
|
||||||
imgur=False,
|
imgur=False,
|
||||||
gfycat=False,
|
gfycat=False,
|
||||||
vimeo=False,
|
vimeo=False,
|
||||||
liveleak=False,
|
liveleak=True,
|
||||||
youtube=True,
|
youtube=False,
|
||||||
generic=False)
|
generic=False)
|
Loading…
Reference in a new issue