From c24ce07a84ec440fdfd8a050fd6019393a50577b Mon Sep 17 00:00:00 2001 From: bopol Date: Mon, 5 Apr 2021 13:23:33 +0200 Subject: [PATCH] [nitter] Fix thumbnails (#216) Authored by: B0pol --- yt_dlp/extractor/nitter.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/yt_dlp/extractor/nitter.py b/yt_dlp/extractor/nitter.py index 3191543ed..15688b608 100644 --- a/yt_dlp/extractor/nitter.py +++ b/yt_dlp/extractor/nitter.py @@ -131,10 +131,10 @@ def _real_extract(self, url): repost_count = parse_count(self._html_search_regex(r']+class="icon-retweet[^>]*>\s([^<]+)', webpage, 'repost count', fatal=False)) comment_count = parse_count(self._html_search_regex(r']+class="icon-comment[^>]*>\s([^<]+)', webpage, 'repost count', fatal=False)) - thumbnail = base_url + (self._html_search_meta('og:image', webpage, 'thumbnail url') - or self._html_search_regex(r']+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']+poster="([^"]+)"', webpage, 'thumbnail url', fatal=False) + thumbnail = remove_end(thumbnail, '%3Asmall') thumbnails = [] thumbnail_ids = ('thumb', 'small', 'large', 'medium', 'orig')