[nitter] use 'gallery-dl/<version>' User-Agent (#7045 #8130 #8409)

This commit is contained in:
Mike Fährmann
2026-01-21 18:07:47 +01:00
parent 78da7edde8
commit 63df6423bf
3 changed files with 15 additions and 9 deletions

View File

@@ -514,6 +514,7 @@ Default
``hdoujin`` |
``itaku`` |
``newgrounds`` |
``[nitter]`` |
``[philomena]`` |
``pixiv-novel`` |
``plurk`` |
@@ -802,6 +803,7 @@ Default
``"gallery-dl/VERSION"``
* ``[Danbooru]``
* ``mangadex``
* ``[nitter]``
* ``weasyl``
* ``[wikimedia]``
* ``zerochan``
@@ -4487,8 +4489,8 @@ Note
It is possible to use ``"all"`` instead of listing all values separately.
extractor.nitter.quoted
-----------------------
extractor.[nitter].quoted
-------------------------
Type
``bool``
Default
@@ -4497,8 +4499,8 @@ Description
Fetch media from quoted Tweets.
extractor.nitter.retweets
-------------------------
extractor.[nitter].retweets
---------------------------
Type
``bool``
Default
@@ -4507,8 +4509,8 @@ Description
Fetch media from Retweets.
extractor.nitter.videos
-----------------------
extractor.[nitter].videos
-------------------------
Type
* ``bool``
* ``string``

View File

@@ -1139,6 +1139,8 @@
"nitter":
{
"sleep-request": "0.5-1.5",
"quoted" : false,
"retweets": false,
"videos" : true

View File

@@ -9,16 +9,18 @@
"""Extractors for Nitter instances"""
from .common import BaseExtractor, Message
from .. import text
from .. import text, util
import binascii
class NitterExtractor(BaseExtractor):
"""Base class for nitter extractors"""
basecategory = "nitter"
directory_fmt = ("{category}", "{user[name]}")
directory_fmt = ("nitter", "{user[name]}")
filename_fmt = "{tweet_id}_{num}.{extension}"
archive_fmt = "{tweet_id}_{num}"
useragent = util.USERAGENT_GALLERYDL
request_interval = (0.5, 1.5)
def __init__(self, match):
self.cookies_domain = self.root.partition("://")[2]
@@ -271,7 +273,7 @@ class NitterSearchExtractor(NitterExtractor):
class NitterTweetExtractor(NitterExtractor):
"""Extractor for nitter tweets"""
subcategory = "tweet"
directory_fmt = ("{category}", "{user[name]}")
directory_fmt = ("nitter", "{user[name]}")
filename_fmt = "{tweet_id}_{num}.{extension}"
archive_fmt = "{tweet_id}_{num}"
pattern = BASE_PATTERN + r"/(i/web|[^/?#]+)/status/(\d+())"