3 from .common
import InfoExtractor
5 compat_urllib_parse_unquote
,
7 from ..utils
import parse_qs
10 class DaumBaseIE(InfoExtractor
):
11 _KAKAO_EMBED_BASE
= 'http://tv.kakao.com/embed/player/cliplink/'
14 class DaumIE(DaumBaseIE
):
15 _VALID_URL
= r
'https?://(?:(?:m\.)?tvpot\.daum\.net/v/|videofarm\.daum\.net/controller/player/VodPlayer\.swf\?vid=)(?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',
26 'thumbnail': r
're:^https?://.*\.(?:jpg|png)',
30 'uploader_id': 186139,
32 'timestamp': 1387310323,
35 'url': 'http://m.tvpot.daum.net/v/65139429',
39 'title': '1297회, \'아빠 아들로 태어나길 잘 했어\' 민수, 감동의 눈물[아빠 어디가] 20150118',
40 'description': 'md5:79794514261164ff27e36a21ad229fc5',
41 'upload_date': '20150118',
42 'thumbnail': r
're:^https?://.*\.(?:jpg|png)',
47 'uploader_id': 132251,
48 'timestamp': 1421604228,
51 'url': 'http://tvpot.daum.net/v/07dXWRka62Y%24',
52 'only_matching': True,
54 'url': 'http://videofarm.daum.net/controller/player/VodPlayer.swf?vid=vwIpVpCQsT8%24&ref=',
58 'title': '01-Korean War ( Trouble on the horizon )',
59 'description': 'Korean War 01\r\nTrouble on the horizon\r\n전쟁의 먹구름',
60 'upload_date': '20080223',
61 'thumbnail': r
're:^https?://.*\.(?:jpg|png)',
65 'uploader': '까칠한 墮落始祖 황비홍님의',
66 'uploader_id': 560824,
67 'timestamp': 1203770745,
70 # Requires dte_type=WEB (#9972)
71 'url': 'http://tvpot.daum.net/v/s3794Uf1NZeZ1qMpGpeqeRU',
72 'md5': 'a8917742069a4dd442516b86e7d66529',
74 'id': 's3794Uf1NZeZ1qMpGpeqeRU',
76 'title': '러블리즈 - Destiny (나의 지구) (Lovelyz - Destiny)',
77 'description': '러블리즈 - Destiny (나의 지구) (Lovelyz - Destiny)\r\n\r\n[쇼! 음악중심] 20160611, 507회',
78 'upload_date': '20170129',
79 'uploader': '쇼! 음악중심',
80 'uploader_id': 2653210,
81 'timestamp': 1485684628,
85 def _real_extract(self
, url
):
86 video_id
= compat_urllib_parse_unquote(self
._match
_id
(url
))
87 if not video_id
.isdigit():
89 return self
.url_result(
90 self
._KAKAO
_EMBED
_BASE
+ video_id
, 'Kakao', video_id
)
93 class DaumClipIE(DaumBaseIE
):
94 _VALID_URL
= r
'https?://(?:m\.)?tvpot\.daum\.net/(?:clip/ClipView.(?:do|tv)|mypot/View.do)\?.*?clipid=(?P<id>\d+)'
95 IE_NAME
= 'daum.net:clip'
96 _URL_TEMPLATE
= 'http://tvpot.daum.net/clip/ClipView.do?clipid=%s'
99 'url': 'http://tvpot.daum.net/clip/ClipView.do?clipid=52554690',
103 'title': 'DOTA 2GETHER 시즌2 6회 - 2부',
104 'description': 'DOTA 2GETHER 시즌2 6회 - 2부',
105 'upload_date': '20130831',
106 'thumbnail': r
're:^https?://.*\.(?:jpg|png)',
109 'uploader': 'GOMeXP',
111 'timestamp': 1377911092,
114 'url': 'http://m.tvpot.daum.net/clip/ClipView.tv?clipid=54999425',
115 'only_matching': True,
119 def suitable(cls
, url
):
120 return False if DaumPlaylistIE
.suitable(url
) or DaumUserIE
.suitable(url
) else super(DaumClipIE
, cls
).suitable(url
)
122 def _real_extract(self
, url
):
123 video_id
= self
._match
_id
(url
)
124 return self
.url_result(
125 self
._KAKAO
_EMBED
_BASE
+ video_id
, 'Kakao', video_id
)
128 class DaumListIE(InfoExtractor
): # XXX: Conventionally, base classes should end with BaseIE/InfoExtractor
129 def _get_entries(self
, list_id
, list_id_type
):
132 for pagenum
in itertools
.count(1):
133 list_info
= self
._download
_json
(
134 'http://tvpot.daum.net/mypot/json/GetClipInfo.do?size=48&init=true&order=date&page=%d&%s=%s' % (
135 pagenum
, list_id_type
, list_id
), list_id
, 'Downloading list info - %s' % pagenum
)
139 'http://tvpot.daum.net/v/%s' % clip
['vid'])
140 for clip
in list_info
['clip_list']
144 name
= list_info
.get('playlist_bean', {}).get('name') or \
145 list_info
.get('potInfo', {}).get('name')
147 if not list_info
.get('has_more'):
152 def _check_clip(self
, url
, list_id
):
153 query_dict
= parse_qs(url
)
154 if 'clipid' in query_dict
:
155 clip_id
= query_dict
['clipid'][0]
156 if not self
._yes
_playlist
(list_id
, clip_id
):
157 return self
.url_result(DaumClipIE
._URL
_TEMPLATE
% clip_id
, 'DaumClip')
160 class DaumPlaylistIE(DaumListIE
):
161 _VALID_URL
= r
'https?://(?:m\.)?tvpot\.daum\.net/mypot/(?:View\.do|Top\.tv)\?.*?playlistid=(?P<id>[0-9]+)'
162 IE_NAME
= 'daum.net:playlist'
163 _URL_TEMPLATE
= 'http://tvpot.daum.net/mypot/View.do?playlistid=%s'
166 'note': 'Playlist url with clipid',
167 'url': 'http://tvpot.daum.net/mypot/View.do?playlistid=6213966&clipid=73806844',
170 'title': 'Woorissica Official',
172 'playlist_mincount': 181
174 'note': 'Playlist url with clipid - noplaylist',
175 'url': 'http://tvpot.daum.net/mypot/View.do?playlistid=6213966&clipid=73806844',
179 'title': '151017 Airport',
180 'upload_date': '20160117',
184 'skip_download': True,
189 def suitable(cls
, url
):
190 return False if DaumUserIE
.suitable(url
) else super(DaumPlaylistIE
, cls
).suitable(url
)
192 def _real_extract(self
, url
):
193 list_id
= self
._match
_id
(url
)
195 clip_result
= self
._check
_clip
(url
, list_id
)
199 name
, entries
= self
._get
_entries
(list_id
, 'playlistid')
201 return self
.playlist_result(entries
, list_id
, name
)
204 class DaumUserIE(DaumListIE
):
205 _VALID_URL
= r
'https?://(?:m\.)?tvpot\.daum\.net/mypot/(?:View|Top)\.(?:do|tv)\?.*?ownerid=(?P<id>[0-9a-zA-Z]+)'
206 IE_NAME
= 'daum.net:user'
209 'url': 'http://tvpot.daum.net/mypot/View.do?ownerid=o2scDLIVbHc0',
211 'id': 'o2scDLIVbHc0',
212 'title': '마이 리틀 텔레비전',
214 'playlist_mincount': 213
216 'url': 'http://tvpot.daum.net/mypot/View.do?ownerid=o2scDLIVbHc0&clipid=73801156',
220 'title': '[미공개] 김구라, 오만석이 부릅니다 \'오케피\' - 마이 리틀 텔레비전 20160116',
221 'upload_date': '20160117',
222 'description': 'md5:5e91d2d6747f53575badd24bd62b9f36'
226 'skip_download': True,
229 'note': 'Playlist url has ownerid and playlistid, playlistid takes precedence',
230 'url': 'http://tvpot.daum.net/mypot/View.do?ownerid=o2scDLIVbHc0&playlistid=6196631',
233 'title': '마이 리틀 텔레비전 - 20160109',
237 'url': 'http://tvpot.daum.net/mypot/Top.do?ownerid=o2scDLIVbHc0',
238 'only_matching': True,
240 'url': 'http://m.tvpot.daum.net/mypot/Top.tv?ownerid=45x1okb1If50&playlistid=3569733',
241 'only_matching': True,
244 def _real_extract(self
, url
):
245 list_id
= self
._match
_id
(url
)
247 clip_result
= self
._check
_clip
(url
, list_id
)
251 query_dict
= parse_qs(url
)
252 if 'playlistid' in query_dict
:
253 playlist_id
= query_dict
['playlistid'][0]
254 return self
.url_result(DaumPlaylistIE
._URL
_TEMPLATE
% playlist_id
, 'DaumPlaylist')
256 name
, entries
= self
._get
_entries
(list_id
, 'ownerid')
258 return self
.playlist_result(entries
, list_id
, name
)