Skip to content

Commit

Permalink
[universal] support HLS m3u8
Browse files Browse the repository at this point in the history
  • Loading branch information
soimort committed Jul 8, 2017
1 parent b04847e commit 490514e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/you_get/extractors/universal.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ def universal_download(url, output_dir='.', merge=True, info_only=False, **kwarg
if page_title:
page_title = unescape_html(page_title)

hls_urls = re.findall(r'(https?://[^;"\'\\]+' + '\.m3u8?' +
r'[^;"\'\\]*)', page)
if hls_urls:
for hls_url in hls_urls:
type_, ext, size = url_info(hls_url)
print_info(site_info, page_title, type_, size)
if not info_only:
download_url_ffmpeg(url=hls_url, title=page_title,
ext='mp4', output_dir=output_dir)
return

# most common media file extensions on the Internet
media_exts = ['\.flv', '\.mp3', '\.mp4', '\.webm',
'[-_]1\d\d\d\.jpe?g', '[-_][6-9]\d\d\.jpe?g', # tumblr
Expand Down

0 comments on commit 490514e

Please sign in to comment.