API to download files directly to memory with gallery-dl
Project description
gallery-dl-bytes
Programmatically run gallery-dl extractors to download content from the web directly to a bytes object in memory. With an easy, fully typed API.
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")
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gallery_dl_bytes-2.2.1.tar.gz.
File metadata
- Download URL: gallery_dl_bytes-2.2.1.tar.gz
- Upload date:
- Size: 37.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.5.29
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
156eb724c4ea387239b5c89738dfbdb3e2bc5d68d3b3b1cd5e0b7a506173dea8
|
|
| MD5 |
8b0ac7b2920178b9792a2939d90d1580
|
|
| BLAKE2b-256 |
adff312f8403b1388fbb5f3fc0b327f6e05fdf2081b628e33861d1ecfb24adde
|
File details
Details for the file gallery_dl_bytes-2.2.1-py3-none-any.whl.
File metadata
- Download URL: gallery_dl_bytes-2.2.1-py3-none-any.whl
- Upload date:
- Size: 17.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.5.29
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
264bc0e5c3108fbd2181b8b07e722c5dc88fd79923a433822843e8aa8eb9a616
|
|
| MD5 |
a4b141025b8d6338c90caf4efe4dad5a
|
|
| BLAKE2b-256 |
4e59a7aeb49604f082916626ac2bd354bd4af0a06982cec94dcc217a9910d467
|