3 from __future__
import unicode_literals
8 from .common
import InfoExtractor
11 compat_urllib_parse_unquote
,
21 class DaumIE(InfoExtractor
):
22 _VALID_URL
= r
'https?://(?:(?:m\.)?tvpot\.daum\.net/v/|videofarm\.daum\.net/controller/player/VodPlayer\.swf\?vid=)(?P<id>[^?#&]+)'
26 'url': 'http://tvpot.daum.net/v/vab4dyeDBysyBssyukBUjBz',
28 'id': 'vab4dyeDBysyBssyukBUjBz',
30 'title': '마크 헌트 vs 안토니오 실바',
31 'description': 'Mark Hunt vs Antonio Silva',
32 'upload_date': '20131217',
33 'thumbnail': 're:^https?://.*\.(?:jpg|png)',
39 'url': 'http://m.tvpot.daum.net/v/65139429',
43 'title': 'md5:a100d65d09cec246d8aa9bde7de45aed',
44 'description': 'md5:79794514261164ff27e36a21ad229fc5',
45 'upload_date': '20150604',
46 'thumbnail': 're:^https?://.*\.(?:jpg|png)',
52 'url': 'http://tvpot.daum.net/v/07dXWRka62Y%24',
53 'only_matching': True,
55 'url': 'http://videofarm.daum.net/controller/player/VodPlayer.swf?vid=vwIpVpCQsT8%24&ref=',
59 'title': '01-Korean War ( Trouble on the horizon )',
60 'description': '\nKorean War 01\nTrouble on the horizon\n전쟁의 먹구름',
61 'upload_date': '20080223',
62 'thumbnail': 're:^https?://.*\.(?:jpg|png)',
69 def _real_extract(self
, url
):
70 video_id
= compat_urllib_parse_unquote(self
._match
_id
(url
))
71 query
= compat_urllib_parse
.urlencode({'vid': video_id}
)
72 movie_data
= self
._download
_json
(
73 'http://videofarm.daum.net/controller/api/closed/v1_2/IntegratedMovieData.json?' + query
,
74 video_id
, 'Downloading video formats info')
76 # For urls like http://m.tvpot.daum.net/v/65139429, where the video_id is really a clipid
77 if not movie_data
.get('output_list', {}).get('output_list') and re
.match(r
'^\d+$', video_id
):
78 return self
.url_result('http://tvpot.daum.net/clip/ClipView.do?clipid=%s' % video_id
)
80 info
= self
._download
_xml
(
81 'http://tvpot.daum.net/clip/ClipInfoXml.do?' + query
, video_id
,
82 'Downloading video info')
85 for format_el
in movie_data
['output_list']['output_list']:
86 profile
= format_el
['profile']
87 format_query
= compat_urllib_parse
.urlencode({
91 url_doc
= self
._download
_xml
(
92 'http://videofarm.daum.net/controller/api/open/v1_2/MovieLocation.apixml?' + format_query
,
93 video_id
, note
='Downloading video data for %s format' % profile
)
94 format_url
= url_doc
.find('result/url').text
98 'width': int_or_none(format_el
.get('width')),
99 'height': int_or_none(format_el
.get('height')),
100 'filesize': int_or_none(format_el
.get('filesize')),
102 self
._sort
_formats
(formats
)
106 'title': info
.find('TITLE').text
,
108 'thumbnail': xpath_text(info
, 'THUMB_URL'),
109 'description': xpath_text(info
, 'CONTENTS'),
110 'duration': int_or_none(xpath_text(info
, 'DURATION')),
111 'upload_date': info
.find('REGDTTM').text
[:8],
112 'view_count': str_to_int(xpath_text(info
, 'PLAY_CNT')),
113 'comment_count': str_to_int(xpath_text(info
, 'COMMENT_CNT')),
117 class DaumClipIE(InfoExtractor
):
118 _VALID_URL
= r
'https?://(?:m\.)?tvpot\.daum\.net/(?:clip/ClipView.(?:do|tv)|mypot/View.do)\?.*?clipid=(?P<id>\d+)'
119 IE_NAME
= 'daum.net:clip'
122 'url': 'http://tvpot.daum.net/clip/ClipView.do?clipid=52554690',
126 'title': 'DOTA 2GETHER 시즌2 6회 - 2부',
127 'description': 'DOTA 2GETHER 시즌2 6회 - 2부',
128 'upload_date': '20130831',
129 'thumbnail': 're:^https?://.*\.(?:jpg|png)',
134 'url': 'http://m.tvpot.daum.net/clip/ClipView.tv?clipid=54999425',
135 'only_matching': True,
138 def _real_extract(self
, url
):
139 video_id
= self
._match
_id
(url
)
140 clip_info
= self
._download
_json
(
141 'http://tvpot.daum.net/mypot/json/GetClipInfo.do?clipid=%s' % video_id
,
142 video_id
, 'Downloading clip info')['clip_bean']
145 '_type': 'url_transparent',
147 'url': 'http://tvpot.daum.net/v/%s' % clip_info
['vid'],
148 'title': unescapeHTML(clip_info
['title']),
149 'thumbnail': clip_info
.get('thumb_url'),
150 'description': clip_info
.get('contents'),
151 'duration': int_or_none(clip_info
.get('duration')),
152 'upload_date': clip_info
.get('up_date')[:8],
153 'view_count': int_or_none(clip_info
.get('play_count')),
158 class DaumListIE(InfoExtractor
):
159 def _get_entries(self
, list_id
, list_id_type
):
162 for pagenum
in itertools
.count(1):
163 list_info
= self
._download
_json
(
164 'http://tvpot.daum.net/mypot/json/GetClipInfo.do?size=48&init=true&order=date&page=%d&%s=%s' % (
165 pagenum
, list_id_type
, list_id
), list_id
,'Downloading list info - %s' % pagenum
)
169 'http://tvpot.daum.net/v/%s' % clip
['vid'])
170 for clip
in list_info
['clip_list']
174 name
= list_info
.get('playlist_bean', {}).get('name') or \
175 list_info
.get('potInfo', {}).get('name')
177 if not list_info
.get('has_more'):
183 class DaumPlaylistIE(DaumListIE
):
184 _VALID_URL
= r
'https?://(?:m\.)?tvpot\.daum\.net/mypot/(?:View\.do|Top\.tv)\?.*?playlistid=(?P<id>[0-9]+)'
185 IE_NAME
= 'daum.net:playlist'
188 'note': 'Playlist url with clipid',
189 'url': 'http://tvpot.daum.net/mypot/View.do?playlistid=6213966&clipid=73806844',
192 'title': 'Woorissica Official',
194 'playlist_mincount': 181
196 'note': 'Playlist url with clipid - noplaylist',
197 'url': 'http://tvpot.daum.net/mypot/View.do?playlistid=6213966&clipid=73806844',
201 'title': '151017 Airport',
202 'upload_date': '20160117',
206 'skip_download': True,
210 def _real_extract(self
, url
):
211 if DaumClipIE
.suitable(url
) and self
._downloader
.params
.get('noplaylist'):
212 return self
.url_result(url
, 'DaumClip')
214 list_id
= self
._match
_id
(url
)
215 self
.to_screen('Downloading playlist %s - add --no-playlist to just download video' % list_id
)
217 name
, entries
= self
._get
_entries
(list_id
, 'playlistid')
219 return self
.playlist_result(entries
, list_id
, name
)
222 class DaumUserIE(DaumListIE
):
223 _VALID_URL
= r
'https?://(?:m\.)?tvpot\.daum\.net/mypot/(?:View|Top)\.do\?.*?ownerid=(?P<id>[0-9a-zA-Z]+)'
224 IE_NAME
= 'daum.net:user'
227 'url': 'http://tvpot.daum.net/mypot/View.do?ownerid=o2scDLIVbHc0',
229 'id': 'o2scDLIVbHc0',
230 'title': '마이 리틀 텔레비전',
232 'playlist_mincount': 213
234 'url': 'http://tvpot.daum.net/mypot/View.do?ownerid=o2scDLIVbHc0&clipid=73801156',
238 'title': '[미공개] 김구라, 오만석이 부릅니다 \'오케피\' - 마이 리틀 텔레비전 20160116',
239 'upload_date': '20160117',
240 'description': 'md5:5e91d2d6747f53575badd24bd62b9f36'
244 'skip_download': True,
247 'note': 'Playlist url has ownerid and playlistid, playlistid takes precedence',
248 'url': 'http://tvpot.daum.net/mypot/View.do?ownerid=o2scDLIVbHc0&playlistid=6196631',
251 'title': '마이 리틀 텔레비전 - 20160109',
255 'url': 'http://tvpot.daum.net/mypot/Top.do?ownerid=o2scDLIVbHc0',
256 'only_matching': True,
259 def _real_extract(self
, url
):
260 if DaumClipIE
.suitable(url
) and self
._downloader
.params
.get('noplaylist'):
261 return self
.url_result(url
, 'DaumClip')
263 if DaumPlaylistIE
.suitable(url
):
264 return self
.url_result(url
, 'DaumPlaylist')
266 list_id
= self
._match
_id
(url
)
267 self
.to_screen('Downloading playlist %s - add --no-playlist to just download video' % list_id
)
268 name
, entries
= self
._get
_entries
(list_id
, 'ownerid')
270 return self
.playlist_result(entries
, list_id
, name
)