|
|
@ -7,8 +7,10 @@ import itertools
|
|
|
|
|
|
|
|
|
|
|
|
from .common import InfoExtractor
|
|
|
|
from .common import InfoExtractor
|
|
|
|
from ..compat import (
|
|
|
|
from ..compat import (
|
|
|
|
|
|
|
|
compat_parse_qs,
|
|
|
|
compat_urllib_parse,
|
|
|
|
compat_urllib_parse,
|
|
|
|
compat_urllib_parse_unquote,
|
|
|
|
compat_urllib_parse_unquote,
|
|
|
|
|
|
|
|
compat_urlparse,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
from ..utils import (
|
|
|
|
from ..utils import (
|
|
|
|
int_or_none,
|
|
|
|
int_or_none,
|
|
|
@ -117,6 +119,7 @@ class DaumIE(InfoExtractor):
|
|
|
|
class DaumClipIE(InfoExtractor):
|
|
|
|
class DaumClipIE(InfoExtractor):
|
|
|
|
_VALID_URL = r'https?://(?:m\.)?tvpot\.daum\.net/(?:clip/ClipView.(?:do|tv)|mypot/View.do)\?.*?clipid=(?P<id>\d+)'
|
|
|
|
_VALID_URL = r'https?://(?:m\.)?tvpot\.daum\.net/(?:clip/ClipView.(?:do|tv)|mypot/View.do)\?.*?clipid=(?P<id>\d+)'
|
|
|
|
IE_NAME = 'daum.net:clip'
|
|
|
|
IE_NAME = 'daum.net:clip'
|
|
|
|
|
|
|
|
_URL_TEMPLATE = 'http://tvpot.daum.net/clip/ClipView.do?clipid=%s'
|
|
|
|
|
|
|
|
|
|
|
|
_TESTS = [{
|
|
|
|
_TESTS = [{
|
|
|
|
'url': 'http://tvpot.daum.net/clip/ClipView.do?clipid=52554690',
|
|
|
|
'url': 'http://tvpot.daum.net/clip/ClipView.do?clipid=52554690',
|
|
|
@ -135,6 +138,10 @@ class DaumClipIE(InfoExtractor):
|
|
|
|
'only_matching': True,
|
|
|
|
'only_matching': True,
|
|
|
|
}]
|
|
|
|
}]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
|
|
|
def suitable(cls, url):
|
|
|
|
|
|
|
|
return False if DaumPlaylistIE.suitable(url) or DaumUserIE.suitable(url) else super(DaumClipIE, cls).suitable(url)
|
|
|
|
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
def _real_extract(self, url):
|
|
|
|
video_id = self._match_id(url)
|
|
|
|
video_id = self._match_id(url)
|
|
|
|
clip_info = self._download_json(
|
|
|
|
clip_info = self._download_json(
|
|
|
@ -179,10 +186,21 @@ class DaumListIE(InfoExtractor):
|
|
|
|
|
|
|
|
|
|
|
|
return name, entries
|
|
|
|
return name, entries
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _check_clip(self, url, list_id):
|
|
|
|
|
|
|
|
query_dict = compat_parse_qs(compat_urlparse.urlparse(url).query)
|
|
|
|
|
|
|
|
if 'clipid' in query_dict:
|
|
|
|
|
|
|
|
clip_id = query_dict['clipid'][0]
|
|
|
|
|
|
|
|
if self._downloader.params.get('noplaylist'):
|
|
|
|
|
|
|
|
self.to_screen('Downloading just video %s because of --no-playlist' % clip_id)
|
|
|
|
|
|
|
|
return self.url_result(DaumClipIE._URL_TEMPLATE % clip_id, 'DaumClip')
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
self.to_screen('Downloading playlist %s - add --no-playlist to just download video' % list_id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class DaumPlaylistIE(DaumListIE):
|
|
|
|
class DaumPlaylistIE(DaumListIE):
|
|
|
|
_VALID_URL = r'https?://(?:m\.)?tvpot\.daum\.net/mypot/(?:View\.do|Top\.tv)\?.*?playlistid=(?P<id>[0-9]+)'
|
|
|
|
_VALID_URL = r'https?://(?:m\.)?tvpot\.daum\.net/mypot/(?:View\.do|Top\.tv)\?.*?playlistid=(?P<id>[0-9]+)'
|
|
|
|
IE_NAME = 'daum.net:playlist'
|
|
|
|
IE_NAME = 'daum.net:playlist'
|
|
|
|
|
|
|
|
_URL_TEMPLATE = 'http://tvpot.daum.net/mypot/View.do?playlistid=%s'
|
|
|
|
|
|
|
|
|
|
|
|
_TESTS = [{
|
|
|
|
_TESTS = [{
|
|
|
|
'note': 'Playlist url with clipid',
|
|
|
|
'note': 'Playlist url with clipid',
|
|
|
@ -207,12 +225,16 @@ class DaumPlaylistIE(DaumListIE):
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
}]
|
|
|
|
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
@classmethod
|
|
|
|
if DaumClipIE.suitable(url) and self._downloader.params.get('noplaylist'):
|
|
|
|
def suitable(cls, url):
|
|
|
|
return self.url_result(url, 'DaumClip')
|
|
|
|
return False if DaumUserIE.suitable(url) else super(DaumPlaylistIE, cls).suitable(url)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
list_id = self._match_id(url)
|
|
|
|
list_id = self._match_id(url)
|
|
|
|
self.to_screen('Downloading playlist %s - add --no-playlist to just download video' % list_id)
|
|
|
|
|
|
|
|
|
|
|
|
clip_result = self._check_clip(url, list_id)
|
|
|
|
|
|
|
|
if clip_result:
|
|
|
|
|
|
|
|
return clip_result
|
|
|
|
|
|
|
|
|
|
|
|
name, entries = self._get_entries(list_id, 'playlistid')
|
|
|
|
name, entries = self._get_entries(list_id, 'playlistid')
|
|
|
|
|
|
|
|
|
|
|
@ -257,14 +279,17 @@ class DaumUserIE(DaumListIE):
|
|
|
|
}]
|
|
|
|
}]
|
|
|
|
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
def _real_extract(self, url):
|
|
|
|
if DaumClipIE.suitable(url) and self._downloader.params.get('noplaylist'):
|
|
|
|
list_id = self._match_id(url)
|
|
|
|
return self.url_result(url, 'DaumClip')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if DaumPlaylistIE.suitable(url):
|
|
|
|
clip_result = self._check_clip(url, list_id)
|
|
|
|
return self.url_result(url, 'DaumPlaylist')
|
|
|
|
if clip_result:
|
|
|
|
|
|
|
|
return clip_result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
query_dict = compat_parse_qs(compat_urlparse.urlparse(url).query)
|
|
|
|
|
|
|
|
if 'playlistid' in query_dict:
|
|
|
|
|
|
|
|
playlist_id = query_dict['playlistid'][0]
|
|
|
|
|
|
|
|
return self.url_result(DaumPlaylistIE._URL_TEMPLATE % playlist_id, 'DaumPlaylist')
|
|
|
|
|
|
|
|
|
|
|
|
list_id = self._match_id(url)
|
|
|
|
|
|
|
|
self.to_screen('Downloading playlist %s - add --no-playlist to just download video' % list_id)
|
|
|
|
|
|
|
|
name, entries = self._get_entries(list_id, 'ownerid')
|
|
|
|
name, entries = self._get_entries(list_id, 'ownerid')
|
|
|
|
|
|
|
|
|
|
|
|
return self.playlist_result(entries, list_id, name)
|
|
|
|
return self.playlist_result(entries, list_id, name)
|
|
|
|