[thvideo] Simplify (#3848)

This commit is contained in:
Philipp Hagemeister 2014-09-29 00:38:37 +02:00
parent 457ac58cc7
commit 1770ed9e86

View file

@ -26,8 +26,7 @@ class THVideoIE(InfoExtractor):
} }
def _real_extract(self, url): def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url) video_id = self._match_id(url)
video_id = mobj.group('id')
# extract download link from mobile player page # extract download link from mobile player page
webpage_player = self._download_webpage( webpage_player = self._download_webpage(
@ -71,13 +70,15 @@ class THVideoPlaylistIE(InfoExtractor):
} }
def _real_extract(self, url): def _real_extract(self, url):
webpage = self._download_webpage(url, 'playlist') playlist_id = self._match_id(url)
mobj = re.match(self._VALID_URL, url)
list_id = mobj.group('id') webpage = self._download_webpage(url, playlist_id)
list_title = self._html_search_regex(r'<h1 class="show_title">(.*?)<b id', webpage, 'playlist title') list_title = self._html_search_regex(
r'<h1 class="show_title">(.*?)<b id', webpage, 'playlist title',
fatal=False)
entries = [ entries = [
self.url_result('http://thvideo.tv/v/th' + id, 'THVideo') self.url_result('http://thvideo.tv/v/th' + id, 'THVideo')
for id in re.findall(r'<dd><a href="http://thvideo.tv/v/th(\d+)/" target=', webpage)] for id in re.findall(r'<dd><a href="http://thvideo.tv/v/th(\d+)/" target=', webpage)]
return self.playlist_result(entries, list_id, list_title) return self.playlist_result(entries, playlist_id, list_title)