4 from .common import InfoExtractor
11 class DaumIE(InfoExtractor):
12 _VALID_URL = r'https?://tvpot\.daum\.net/.*?clipid=(?P<id>\d+)'
16 u'url': u'http://tvpot.daum.net/clip/ClipView.do?clipid=52554690',
17 u'file': u'52554690.mp4',
19 u'title': u'DOTA 2GETHER 시즌2 6회 - 2부',
20 u'description': u'DOTA 2GETHER 시즌2 6회 - 2부',
21 u'upload_date': u'20130831',
26 def _real_extract(self, url):
27 mobj = re.match(self._VALID_URL, url)
28 video_id = mobj.group(1)
29 canonical_url = 'http://tvpot.daum.net/v/%s' % video_id
30 webpage = self._download_webpage(canonical_url, video_id)
31 full_id = self._search_regex(r'<link rel="video_src" href=".+?vid=(.+?)"',
33 query = compat_urllib_parse.urlencode({'vid': full_id})
34 info = self._download_xml(
35 'http://tvpot.daum.net/clip/ClipInfoXml.do?' + query, video_id,
36 u'Downloading video info')
37 urls = self._download_xml(
38 'http://videofarm.daum.net/controller/api/open/v1_2/MovieData.apixml?' + query,
39 video_id, u'Downloading video formats info')
41 self.to_screen(u'%s: Getting video urls' % video_id)
43 for format_el in urls.findall('result/output_list/output_list'):
44 profile = format_el.attrib['profile']
45 format_query = compat_urllib_parse.urlencode({
49 url_doc = self._download_xml(
50 'http://videofarm.daum.net/controller/api/open/v1_2/MovieLocation.apixml?' + format_query,
52 format_url = url_doc.find('result/url').text
55 'ext': determine_ext(format_url),
61 'title': info.find('TITLE').text,
63 'thumbnail': self._og_search_thumbnail(webpage),
64 'description': info.find('CONTENTS').text,
65 'duration': int(info.find('DURATION').text),
66 'upload_date': info.find('REGDTTM').text[:8],
68 # TODO: Remove when #980 has been merged
69 info.update(formats[-1])