提交 64f9e8e8 编写于 作者: M Mort Yao

YouTube: OOP style

上级 8d5a8ec9
......@@ -1070,7 +1070,7 @@ class VideoExtractor():
def p_playlist(self, stream_id=None):
print("site: %s" % self.__class__.name)
print("title: %s" % self.title)
print("playlist: %s" % self.title)
print("videos:")
def download(self, **kwargs):
......
......@@ -3,12 +3,12 @@
__all__ = ['khan_download']
from ..common import *
from .youtube import youtube_download_by_id
from .youtube import YouTube
def khan_download(url, output_dir = '.', merge = True, info_only = False):
page = get_html(url)
id = page[page.find('src="https://www.youtube.com/embed/') + len('src="https://www.youtube.com/embed/') :page.find('?enablejsapi=1&wmode=transparent&modestbranding=1&rel=0&fs=1&showinfo=0')]
youtube_download_by_id(id, output_dir=output_dir, merge=merge, info_only=info_only)
def khan_download(url, output_dir='.', merge=True, info_only=False):
html = get_content(url)
youtube_url = re.search('<meta property="og:video" content="([^"]+)', html).group(1)
YouTube().download_by_url(youtube_url, output_dir=output_dir, merge=merge, info_only=info_only)
site_info = "khanacademy.org"
download = khan_download
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册