]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/daum.py
934da765ee700712721281a85dd955c28405001e
3 from __future__
import unicode_literals
7 from .common
import InfoExtractor
13 class DaumIE(InfoExtractor
):
14 _VALID_URL
= r
'https?://(?:m\.)?tvpot\.daum\.net/(?:v/|.*?clipid=)(?P<id>[^?#&]+)'
18 'url': 'http://tvpot.daum.net/clip/ClipView.do?clipid=52554690',
22 'title': 'DOTA 2GETHER 시즌2 6회 - 2부',
23 'description': 'DOTA 2GETHER 시즌2 6회 - 2부',
24 'upload_date': '20130831',
28 'url': 'http://tvpot.daum.net/v/vab4dyeDBysyBssyukBUjBz',
29 'only_matching': True,
31 'url': 'http://tvpot.daum.net/v/07dXWRka62Y%24',
32 'only_matching': True,
35 def _real_extract(self
, url
):
36 mobj
= re
.match(self
._VALID
_URL
, url
)
37 video_id
= mobj
.group('id')
38 canonical_url
= 'http://tvpot.daum.net/v/%s' % video_id
39 webpage
= self
._download
_webpage
(canonical_url
, video_id
)
40 full_id
= self
._search
_regex
(
41 r
'src=["\']http
://videofarm\
.daum\
.net
/controller
/video
/viewer
/Video\
.html
\?.*?vid
=(.+?
)[&"\']',
43 query = compat_urllib_parse.urlencode({'vid': full_id})
44 info = self._download_xml(
45 'http://tvpot.daum.net/clip/ClipInfoXml.do?' + query, video_id,
46 'Downloading video info')
47 urls = self._download_xml(
48 'http://videofarm.daum.net/controller/api/open/v1_2/MovieData.apixml?' + query,
49 video_id, 'Downloading video formats info')
52 for format_el in urls.findall('result/output_list/output_list'):
53 profile = format_el.attrib['profile']
54 format_query = compat_urllib_parse.urlencode({
58 url_doc = self._download_xml(
59 'http://videofarm.daum.net/controller/api/open/v1_2/MovieLocation.apixml?' + format_query,
60 video_id, note='Downloading video data for %s format' % profile)
61 format_url = url_doc.find('result/url').text
69 'title': info.find('TITLE').text,
71 'thumbnail': self._og_search_thumbnail(webpage),
72 'description': info.find('CONTENTS').text,
73 'duration': int(info.find('DURATION').text),
74 'upload_date': info.find('REGDTTM').text[:8],