X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fthvideo.py;h=406f4a826623c0335e973a0f6dd79744fb32e982;hb=d6712378e73951bede475569c887a1ac73f660a9;hp=9fa14d3c4c3462eb10fbda5f710e2b9befe31ea5;hpb=72e450c5550ae26b5b36216be1c001f64479c773;p=youtube-dl diff --git a/youtube_dl/extractor/thvideo.py b/youtube_dl/extractor/thvideo.py index 9fa14d3c4..406f4a826 100644 --- a/youtube_dl/extractor/thvideo.py +++ b/youtube_dl/extractor/thvideo.py @@ -10,7 +10,7 @@ from ..utils import ( class THVideoIE(InfoExtractor): - _VALID_URL = r'https?://(?:www\.)?thvideo\.tv/v/th(?P[0-9]+)' + _VALID_URL = r'https?://(?:www\.)?thvideo\.tv/(?:v/th|mobile\.php\?cid=)(?P[0-9]+)' _TEST = { 'url': 'http://thvideo.tv/v/th1987/', 'md5': 'fa107b1f73817e325e9433505a70db50', @@ -26,22 +26,25 @@ class THVideoIE(InfoExtractor): } def _real_extract(self, url): - mobj = re.match(self._VALID_URL, url) - video_id = mobj.group('id') + video_id = self._match_id(url) # extract download link from mobile player page - webpage_player = self._download_webpage('http://thvideo.tv/mobile.php?cid=%s-0' % video_id, video_id) - video_url = self._html_search_regex(r'', webpage, - 'upload date', fatal=False) - upload_date = unified_strdate(upload_date_raw) + upload_date = unified_strdate(self._html_search_regex( + r'span itemprop="datePublished" content="(.*?)">', webpage, + 'upload date', fatal=False)) return { 'id': video_id, @@ -52,4 +55,30 @@ class THVideoIE(InfoExtractor): 'thumbnail': thumbnail, 'description': description, 'upload_date': upload_date - } \ No newline at end of file + } + + +class THVideoPlaylistIE(InfoExtractor): + _VALID_URL = r'http?://(?:www\.)?thvideo\.tv/mylist(?P[0-9]+)' + _TEST = { + 'url': 'http://thvideo.tv/mylist2', + 'info_dict': { + 'id': '2', + 'title': '幻想万華鏡', + }, + 'playlist_mincount': 23, + } + + def _real_extract(self, url): + playlist_id = self._match_id(url) + + webpage = self._download_webpage(url, playlist_id) + list_title = self._html_search_regex( + r'

(.*?)