mirror of
https://github.com/soimort/you-get.git
synced 2025-02-09 11:42:30 +03:00
TED: fixed
This commit is contained in:
parent
b70ac59a6a
commit
c058e14059
@ -3,16 +3,16 @@
|
|||||||
__all__ = ['ted_download']
|
__all__ = ['ted_download']
|
||||||
|
|
||||||
from ..common import *
|
from ..common import *
|
||||||
|
import json
|
||||||
|
|
||||||
def ted_download(url, output_dir='.', merge=True, info_only=False):
|
def ted_download(url, output_dir='.', merge=True, info_only=False):
|
||||||
page = get_html(url).split("\n")
|
html = get_html(url)
|
||||||
for line in page:
|
metadata = json.loads(match1(html, r'({"talks"(.*)})\)'))
|
||||||
if line.find("<title>") > -1:
|
title = metadata['talks'][0]['title']
|
||||||
title = line.replace("<title>", "").replace("</title>", "").replace("\t", "")
|
nativeDownloads = metadata['talks'][0]['nativeDownloads']
|
||||||
title = title[:title.find(' | ')]
|
for quality in ['high', 'medium', 'low']:
|
||||||
if line.find("no-flash-video-download") > -1:
|
if quality in nativeDownloads:
|
||||||
url = line.replace('<a id="no-flash-video-download" href="', "").replace(" ", "").replace("\t", "").replace(".mp4", "-480p.mp4")
|
url = nativeDownloads[quality]
|
||||||
url = url[:url.find('"')]
|
|
||||||
type, ext, size = url_info(url)
|
type, ext, size = url_info(url)
|
||||||
print_info(site_info, title, type, size)
|
print_info(site_info, title, type, size)
|
||||||
if not info_only:
|
if not info_only:
|
||||||
|
Loading…
Reference in New Issue
Block a user