From 6b9e2978908fa1f55866b4c65d619756adc08cfe Mon Sep 17 00:00:00 2001 From: Mort Yao Date: Thu, 31 Mar 2016 17:42:00 +0200 Subject: [PATCH] [embed] support netease, close #1001 --- src/you_get/extractors/embed.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/you_get/extractors/embed.py b/src/you_get/extractors/embed.py index b594b9f4..fd463c92 100644 --- a/src/you_get/extractors/embed.py +++ b/src/you_get/extractors/embed.py @@ -4,6 +4,7 @@ from ..common import * from .iqiyi import iqiyi_download_by_vid from .le import letvcloud_download_by_vu +from .netease import netease_download from .qq import qq_download_by_vid from .sina import sina_download_by_vid from .tudou import tudou_download_by_id @@ -36,10 +37,13 @@ yinyuetai_embed_patterns = [ 'player\.yinyuetai\.com/video/swf/(\d+)' ] iqiyi_embed_patterns = [ 'player\.video\.qiyi\.com/([^/]+)/[^/]+/[^/]+/[^/]+\.swf[^"]+tvId=(\d+)' ] +netease_embed_patterns = [ '(http://\w+\.163\.com/movie/[^\'"]+)' ] + def embed_download(url, output_dir = '.', merge = True, info_only = False ,**kwargs): - content = get_content(url) + content = get_content(url, headers=fake_headers) found = False title = match1(content, '([^<>]+)') + vids = matchall(content, youku_embed_patterns) for vid in set(vids): found = True @@ -60,6 +64,11 @@ def embed_download(url, output_dir = '.', merge = True, info_only = False ,**kwa found = True iqiyi_download_by_vid((vid[1], vid[0]), title=title, output_dir=output_dir, merge=merge, info_only=info_only) + urls = matchall(content, netease_embed_patterns) + for url in urls: + found = True + netease_download(url, title=title, output_dir=output_dir, merge=merge, info_only=info_only) + if not found: raise NotImplementedError(url)