3 from __future__ import unicode_literals
7 from .common import InfoExtractor
8 from ..compat import compat_urllib_parse
16 class DaumIE(InfoExtractor):
17 _VALID_URL = r'https?://(?:m\.)?tvpot\.daum\.net/v/(?P<id>[^?#&]+)'
21 'url': 'http://tvpot.daum.net/v/vab4dyeDBysyBssyukBUjBz',
23 'id': 'vab4dyeDBysyBssyukBUjBz',
25 'title': '마크 헌트 vs 안토니오 실바',
26 'description': 'Mark Hunt vs Antonio Silva',
27 'upload_date': '20131217',
33 'url': 'http://m.tvpot.daum.net/v/65139429',
37 'title': 'md5:a100d65d09cec246d8aa9bde7de45aed',
38 'description': 'md5:79794514261164ff27e36a21ad229fc5',
39 'upload_date': '20150604',
43 'url': 'http://tvpot.daum.net/v/07dXWRka62Y%24',
44 'only_matching': True,
47 def _real_extract(self, url):
48 video_id = self._match_id(url)
49 query = compat_urllib_parse.urlencode({'vid': video_id})
50 info = self._download_xml(
51 'http://tvpot.daum.net/clip/ClipInfoXml.do?' + query, video_id,
52 'Downloading video info')
53 movie_data = self._download_json(
54 'http://videofarm.daum.net/controller/api/closed/v1_2/IntegratedMovieData.json?' + query,
55 video_id, 'Downloading video formats info')
57 # For urls like http://m.tvpot.daum.net/v/65139429, where the video_id is really a clipid
58 if not movie_data.get('output_list', {}).get('output_list') and re.match(r'^\d+$', video_id):
59 return self.url_result('http://tvpot.daum.net/clip/ClipView.do?clipid=%s' % video_id)
62 for format_el in movie_data['output_list']['output_list']:
63 profile = format_el['profile']
64 format_query = compat_urllib_parse.urlencode({
68 url_doc = self._download_xml(
69 'http://videofarm.daum.net/controller/api/open/v1_2/MovieLocation.apixml?' + format_query,
70 video_id, note='Downloading video data for %s format' % profile)
71 format_url = url_doc.find('result/url').text
75 'width': int_or_none(format_el.get('width')),
76 'height': int_or_none(format_el.get('height')),
77 'filesize': int_or_none(format_el.get('filesize')),
79 self._sort_formats(formats)
83 'title': info.find('TITLE').text,
85 'thumbnail': xpath_text(info, 'THUMB_URL'),
86 'description': xpath_text(info, 'CONTENTS'),
87 'duration': int_or_none(xpath_text(info, 'DURATION')),
88 'upload_date': info.find('REGDTTM').text[:8],
89 'view_count': str_to_int(xpath_text(info, 'PLAY_CNT')),
90 'comment_count': str_to_int(xpath_text(info, 'COMMENT_CNT')),
94 class DaumClipIE(InfoExtractor):
95 _VALID_URL = r'https?://(?:m\.)?tvpot\.daum\.net/(?:clip/ClipView.(?:do|tv)|mypot/View.do)\?.*?clipid=(?P<id>\d+)'
96 IE_NAME = 'daum.net:clip'
99 'url': 'http://tvpot.daum.net/clip/ClipView.do?clipid=52554690',
103 'title': 'DOTA 2GETHER 시즌2 6회 - 2부',
104 'description': 'DOTA 2GETHER 시즌2 6회 - 2부',
105 'upload_date': '20130831',
110 'url': 'http://m.tvpot.daum.net/clip/ClipView.tv?clipid=54999425',
111 'only_matching': True,
114 def _real_extract(self, url):
115 video_id = self._match_id(url)
116 clip_info = self._download_json(
117 'http://tvpot.daum.net/mypot/json/GetClipInfo.do?clipid=%s' % video_id,
118 video_id, 'Downloading clip info')['clip_bean']
121 '_type': 'url_transparent',
123 'url': 'http://tvpot.daum.net/v/%s' % clip_info['vid'],
124 'title': clip_info['title'],
125 'thumbnail': clip_info.get('thumb_url'),
126 'description': clip_info.get('contents'),
127 'duration': int_or_none(clip_info.get('duration')),
128 'upload_date': clip_info.get('up_date')[:8],
129 'view_count': int_or_none(clip_info.get('play_count')),