Skip to main content

No project description provided

Project description

pybalt

Python module & CLI to download media using cobalt processing instance(s)

Get on pypi Last commit Pip module installs total downloads GitHub stars

CLI Preview



Installation

Install using PIP

pip install pybalt

This should create aliases pybalt and cobalt in your shell.

Try running cobalt -h to see the help message.

If for some reason it didn't work, try using it with python:

python -m pybalt



Usage & Examples

Selecting processing instance

You can set processing instance url, api key and user-agent to enviroment variables, pybalt will use them if none was provided.

COBALT_API_URL=YOUR_INSTANCE_URL
COBALT_API_KEY=YOUR_API_KEY
COBALT_USER_AGENT=YOUR_USER_AGENT

By default pybalt uses https://dwnld.nichind.dev as the processing instance. I recommend hosting your own instance or asking someone to give you api key for their instance.


As a CLI

Every command here uses the cobalt alias, you can also use pybalt or python -m pybalt as well.

By default all downloads are saved in a user downloads folder ~/Downloads or the one specified by the --folder flag.

Get list of all available commands by running:

cobalt -h

Download video from URL

cobalt -u 'https://youtube.com/watch?v=8ZP5eqm4JqM'

you can also provide url as positional argument:

cobalt 'https://youtube.com/watch?v=8ZP5eqm4JqM'

Download Youtube playlist

cobalt -pl 'https://youtube.com/playlist?list=PL_93TBqf4ymR9GsuI9W4kQ-G3WM7d2Tqj'

Download from text file

Create a text file with URLs on each line:

https://youtube.com/watch?v=8ZP...
.....
....
...

then run:

cobalt -l 'path/to/file.txt'

More examples

Download all videos from a YouTube playlist in 720p to folder /Music/, filename style classic, use instance https://dwnld.nichind.dev with api key authorization

cobalt -pl 'https://youtube.com/playlist?list=PL_93TBqf4ymR9GsuI9W4kQ-G3WM7d2Tqj' -q 720 -f './Music/' -fs 'classic' -i 'https://dwnld.nichind.dev' -k 'YOUR_API_KEY'


As a module

Download video from URL

from pybalt import Cobalt
from asyncio import run


async def main():
    cobalt = Cobalt()
    path = await cobalt.download('https://youtube.com/watch?v=8ZP5eqm4JqM')
    print('Downloaded: ', path)  # Downloaded: /Users/%USER%/Downloads/8ZP5eqm4JqM.mp4


run(main())

You can pass arguments inside Cobalt object:

from pybalt import Cobalt
from asyncio import run


async def main():
    cobalt = Cobalt(api_instance='YOUR_INSTANCE_URL', api_key='YOUR_API_KEY', headers={...})
    path = await cobalt.download(url='https://youtube.com/watch?v=8ZP5eqm4JqM', quality='1080')
    print('Downloaded: ', path)  # Downloaded: /Users/%USER%/Downloads/8ZP5eqm4JqM.mp4


run(main())



Contributing

If you have any questions or suggestions, please open an issue or create a pull request.

Contributors

Contributors

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

pybalt-2024.11.6.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

pybalt-2024.11.6-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file pybalt-2024.11.6.tar.gz.

File metadata

  • Download URL: pybalt-2024.11.6.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pybalt-2024.11.6.tar.gz
Algorithm Hash digest
SHA256 aa7c4c77aa7684ca27bcc214c9b3174851c586d98d66b9a6dab01d379b1fd873
MD5 bc9db76024d888f089ca8970b4311303
BLAKE2b-256 f268537f3fa4b1dadbad5f88b0a48e141cb30e6f5c9309210f0e097742001020

See more details on using hashes here.

Provenance

The following attestation bundles were made for pybalt-2024.11.6.tar.gz:

Publisher: publish.yml on nichind/pybalt

Attestations:

File details

Details for the file pybalt-2024.11.6-py3-none-any.whl.

File metadata

  • Download URL: pybalt-2024.11.6-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pybalt-2024.11.6-py3-none-any.whl
Algorithm Hash digest
SHA256 032350ee8f0eb3cecb96cce0cca0c468559d6b7a3b543fa08435fdba4ac70dd4
MD5 6e71d36e626fb6e6fa00ba2d97f4c7df
BLAKE2b-256 23d55c81d0e9df7589045b3744a6a915c09bfb31305d5c0c4fcea4482c32b9cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for pybalt-2024.11.6-py3-none-any.whl:

Publisher: publish.yml on nichind/pybalt

Attestations:

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