]> jfr.im git - yt-dlp.git/commitdiff
[nitter] Fix thumbnails (#216)
authorbopol <redacted>
Mon, 5 Apr 2021 11:23:33 +0000 (13:23 +0200)
committerGitHub <redacted>
Mon, 5 Apr 2021 11:23:33 +0000 (16:53 +0530)
Authored by: B0pol

yt_dlp/extractor/nitter.py

index 3191543ed5a9c1d3827f3f80628e5266db226898..15688b60844e8eed8a2d188c041981c2eb2a1175 100644 (file)
@@ -131,10 +131,10 @@ def _real_extract(self, url):
         repost_count = parse_count(self._html_search_regex(r'<span[^>]+class="icon-retweet[^>]*></span>\s([^<]+)</div>', webpage, 'repost count', fatal=False))
         comment_count = parse_count(self._html_search_regex(r'<span[^>]+class="icon-comment[^>]*></span>\s([^<]+)</div>', webpage, 'repost count', fatal=False))
 
-        thumbnail = base_url + (self._html_search_meta('og:image', webpage, 'thumbnail url')
-                                or self._html_search_regex(r'<video[^>]+poster="([^"]+)"', webpage, 'thumbnail url', fatal=False))
-
-        thumbnail = remove_end(thumbnail, '%3Asmall')  # if parsed with regex, it should contain this
+        thumbnail = self._html_search_meta('og:image', webpage, 'thumbnail url')
+        if not thumbnail:
+            thumbnail = base_url + self._html_search_regex(r'<video[^>]+poster="([^"]+)"', webpage, 'thumbnail url', fatal=False)
+            thumbnail = remove_end(thumbnail, '%3Asmall')
 
         thumbnails = []
         thumbnail_ids = ('thumb', 'small', 'large', 'medium', 'orig')