diff options
Diffstat (limited to 'gallery_dl/extractor/nitter.py')
| -rw-r--r-- | gallery_dl/extractor/nitter.py | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/gallery_dl/extractor/nitter.py b/gallery_dl/extractor/nitter.py index 9b69694..725788a 100644 --- a/gallery_dl/extractor/nitter.py +++ b/gallery_dl/extractor/nitter.py @@ -51,6 +51,11 @@ class NitterExtractor(BaseExtractor): for url in text.extract_iter( attachments, 'href="', '"'): + if "/i/broadcasts/" in url: + self.log.debug( + "Skipping unsupported broadcast '%s'", url) + continue + if "/enc/" in url: name = binascii.a2b_base64(url.rpartition( "/")[2]).decode().rpartition("/")[2] @@ -123,7 +128,7 @@ class NitterExtractor(BaseExtractor): "likes" : text.parse_int(extr( 'class="icon-heart', '</div>').rpartition(">")[2]), "retweet" : 'class="retweet-header' in html, - "quoted": False, + "quoted" : False, } def _tweet_from_quote(self, html): @@ -140,18 +145,24 @@ class NitterExtractor(BaseExtractor): "date" : text.parse_datetime( extr('title="', '"'), "%b %d, %Y ยท %I:%M %p %Z"), "tweet_id": link.rpartition("/")[2].partition("#")[0], - "content": extr('class="quote-text', "</div").partition(">")[2], + "content" : extr('class="quote-text', "</div").partition(">")[2], "_attach" : extr('class="attachments', ''' </div>'''), "retweet" : False, - "quoted": True, + "quoted" : True, } def _user_from_html(self, html): extr = text.extract_from(html, html.index('class="profile-tabs')) banner = extr('class="profile-banner"><a href="', '"') + + try: + uid = banner.split("%2F")[4] + except Exception: + uid = 0 + return { - "id" : banner.split("%2F")[4] if banner else None, + "id" : uid, "profile_banner" : self.root + banner if banner else "", "profile_image" : self.root + extr( 'class="profile-card-avatar" href="', '"'), @@ -229,6 +240,10 @@ BASE_PATTERN = NitterExtractor.update({ "root": "https://nitter.unixfox.eu", "pattern": r"nitter\.unixfox\.eu", }, + "nitter.it": { + "root": "https://nitter.it", + "pattern": r"nitter\.it", + }, }) USER_PATTERN = BASE_PATTERN + r"/(i(?:/user/|d:)(\d+)|[^/?#]+)" @@ -443,6 +458,10 @@ class NitterTweetExtractor(NitterExtractor): "keyword": {"date": "dt:2022-02-13 20:10:00"}, "count": 1, }), + # broadcast + ("https://nitter.it/POTUS/status/1639409307878928384", { + "count": 0, + }) ) def tweets(self): |
