]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/daum.py
d418ce4a8a29c122e811c96aac76d388c790b560
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
(
32 r
'<iframe src="http://videofarm.daum.net/controller/video/viewer/Video.html\?.*?vid=(.+?)[&"]',
34 query
= compat_urllib_parse
.urlencode({'vid': full_id
})
35 info
= self
._download
_xml
(
36 'http://tvpot.daum.net/clip/ClipInfoXml.do?' + query
, video_id
,
37 u
'Downloading video info')
38 urls
= self
._download
_xml
(
39 'http://videofarm.daum.net/controller/api/open/v1_2/MovieData.apixml?' + query
,
40 video_id
, u
'Downloading video formats info')
42 self
.to_screen(u
'%s: Getting video urls' % video_id
)
44 for format_el
in urls
.findall('result/output_list/output_list'):
45 profile
= format_el
.attrib
['profile']
46 format_query
= compat_urllib_parse
.urlencode({
50 url_doc
= self
._download
_xml
(
51 'http://videofarm.daum.net/controller/api/open/v1_2/MovieLocation.apixml?' + format_query
,
53 format_url
= url_doc
.find('result/url').text
56 'ext': determine_ext(format_url
),
62 'title': info
.find('TITLE').text
,
64 'thumbnail': self
._og
_search
_thumbnail
(webpage
),
65 'description': info
.find('CONTENTS').text
,
66 'duration': int(info
.find('DURATION').text
),
67 'upload_date': info
.find('REGDTTM').text
[:8],