3 from __future__ import unicode_literals
5 from .common import InfoExtractor
6 from ..compat import compat_urllib_parse
14 class DaumIE(InfoExtractor):
15 _VALID_URL = r'https?://(?:m\.)?tvpot\.daum\.net/v/(?P<id>[^?#&]+)'
19 'url': 'http://tvpot.daum.net/v/vab4dyeDBysyBssyukBUjBz',
21 'id': 'vab4dyeDBysyBssyukBUjBz',
23 'title': '마크 헌트 vs 안토니오 실바',
24 'description': 'Mark Hunt vs Antonio Silva',
25 'upload_date': '20131217',
31 'url': 'http://tvpot.daum.net/v/07dXWRka62Y%24',
32 'only_matching': True,
35 def _real_extract(self, url):
36 video_id = self._match_id(url)
37 query = compat_urllib_parse.urlencode({'vid': video_id})
38 info = self._download_xml(
39 'http://tvpot.daum.net/clip/ClipInfoXml.do?' + query, video_id,
40 'Downloading video info')
41 movie_data = self._download_json(
42 'http://videofarm.daum.net/controller/api/closed/v1_2/IntegratedMovieData.json?' + query,
43 video_id, 'Downloading video formats info')
46 for format_el in movie_data['output_list']['output_list']:
47 profile = format_el['profile']
48 format_query = compat_urllib_parse.urlencode({
52 url_doc = self._download_xml(
53 'http://videofarm.daum.net/controller/api/open/v1_2/MovieLocation.apixml?' + format_query,
54 video_id, note='Downloading video data for %s format' % profile)
55 format_url = url_doc.find('result/url').text
59 'width': int_or_none(format_el.get('width')),
60 'height': int_or_none(format_el.get('height')),
61 'filesize': int_or_none(format_el.get('filesize')),
63 self._sort_formats(formats)
67 'title': info.find('TITLE').text,
69 'thumbnail': xpath_text(info, 'THUMB_URL'),
70 'description': xpath_text(info, 'CONTENTS'),
71 'duration': int_or_none(xpath_text(info, 'DURATION')),
72 'upload_date': info.find('REGDTTM').text[:8],
73 'view_count': str_to_int(xpath_text(info, 'PLAY_CNT')),
74 'comment_count': str_to_int(xpath_text(info, 'COMMENT_CNT')),
78 class DaumClipIE(InfoExtractor):
79 _VALID_URL = r'https?://(?:m\.)?tvpot\.daum\.net/(?:clip/ClipView.do|mypot/View.do)\?.*?clipid=(?P<id>\d+)'
80 IE_NAME = 'daum.net:clip'
83 'url': 'http://tvpot.daum.net/clip/ClipView.do?clipid=52554690',
87 'title': 'DOTA 2GETHER 시즌2 6회 - 2부',
88 'description': 'DOTA 2GETHER 시즌2 6회 - 2부',
89 'upload_date': '20130831',
95 def _real_extract(self, url):
96 video_id = self._match_id(url)
97 clip_info = self._download_json(
98 'http://tvpot.daum.net/mypot/json/GetClipInfo.do?clipid=%s' % video_id,
99 video_id, 'Downloading clip info')['clip_bean']
102 '_type': 'url_transparent',
104 'url': 'http://tvpot.daum.net/v/%s' % clip_info['vid'],
105 'title': clip_info['title'],
106 'thumbnail': clip_info.get('thumb_url'),
107 'description': clip_info.get('contents'),
108 'duration': int_or_none(clip_info.get('duration')),
109 'upload_date': clip_info.get('up_date')[:8],
110 'view_count': int_or_none(clip_info.get('play_count')),