Skip to main content

gallery-dl-bytes

UV Badge Python Version Badge PyPI Downloads Badge License Badge

Build Status Badge Maintenance Status Badge Free Palestine Badge

Programmatically run gallery-dl extractors to download content from the web directly to a bytes object in memory. With an easy, fully typed API.

Source | PyPI

Installation

With uv (recommended)

uv add gallery-dl-bytes

With pip

pip install gallery-dl-bytes

Usage

Single item

from gallery_dl_bytes import DownloadJob

url = "https://www.reddit.com/r/me_irl/comments/1f4qc59/me_irl/"

job = DownloadJob(url)
job.run()
post = job.files[0]

print(f"{post.name}")
print(post.headers.get("Content-Type"))
print(post.metadata.get("author"))

Gallery

job = DownloadJob("https://imgur.com/gallery/dog-3s8hj1j")
job.run()

for file in job.files:
    print(f"{file.name}")
    print(file.headers.get("Last-Modified"))
    print(file.metadata.get("created_at"))
    print()

Access media

from pathlib import Path

job = DownloadJob("https://www.pexels.com/photo/man-riding-white-surfboard-1005456/")
job.run()

file = job.files[0]
Path(file.name).write_bytes(file.data)

Access posts without media

job = DownloadJob("https://bsky.app/profile/dril.bsky.social/post/3lia54f7fg22x")
job.run()

print(job.metadata.get("text"))

Set gallery-dl configuration

[!WARNING]
Note that not all configuration is supported. Options may be silently ignored. This feature is not yet complete.

from gallery_dl_bytes import set_config

set_config(("extractor",), "browser", "firefox")

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gallery_dl_bytes-2.5.0.tar.gz (37.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gallery_dl_bytes-2.5.0-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

Release history Release notifications | RSS feed

This release

2.5.0 This release

2 files

2.4.0

2 files

2.3.0

2 files

2.2.1

2 files

2.2.0

2 files

2.0.1

2 files

0.2.0

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page