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.2.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

yuumi-0.3.2-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: yuumi-0.3.2.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.2.tar.gz
Algorithm Hash digest
SHA256 e9a94996d46190f7670ac206f464b30f41ca3d34d198305371a4d538e668328d
MD5 029173995be80f9391bc796f03b11362
BLAKE2b-256 deeff065db719f2f5cc49890754b8a03a6d51e311fd0a6a37063fe0482849921

See more details on using hashes here.

File details

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

File metadata

  • Download URL: yuumi-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 6.7 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7c0aef15e8c65445295b06d16b1ab13613ddcd563ca6bfc0e0147fca755098e7
MD5 d513e568212cf7e5436188374399a432
BLAKE2b-256 2e64eb604a302443ef2ff71c6381202f98e52f36f90121b5b8fe8a554ad6df0d

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