]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[rte] Improve thumbnail extraction (Closes #9085)
authorSergey M․ <dstftw@gmail.com>
Tue, 5 Apr 2016 16:23:20 +0000 (22:23 +0600)
committerSergey M․ <dstftw@gmail.com>
Tue, 5 Apr 2016 16:23:20 +0000 (22:23 +0600)
youtube_dl/extractor/rte.py

index 9c89974e7bf4f21d5c7a6f5f6eeacb500e761a28..ebe563ebb89e86e28a6bf55669cd066aca44d851 100644 (file)
@@ -39,9 +39,14 @@ class RteIE(InfoExtractor):
         duration = float_or_none(self._html_search_meta(
             'duration', webpage, 'duration', fatal=False), 1000)
 
-        thumbnail_id = self._search_regex(
-            r'<meta name="thumbnail" content="uri:irus:(.*?)" />', webpage, 'thumbnail')
-        thumbnail = 'http://img.rasset.ie/' + thumbnail_id + '.jpg'
+        thumbnail = None
+        thumbnail_meta = self._html_search_meta('thumbnail', webpage)
+        if thumbnail_meta:
+            thumbnail_id = self._search_regex(
+                r'uri:irus:(.+)', thumbnail_meta,
+                'thumbnail id', fatal=False)
+            if thumbnail_id:
+                thumbnail = 'http://img.rasset.ie/%s.jpg' % thumbnail_id
 
         feeds_url = self._html_search_meta('feeds-prefix', webpage, 'feeds url') + video_id
         json_string = self._download_json(feeds_url, video_id)