From b6c33fd544adddf399a80842eb9a7d2250aa04b6 Mon Sep 17 00:00:00 2001 From: ping Date: Wed, 27 Jan 2016 12:48:00 +0800 Subject: [PATCH 1/4] [daum.net] Fixes #8331 --- youtube_dl/extractor/daum.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/daum.py b/youtube_dl/extractor/daum.py index f08f57157..c84302c43 100644 --- a/youtube_dl/extractor/daum.py +++ b/youtube_dl/extractor/daum.py @@ -2,6 +2,8 @@ from __future__ import unicode_literals +import re + from .common import InfoExtractor from ..compat import compat_urllib_parse from ..utils import ( @@ -28,6 +30,15 @@ class DaumIE(InfoExtractor): 'comment_count': int, }, }, { + 'url': 'http://m.tvpot.daum.net/v/65139429', + 'info_dict': { + 'id': '65139429', + 'ext': 'mp4', + 'title': 'md5:a100d65d09cec246d8aa9bde7de45aed', + 'description': 'md5:79794514261164ff27e36a21ad229fc5', + 'upload_date': '20150604', + 'duration': 154 + }, }, { 'url': 'http://tvpot.daum.net/v/07dXWRka62Y%24', 'only_matching': True, }] @@ -42,6 +53,10 @@ class DaumIE(InfoExtractor): 'http://videofarm.daum.net/controller/api/closed/v1_2/IntegratedMovieData.json?' + query, video_id, 'Downloading video formats info') + # For urls like http://m.tvpot.daum.net/v/65139429, where the video_id is really a clipid + if not movie_data.get('output_list', {}).get('output_list') and re.match(r'^\d+$', video_id): + return self.url_result('http://tvpot.daum.net/clip/ClipView.do?clipid=%s' % video_id) + formats = [] for format_el in movie_data['output_list']['output_list']: profile = format_el['profile'] @@ -76,7 +91,7 @@ class DaumIE(InfoExtractor): class DaumClipIE(InfoExtractor): - _VALID_URL = r'https?://(?:m\.)?tvpot\.daum\.net/(?:clip/ClipView.do|mypot/View.do)\?.*?clipid=(?P\d+)' + _VALID_URL = r'https?://(?:m\.)?tvpot\.daum\.net/(?:clip/ClipView.(?:do|tv)|mypot/View.do)\?.*?clipid=(?P\d+)' IE_NAME = 'daum.net:clip' _TESTS = [{ @@ -90,6 +105,9 @@ class DaumClipIE(InfoExtractor): 'duration': 3868, 'view_count': int, }, + }, { + 'url': 'http://m.tvpot.daum.net/clip/ClipView.tv?clipid=54999425', + 'only_matching': True, }] def _real_extract(self, url): From e047922be01ca346cee8f53b7972773d64eed6f4 Mon Sep 17 00:00:00 2001 From: ping Date: Sat, 30 Jan 2016 11:04:11 +0800 Subject: [PATCH 2/4] [daum] Fix copy-paste mistake --- youtube_dl/extractor/daum.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/daum.py b/youtube_dl/extractor/daum.py index c84302c43..0d74e5207 100644 --- a/youtube_dl/extractor/daum.py +++ b/youtube_dl/extractor/daum.py @@ -38,7 +38,8 @@ class DaumIE(InfoExtractor): 'description': 'md5:79794514261164ff27e36a21ad229fc5', 'upload_date': '20150604', 'duration': 154 - }, }, { + }, + }, { 'url': 'http://tvpot.daum.net/v/07dXWRka62Y%24', 'only_matching': True, }] From f5d30d521c63b4eec4aa4386365054222e354231 Mon Sep 17 00:00:00 2001 From: ping Date: Sat, 30 Jan 2016 11:09:30 +0800 Subject: [PATCH 3/4] [daum] Fix add view_count, comment_count to test --- youtube_dl/extractor/daum.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/daum.py b/youtube_dl/extractor/daum.py index 0d74e5207..567abdc39 100644 --- a/youtube_dl/extractor/daum.py +++ b/youtube_dl/extractor/daum.py @@ -37,7 +37,9 @@ class DaumIE(InfoExtractor): 'title': 'md5:a100d65d09cec246d8aa9bde7de45aed', 'description': 'md5:79794514261164ff27e36a21ad229fc5', 'upload_date': '20150604', - 'duration': 154 + 'duration': 154, + 'view_count': int, + 'comment_count': int, }, }, { 'url': 'http://tvpot.daum.net/v/07dXWRka62Y%24', From 06ffa3348590f9aa6ddca7ca8f78424c49314560 Mon Sep 17 00:00:00 2001 From: Yen Chi Hsuan Date: Sat, 30 Jan 2016 16:23:37 +0800 Subject: [PATCH 4/4] [daum.net] Move the request to ClipInfoXml.do To reduce the number of wasted requests --- youtube_dl/extractor/daum.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/youtube_dl/extractor/daum.py b/youtube_dl/extractor/daum.py index 567abdc39..543eb5c3a 100644 --- a/youtube_dl/extractor/daum.py +++ b/youtube_dl/extractor/daum.py @@ -49,9 +49,6 @@ class DaumIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) query = compat_urllib_parse.urlencode({'vid': video_id}) - info = self._download_xml( - 'http://tvpot.daum.net/clip/ClipInfoXml.do?' + query, video_id, - 'Downloading video info') movie_data = self._download_json( 'http://videofarm.daum.net/controller/api/closed/v1_2/IntegratedMovieData.json?' + query, video_id, 'Downloading video formats info') @@ -60,6 +57,10 @@ class DaumIE(InfoExtractor): if not movie_data.get('output_list', {}).get('output_list') and re.match(r'^\d+$', video_id): return self.url_result('http://tvpot.daum.net/clip/ClipView.do?clipid=%s' % video_id) + info = self._download_xml( + 'http://tvpot.daum.net/clip/ClipInfoXml.do?' + query, video_id, + 'Downloading video info') + formats = [] for format_el in movie_data['output_list']['output_list']: profile = format_el['profile']