Skip to main content

Debrid Manager Python package

Project description

Yuumi

Yuumi is a Python package that allows you to use multiple debrid services in your Python projects.

Installation

poetry add Yuumi

or

pip install Yuumi

Usage

from Yuumi.debrid import RealDebridAPI

api = RealDebridAPI("your_access_token")

# Get user info
user_info = await api.get_user_info()
print(user_info)

# Check instant availability
instant_availability = await api.get_instant_availability("2f5a5ccb7dc32b7f7d7b150dd6efbce87d2fc371")
print(instant_availability)

# Download a file
download = await api.add_magnet("magnet:?xt=urn:btih:2f5a5ccb7dc32b7f7d7b150dd6efbce87d2fc371")
print(download)

Download Example

import asyncio
from yuumi.debrid import RealDebridAPI

async def main():
    api = RealDebridAPI("your_access_token")

    # Example: Downloading a cached torrent
    torrent_hash = "your_torrent_hash"
    availability = await api.get_instant_availability(torrent_hash)
    if availability:
        magnet_link = "your_magnet_link"
        torrent_info = await api.add_magnet(magnet_link)
        torrent_id = torrent_info["id"]
        await api.select_torrent_files(torrent_id, "all")
        print("Files selected and ready for download.")
    else:
        print("Torrent is not cached.")

    # Example: Downloading a non-cached torrent
    magnet_link = "your_magnet_link"
    torrent_info = await api.add_magnet(magnet_link)
    torrent_id = torrent_info["id"]
    print("Torrent added. Waiting for it to be cached...")

    # Timeout mechanism: Give up after 5 minutes (300 seconds)
    timeout = 300
    start_time = asyncio.get_event_loop().time()

    while True:
        torrent_status = await api.get_torrent_info(torrent_id)
        if torrent_status["status"] == "downloaded":
            await api.select_torrent_files(torrent_id, "all")
            print("Files selected and ready for download.")
            break
        if asyncio.get_event_loop().time() - start_time > timeout:
            print("Timeout reached. Torrent is not cached. Giving up.")
            break
        await asyncio.sleep(30)  # Wait for 30 seconds before checking again

# Run the main function
asyncio.run(main())

CLI Usage

yuumi --token YOUR_ACCESS_TOKEN --user

More information can be found here:

yuumi --help

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

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

yuumi-0.3.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

yuumi-0.3.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file yuumi-0.3.0.tar.gz.

File metadata

  • Download URL: yuumi-0.3.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.2 Linux/5.15.153.1-microsoft-standard-WSL2

File hashes

Hashes for yuumi-0.3.0.tar.gz
Algorithm Hash digest
SHA256 462d5045271a837b24eb53224d7b3e6648e1ce38c54ac757cd0661fee6f1e094
MD5 af72b669476b368e8fa189c23ca44eb7
BLAKE2b-256 4c14a90fb335033c7a2b39c3d8dbda237bdc38cb3b47767e831137b52a82c178

See more details on using hashes here.

File details

Details for the file yuumi-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: yuumi-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.11.2 Linux/5.15.153.1-microsoft-standard-WSL2

File hashes

Hashes for yuumi-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 34d918a6f3f3352794042d88795cf8cb3113a0563a2b9ff4195b509e3a494d21
MD5 9a062cd7e36a97d50b8d8828ad5301bb
BLAKE2b-256 22959e936f4ea2bf6a2dbbc4e7e8ba2ef95b7aa1e4ef164e302563755235cf95

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page