summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-09-29 00:38:37 +0200
committerPhilipp Hagemeister <phihag@phihag.de>2014-09-29 00:38:37 +0200
commit1770ed9e86a147eceb86210dec0aefcf0d94ab52 (patch)
treed6ad58ded7e8c57304e22fbaea6eeb84c5e2948b
parent457ac58cc72a0b7161a0369a8f282f38ff0f2f93 (diff)
downloadyoutube-dl-1770ed9e86a147eceb86210dec0aefcf0d94ab52.tar.gz
youtube-dl-1770ed9e86a147eceb86210dec0aefcf0d94ab52.tar.xz
youtube-dl-1770ed9e86a147eceb86210dec0aefcf0d94ab52.zip
[thvideo] Simplify (#3848)
-rw-r--r--youtube_dl/extractor/thvideo.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/youtube_dl/extractor/thvideo.py b/youtube_dl/extractor/thvideo.py
index 0ae20ea30..496f15d80 100644
--- a/youtube_dl/extractor/thvideo.py
+++ b/youtube_dl/extractor/thvideo.py
@@ -26,8 +26,7 @@ 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(
@@ -71,13 +70,15 @@ class THVideoPlaylistIE(InfoExtractor):
     }
 
     def _real_extract(self, url):
-        webpage = self._download_webpage(url, 'playlist')
-        mobj = re.match(self._VALID_URL, url)
-        list_id = mobj.group('id')
-        list_title = self._html_search_regex(r'<h1 class="show_title">(.*?)<b id', webpage, 'playlist title')
+        playlist_id = self._match_id(url)
+
+        webpage = self._download_webpage(url, playlist_id)
+        list_title = self._html_search_regex(
+            r'<h1 class="show_title">(.*?)<b id', webpage, 'playlist title',
+            fatal=False)
 
         entries = [
             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)]
 
-        return self.playlist_result(entries, list_id, list_title)
\ No newline at end of file
+        return self.playlist_result(entries, playlist_id, list_title)