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.
Usage
Single item
from gallery_dl_bytes import download
url = "https://www.reddit.com/r/me_irl/comments/1f4qc59/me_irl/"
files = download(url) # returns a list of File objects
post = files[0] # this post only has one image
print(f"{post.name}") # 1f4qc59 me_irl.jpeg
print(post.headers.get("Content-Type")) # image/jpeg
print(post.metadata.get("author")) # DevianceSX
Gallery
from gallery_dl_bytes import download
url = "https://imgur.com/gallery/dog-3s8hj1j"
files = download(url)
for file in files:
print(f"{file.name}")
print(file.headers.get("Last-Modified"))
print(file.metadata.get("created_at"))
print()
# None_3s8hj1j_001_QQzDgCw.jpg
# Tue, 29 Dec 2020 19:32:52 GMT
# 2020-12-29T19:32:50Z
# None_3s8hj1j_002_StcxXhO.jpg
# Tue, 29 Dec 2020 19:32:55 GMT
# 2020-12-29T19:32:54Z
# None_3s8hj1j_003_sbzwzqH.jpg
# Tue, 29 Dec 2020 19:32:58 GMT
# 2020-12-29T19:32:57Z
Access media
from pathlib import Path
from gallery_dl_bytes import download
file = download("https://unsplash.com/photos/qQ6s9iqLVow")[0]
Path(file.name).write_bytes(file.data)
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
gallery_dl_bytes-0.1.0.tar.gz
(37.1 kB
view details)
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-0.1.0.tar.gz.
File metadata
- Download URL: gallery_dl_bytes-0.1.0.tar.gz
- Upload date:
- Size: 37.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.5.29
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7352e50fb21e30285427a7d0aea11dda01fc623fbc324be18d4dd5ded838d5bc
|
|
| MD5 |
9563ddd020743db899af11341d2119f7
|
|
| BLAKE2b-256 |
22ef1a28e23b18cc271c145c13d0a19328085e00aacf11002082cf142577333a
|
File details
Details for the file gallery_dl_bytes-0.1.0-py3-none-any.whl.
File metadata
- Download URL: gallery_dl_bytes-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.5.29
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3bc9e167716c8714c80d7671a42f9c89741f2ba36693deb79339de5243cf3aa9
|
|
| MD5 |
8cb3bb48fac3d604bfc2b330e1b465ea
|
|
| BLAKE2b-256 |
3df0019632c7a0040d4746f617d3f8fee15a77294bd18c79f18d577c047e4c2e
|