include 'zstd' in Accept-Encoding header when supported

… and slightly update optional dependency list
pull/5870/head
Mike Fährmann 2 months ago
parent 8aca0e6970
commit eb3ef13d28
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -25,10 +25,12 @@ Dependencies
Optional
--------
- yt-dlp_ or youtube-dl_: HLS/DASH video downloads, ``ytdl`` integration
- FFmpeg_: Pixiv Ugoira conversion
- yt-dlp_ or youtube-dl_: Video downloads
- mkvmerge_: Accurate Ugoira frame timecodes
- PySocks_: SOCKS proxy support
- brotli_ or brotlicffi_: Brotli compression support
- zstandard_: Zstandard compression support
- PyYAML_: YAML configuration file support
- toml_: TOML configuration file support for Python<3.11
- SecretStorage_: GNOME keyring passwords for ``--cookies-from-browser``
@ -417,11 +419,13 @@ To authenticate with a ``mastodon`` instance, run *gallery-dl* with
.. _pip: https://pip.pypa.io/en/stable/
.. _Requests: https://requests.readthedocs.io/en/master/
.. _FFmpeg: https://www.ffmpeg.org/
.. _mkvmerge: https://www.matroska.org/downloads/mkvtoolnix.html
.. _yt-dlp: https://github.com/yt-dlp/yt-dlp
.. _youtube-dl: https://ytdl-org.github.io/youtube-dl/
.. _PySocks: https://pypi.org/project/PySocks/
.. _brotli: https://github.com/google/brotli
.. _brotlicffi: https://github.com/python-hyper/brotlicffi
.. _zstandard: https://github.com/indygreg/python-zstandard
.. _PyYAML: https://pyyaml.org/
.. _toml: https://pypi.org/project/toml/
.. _SecretStorage: https://pypi.org/project/SecretStorage/

@ -390,6 +390,8 @@ class Extractor():
headers["Accept-Encoding"] = "gzip, deflate, br"
else:
headers["Accept-Encoding"] = "gzip, deflate"
if ZSTD:
headers["Accept-Encoding"] += ", zstd"
referer = self.config("referer", self.referer)
if referer:
@ -990,6 +992,12 @@ try:
except AttributeError:
BROTLI = False
# detect zstandard support
try:
ZSTD = urllib3.response.HAS_ZSTD
except AttributeError:
ZSTD = False
# set (urllib3) warnings filter
action = config.get((), "warnings", "default")
if action:

Loading…
Cancel
Save