<div align="center" style="display: flex; flex-flow: column wrap;">
<img src='./assets/logo.png' style='border-radius: 8px; width: 124px'></img>
<h3>pybalt</h3>
<h5>CLI tool and python module for downloading media through Cobalt processing instances.</h5>
[![Get on PyPI](https://img.shields.io/pypi/v/pybalt.svg)](https://pypi.org/project/pybalt/)
[![Last commit](https://img.shields.io/github/last-commit/nichind/pybalt.svg)](https://github.com/nichind/pybalt)
[![Pip module installs total downloads](https://img.shields.io/pypi/dm/pybalt.svg)](https://pypi.org/project/pybalt/)
[![GitHub stars](https://img.shields.io/github/stars/nichind/pybalt.svg)](https://github.com/nichind/pybalt)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
<div align="center" style="display: flex; flex-flow: column wrap;">
<h3>CLI Preview</h3>
https://github.com/user-attachments/assets/cf5fd9a9-520b-4970-b8c2-42baa80d7523
</div>
</div>
<br><br>
<h1>Installation</h1>
<h4>Install pybalt using PowerShell on Windows</h4>
Downloads [install.bat](./install.bat) and executes it.
Powershell should be run as administrator, otherwise aliases (`cobalt`, `pybalt`) in terminal will not work.
```powershell
powershell -Command "Invoke-WebRequest -Uri https://raw.githubusercontent.com/nichind/pybalt/main/install.bat -OutFile install.bat; .\install.bat"
```
<h4>Install using PIP</h4>
```shell
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 directly from python package:
```shell
python -m pybalt
```
<br><br>
<h1>Usage & Examples</h1>
<img src='./assets/cli-preview.gif' style='border-radius: 8px'></img>
<h3>Selecting processing instance</h3>
You can set **processing instance URL**, **API key**, and **user-agent** as environment variables; pybalt will use them if none are provided.
```
COBALT_API_URL=YOUR_INSTANCE_URL
COBALT_API_KEY=YOUR_API_KEY
COBALT_USER_AGENT=YOUR_USER_AGENT
```
> By default, pybalt attempts to use any available instance for you provided by [public list of instances](https://instances.cobalt.best). It is recommended to host your own instance or request an `API key` from someone else's instance.
<br>
<h2>As a CLI</h2>
<details open>
<summary></summary>
Every command here uses the `cobalt` alias; you can also use `pybalt` or `python -m pybalt`.
By default, all downloads are saved in the user's downloads folder `~/Downloads`, or the one specified by the `-f` (`-folder`) flag.
Get a list of all available commands by running:
```shell
cobalt -h
```
<br>
<h3>Download video from URL</h3>
```shell
cobalt -u 'https://youtube.com/watch?v=8ZP5eqm4JqM'
```
You can also provide the URL as a positional argument:
```shell
cobalt 'https://youtube.com/watch?v=8ZP5eqm4JqM'
```
<br>
<h3>Download YouTube playlist</h3>
```shell
cobalt -pl 'https://youtube.com/playlist?list=PL_93TBqf4ymR9GsuI9W4kQ-G3WM7d2Tqj'
```
<br>
<h3>Download from text file</h3>
Create a text file with URLs on each line:
```txt
https://youtube.com/watch?v=8ZP...
.....
....
...
```
Then run:
```shell
cobalt -l 'path/to/file.txt'
```
<br>
<h3>More examples</h3>
Download all videos from a YouTube playlist in `720p` to folder `/Music/`, with filename style `classic`, using instance `https://dwnld.nichind.dev` and `API key` authorization:
```shell
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'
```
</details>
<br><br>
<h2>As a module</h2>
<details open>
<summary></summary>
<h3>Download video from URL</h3>
```python
from pybalt import download
from asyncio import run
async def main():
path = await download('https://youtube.com/watch?v=8ZP5eqm4JqM')
print('Downloaded: ', path) # Downloaded: /Users/%USER%/Downloads/8ZP5eqm4JqM.mp4
run(main())
```
You can pass arguments inside the Cobalt object:
```python
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())
```
</details>
<br><br>
<h1>Contributing</h1>
If you have any questions or suggestions, please [open an issue](https://github.com/nichind/pybalt/issues) or [create a pull request](https://github.com/nichind/pybalt/pulls).
<h3>Contributors</h3>
<img src="https://contrib.rocks/image?repo=nichind/pybalt" alt="Contributors" style="max-width: 100%;"/>
Raw data
{
"_id": null,
"home_page": "https://github.com/nichind/pybalt",
"name": "pybalt",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "downloader, cobalt, cobalt-cli, youtube, twitter, x, instagram, reddit, twitch, bilibili, download, youtube-downloader, twitter-downloader, x-downloader, instagram-downloader, reddit-downloader, twitch-downloader, bilibili-downloader",
"author": "nichind",
"author_email": "nichinddev@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/40/ee/8acafd9ee81c37fca60217e4e01f0e7f1a8f9523a7ab91005bd1b1ef719b/pybalt-2024.12.8.tar.gz",
"platform": null,
"description": "<div align=\"center\" style=\"display: flex; flex-flow: column wrap;\">\n <img src='./assets/logo.png' style='border-radius: 8px; width: 124px'></img>\n <h3>pybalt</h3>\n <h5>CLI tool and python module for downloading media through Cobalt processing instances.</h5>\n \n [![Get on PyPI](https://img.shields.io/pypi/v/pybalt.svg)](https://pypi.org/project/pybalt/)\n [![Last commit](https://img.shields.io/github/last-commit/nichind/pybalt.svg)](https://github.com/nichind/pybalt)\n [![Pip module installs total downloads](https://img.shields.io/pypi/dm/pybalt.svg)](https://pypi.org/project/pybalt/)\n [![GitHub stars](https://img.shields.io/github/stars/nichind/pybalt.svg)](https://github.com/nichind/pybalt)\n [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n\n <div align=\"center\" style=\"display: flex; flex-flow: column wrap;\">\n <h3>CLI Preview</h3>\n\n https://github.com/user-attachments/assets/cf5fd9a9-520b-4970-b8c2-42baa80d7523\n </div>\n \n</div>\n<br><br>\n<h1>Installation</h1>\n<h4>Install pybalt using PowerShell on Windows</h4>\n\nDownloads [install.bat](./install.bat) and executes it.\n\nPowershell should be run as administrator, otherwise aliases (`cobalt`, `pybalt`) in terminal will not work.\n\n```powershell\npowershell -Command \"Invoke-WebRequest -Uri https://raw.githubusercontent.com/nichind/pybalt/main/install.bat -OutFile install.bat; .\\install.bat\"\n```\n\n<h4>Install using PIP</h4>\n\n```shell\npip install pybalt\n``` \n\nThis should create aliases `pybalt` and `cobalt` in your shell.\n\nTry running `cobalt -h` to see the help message.\n\nIf for some reason it didn't work, try using it directly from python package:\n\n```shell\npython -m pybalt\n```\n<br><br>\n<h1>Usage & Examples</h1>\n\n<img src='./assets/cli-preview.gif' style='border-radius: 8px'></img>\n\n<h3>Selecting processing instance</h3>\n\nYou can set **processing instance URL**, **API key**, and **user-agent** as environment variables; pybalt will use them if none are provided.\n\n```\nCOBALT_API_URL=YOUR_INSTANCE_URL\nCOBALT_API_KEY=YOUR_API_KEY\nCOBALT_USER_AGENT=YOUR_USER_AGENT\n```\n\n> By default, pybalt attempts to use any available instance for you provided by [public list of instances](https://instances.cobalt.best). It is recommended to host your own instance or request an `API key` from someone else's instance.\n\n<br>\n<h2>As a CLI</h2>\n<details open>\n<summary></summary>\n\nEvery command here uses the `cobalt` alias; you can also use `pybalt` or `python -m pybalt`.\n\nBy default, all downloads are saved in the user's downloads folder `~/Downloads`, or the one specified by the `-f` (`-folder`) flag.\n\nGet a list of all available commands by running:\n\n```shell\ncobalt -h\n```\n\n<br>\n<h3>Download video from URL</h3>\n\n```shell\ncobalt -u 'https://youtube.com/watch?v=8ZP5eqm4JqM'\n```\n\nYou can also provide the URL as a positional argument:\n\n```shell\ncobalt 'https://youtube.com/watch?v=8ZP5eqm4JqM'\n```\n\n<br>\n<h3>Download YouTube playlist</h3>\n\n```shell\ncobalt -pl 'https://youtube.com/playlist?list=PL_93TBqf4ymR9GsuI9W4kQ-G3WM7d2Tqj'\n```\n\n<br>\n<h3>Download from text file</h3>\n\nCreate a text file with URLs on each line:\n\n```txt\nhttps://youtube.com/watch?v=8ZP...\n.....\n....\n...\n```\n\nThen run:\n\n```shell\ncobalt -l 'path/to/file.txt'\n```\n\n<br>\n<h3>More examples</h3>\n\nDownload all videos from a YouTube playlist in `720p` to folder `/Music/`, with filename style `classic`, using instance `https://dwnld.nichind.dev` and `API key` authorization:\n\n```shell\ncobalt -pl 'https://youtube.com/playlist?list=PL_93TBqf4ymR9GsuI9W4kQ-G3WM7d2Tqj' -q 720 -f './Music/' -fs 'classic' -i 'https://dwnld.nichind.dev' -k 'YOUR_API_KEY'\n```\n\n</details>\n<br><br>\n<h2>As a module</h2>\n<details open>\n<summary></summary>\n\n<h3>Download video from URL</h3>\n\n```python\nfrom pybalt import download\nfrom asyncio import run\n\nasync def main():\n path = await download('https://youtube.com/watch?v=8ZP5eqm4JqM')\n print('Downloaded: ', path) # Downloaded: /Users/%USER%/Downloads/8ZP5eqm4JqM.mp4\n\nrun(main())\n```\n\nYou can pass arguments inside the Cobalt object:\n\n```python\nfrom pybalt import Cobalt\nfrom asyncio import run\n\nasync def main():\n cobalt = Cobalt(api_instance='YOUR_INSTANCE_URL', api_key='YOUR_API_KEY', headers={...})\n path = await cobalt.download(url='https://youtube.com/watch?v=8ZP5eqm4JqM', quality='1080')\n print('Downloaded: ', path) # Downloaded: /Users/%USER%/Downloads/8ZP5eqm4JqM.mp4\n\nrun(main())\n``` \n\n</details>\n\n<br><br>\n<h1>Contributing</h1>\n\nIf you have any questions or suggestions, please [open an issue](https://github.com/nichind/pybalt/issues) or [create a pull request](https://github.com/nichind/pybalt/pulls).\n\n<h3>Contributors</h3>\n\n<img src=\"https://contrib.rocks/image?repo=nichind/pybalt\" alt=\"Contributors\" style=\"max-width: 100%;\"/>\n\n",
"bugtrack_url": null,
"license": null,
"summary": "Download mediafiles from YouTube, Twitter (X), Instagram, Reddit & more. CLI & python module for @imputnet's cobalt processing instance api.",
"version": "2024.12.8",
"project_urls": {
"Homepage": "https://github.com/nichind/pybalt"
},
"split_keywords": [
"downloader",
" cobalt",
" cobalt-cli",
" youtube",
" twitter",
" x",
" instagram",
" reddit",
" twitch",
" bilibili",
" download",
" youtube-downloader",
" twitter-downloader",
" x-downloader",
" instagram-downloader",
" reddit-downloader",
" twitch-downloader",
" bilibili-downloader"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "905fc4811cee49606e01698261beda44a571deb267dc10ddd4cc76d87591de38",
"md5": "4fd03875d63249665354a118bac1a1ea",
"sha256": "2909f3eaeafa09df52640603c4497dd57e8cd58b75ce80bcb928d0889652df68"
},
"downloads": -1,
"filename": "pybalt-2024.12.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4fd03875d63249665354a118bac1a1ea",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 14238,
"upload_time": "2024-12-17T13:25:47",
"upload_time_iso_8601": "2024-12-17T13:25:47.676134Z",
"url": "https://files.pythonhosted.org/packages/90/5f/c4811cee49606e01698261beda44a571deb267dc10ddd4cc76d87591de38/pybalt-2024.12.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "40ee8acafd9ee81c37fca60217e4e01f0e7f1a8f9523a7ab91005bd1b1ef719b",
"md5": "444e911047bd83331da8a3a1f51be777",
"sha256": "40e8167477b3494b56e651c45282262ef865399369b7c58e6e1612a0291e1f8d"
},
"downloads": -1,
"filename": "pybalt-2024.12.8.tar.gz",
"has_sig": false,
"md5_digest": "444e911047bd83331da8a3a1f51be777",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 14800,
"upload_time": "2024-12-17T13:25:49",
"upload_time_iso_8601": "2024-12-17T13:25:49.433009Z",
"url": "https://files.pythonhosted.org/packages/40/ee/8acafd9ee81c37fca60217e4e01f0e7f1a8f9523a7ab91005bd1b1ef719b/pybalt-2024.12.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-17 13:25:49",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "nichind",
"github_project": "pybalt",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pybalt"
}