4 from .common
import InfoExtractor
5 from ..utils
import parse_qs
8 class DaumBaseIE(InfoExtractor
):
9 _KAKAO_EMBED_BASE
= 'http://tv.kakao.com/embed/player/cliplink/'
12 class DaumIE(DaumBaseIE
):
13 _VALID_URL
= r
'https?://(?:(?:m\.)?tvpot\.daum\.net/v/|videofarm\.daum\.net/controller/player/VodPlayer\.swf\?vid=)(?P<id>[^?#&]+)'
17 'url': 'http://tvpot.daum.net/v/vab4dyeDBysyBssyukBUjBz',
19 'id': 'vab4dyeDBysyBssyukBUjBz',
21 'title': '마크 헌트 vs 안토니오 실바',
22 'description': 'Mark Hunt vs Antonio Silva',
23 'upload_date': '20131217',
24 'thumbnail': r
're:^https?://.*\.(?:jpg|png)',
28 'uploader_id': '186139',
30 'timestamp': 1387310323,
33 'url': 'http://m.tvpot.daum.net/v/65139429',
37 'title': '1297회, \'아빠 아들로 태어나길 잘 했어\' 민수, 감동의 눈물[아빠 어디가] 20150118',
38 'description': 'md5:79794514261164ff27e36a21ad229fc5',
39 'upload_date': '20150118',
40 'thumbnail': r
're:^https?://.*\.(?:jpg|png)',
45 'uploader_id': '132251',
46 'timestamp': 1421604228,
49 'url': 'http://tvpot.daum.net/v/07dXWRka62Y%24',
50 'only_matching': True,
52 'url': 'http://videofarm.daum.net/controller/player/VodPlayer.swf?vid=vwIpVpCQsT8%24&ref=',
56 'title': '01-Korean War ( Trouble on the horizon )',
57 'description': 'Korean War 01\r\nTrouble on the horizon\r\n전쟁의 먹구름',
58 'upload_date': '20080223',
59 'thumbnail': r
're:^https?://.*\.(?:jpg|png)',
63 'uploader': '까칠한 墮落始祖 황비홍님의',
64 'uploader_id': '560824',
65 'timestamp': 1203770745,
68 # Requires dte_type=WEB (#9972)
69 'url': 'http://tvpot.daum.net/v/s3794Uf1NZeZ1qMpGpeqeRU',
70 'md5': 'a8917742069a4dd442516b86e7d66529',
72 'id': 's3794Uf1NZeZ1qMpGpeqeRU',
74 'title': '러블리즈 - Destiny (나의 지구) (Lovelyz - Destiny)',
75 'description': '러블리즈 - Destiny (나의 지구) (Lovelyz - Destiny)\r\n\r\n[쇼! 음악중심] 20160611, 507회',
76 'upload_date': '20170129',
77 'uploader': '쇼! 음악중심',
78 'uploader_id': '2653210',
79 'timestamp': 1485684628,
83 def _real_extract(self
, url
):
84 video_id
= urllib
.parse
.unquote(self
._match
_id
(url
))
85 if not video_id
.isdigit():
87 return self
.url_result(
88 self
._KAKAO
_EMBED
_BASE
+ video_id
, 'Kakao', video_id
)
91 class DaumClipIE(DaumBaseIE
):
92 _VALID_URL
= r
'https?://(?:m\.)?tvpot\.daum\.net/(?:clip/ClipView.(?:do|tv)|mypot/View.do)\?.*?clipid=(?P<id>\d+)'
93 IE_NAME
= 'daum.net:clip'
94 _URL_TEMPLATE
= 'http://tvpot.daum.net/clip/ClipView.do?clipid=%s'
97 'url': 'http://tvpot.daum.net/clip/ClipView.do?clipid=52554690',
101 'title': 'DOTA 2GETHER 시즌2 6회 - 2부',
102 'description': 'DOTA 2GETHER 시즌2 6회 - 2부',
103 'upload_date': '20130831',
104 'thumbnail': r
're:^https?://.*\.(?:jpg|png)',
107 'uploader': 'GOMeXP',
108 'uploader_id': '6667',
109 'timestamp': 1377911092,
112 'url': 'http://m.tvpot.daum.net/clip/ClipView.tv?clipid=54999425',
113 'only_matching': True,
117 def suitable(cls
, url
):
118 return False if DaumPlaylistIE
.suitable(url
) or DaumUserIE
.suitable(url
) else super().suitable(url
)
120 def _real_extract(self
, url
):
121 video_id
= self
._match
_id
(url
)
122 return self
.url_result(
123 self
._KAKAO
_EMBED
_BASE
+ video_id
, 'Kakao', video_id
)
126 class DaumListIE(InfoExtractor
): # XXX: Conventionally, base classes should end with BaseIE/InfoExtractor
127 def _get_entries(self
, list_id
, list_id_type
):
130 for pagenum
in itertools
.count(1):
131 list_info
= self
._download
_json
(
132 f
'http://tvpot.daum.net/mypot/json/GetClipInfo.do?size=48&init=true&order=date&page={pagenum}&{list_id_type}={list_id}',
133 list_id
, f
'Downloading list info - {pagenum}')
137 'http://tvpot.daum.net/v/{}'.format(clip
['vid']))
138 for clip
in list_info
['clip_list']
142 name
= list_info
.get('playlist_bean', {}).get('name') or \
143 list_info
.get('potInfo', {}).get('name')
145 if not list_info
.get('has_more'):
150 def _check_clip(self
, url
, list_id
):
151 query_dict
= parse_qs(url
)
152 if 'clipid' in query_dict
:
153 clip_id
= query_dict
['clipid'][0]
154 if not self
._yes
_playlist
(list_id
, clip_id
):
155 return self
.url_result(DaumClipIE
._URL
_TEMPLATE
% clip_id
, 'DaumClip')
158 class DaumPlaylistIE(DaumListIE
):
159 _VALID_URL
= r
'https?://(?:m\.)?tvpot\.daum\.net/mypot/(?:View\.do|Top\.tv)\?.*?playlistid=(?P<id>[0-9]+)'
160 IE_NAME
= 'daum.net:playlist'
161 _URL_TEMPLATE
= 'http://tvpot.daum.net/mypot/View.do?playlistid=%s'
164 'note': 'Playlist url with clipid',
165 'url': 'http://tvpot.daum.net/mypot/View.do?playlistid=6213966&clipid=73806844',
168 'title': 'Woorissica Official',
170 'playlist_mincount': 181,
172 'note': 'Playlist url with clipid - noplaylist',
173 'url': 'http://tvpot.daum.net/mypot/View.do?playlistid=6213966&clipid=73806844',
177 'title': '151017 Airport',
178 'upload_date': '20160117',
182 'skip_download': True,
187 def suitable(cls
, url
):
188 return False if DaumUserIE
.suitable(url
) else super().suitable(url
)
190 def _real_extract(self
, url
):
191 list_id
= self
._match
_id
(url
)
193 clip_result
= self
._check
_clip
(url
, list_id
)
197 name
, entries
= self
._get
_entries
(list_id
, 'playlistid')
199 return self
.playlist_result(entries
, list_id
, name
)
202 class DaumUserIE(DaumListIE
):
203 _VALID_URL
= r
'https?://(?:m\.)?tvpot\.daum\.net/mypot/(?:View|Top)\.(?:do|tv)\?.*?ownerid=(?P<id>[0-9a-zA-Z]+)'
204 IE_NAME
= 'daum.net:user'
207 'url': 'http://tvpot.daum.net/mypot/View.do?ownerid=o2scDLIVbHc0',
209 'id': 'o2scDLIVbHc0',
210 'title': '마이 리틀 텔레비전',
212 'playlist_mincount': 213,
214 'url': 'http://tvpot.daum.net/mypot/View.do?ownerid=o2scDLIVbHc0&clipid=73801156',
218 'title': '[미공개] 김구라, 오만석이 부릅니다 \'오케피\' - 마이 리틀 텔레비전 20160116',
219 'upload_date': '20160117',
220 'description': 'md5:5e91d2d6747f53575badd24bd62b9f36',
224 'skip_download': True,
227 'note': 'Playlist url has ownerid and playlistid, playlistid takes precedence',
228 'url': 'http://tvpot.daum.net/mypot/View.do?ownerid=o2scDLIVbHc0&playlistid=6196631',
231 'title': '마이 리틀 텔레비전 - 20160109',
233 'playlist_count': 11,
235 'url': 'http://tvpot.daum.net/mypot/Top.do?ownerid=o2scDLIVbHc0',
236 'only_matching': True,
238 'url': 'http://m.tvpot.daum.net/mypot/Top.tv?ownerid=45x1okb1If50&playlistid=3569733',
239 'only_matching': True,
242 def _real_extract(self
, url
):
243 list_id
= self
._match
_id
(url
)
245 clip_result
= self
._check
_clip
(url
, list_id
)
249 query_dict
= parse_qs(url
)
250 if 'playlistid' in query_dict
:
251 playlist_id
= query_dict
['playlistid'][0]
252 return self
.url_result(DaumPlaylistIE
._URL
_TEMPLATE
% playlist_id
, 'DaumPlaylist')
254 name
, entries
= self
._get
_entries
(list_id
, 'ownerid')
256 return self
.playlist_result(entries
, list_id
, name
)