# pybalt [](https://cobalt.tools) [](https://pypi.org/project/pybalt/) [](https://pypi.org/project/pybalt/) [](https://nichind.dev) [](https://github.com/nichind/pybalt)
<img src="./assets/cli-preview2.gif" align="right" alt="pybalt cli preview gif" height="240">
**pybalt** is a powerful and flexible tool for downloading media files from various platforms, including but not limited to YouTube, X (formerly Twitter), Reddit, Instagram, and TikTok. It works using [cobalt processing instances](https://github.com/imputnet/cobalt) and serves both as a CLI and a Python module.
* Download media files to your desktop effortlessly using pybalt as a **command-line interface**, with support for downloading **playlists** and **links from text files**.
* Integrate pybalt into your Python projects with ease with **just 2 lines of code**.
* **Easily** replace and build custom code extensions to suit your needs.
https://github.com/user-attachments/assets/cf5fd9a9-520b-4970-b8c2-42baa80d7523
# ⚙️ Installation
install pybalt with pip
```sh
pip install pybalt -U
```
or install pybalt on windows with the [bat file](./install.bat) included in the repo (if you dont have python installed)
1. Open powershell or cmd with the administator rights (to allow pip create aliases `cobalt` and `pybalt` in the terminal)
2. Type this command
```sh
powershell -Command "Invoke-WebRequest -Uri https://raw.githubusercontent.com/nichind/pybalt/main/install.bat -OutFile install.bat; .\install.bat"
```
# ⚡️ Quickstart
> [!NOTE]
> pybalt will auto-detect if you are hosting a local cobalt-api instance and will try to use it first instead of instances from [public instance list](https://instances.cobalt.best) and my fallback one.
> [!NOTE]
> if alias `cobalt` isn't working for you in the terminal use `python -m pybalt <command>` instead.
> [!CAUTION]
> Remuxing (`-r`) requires for ffmpeg to be installed on your device and being in system path.
The cli part of this project is very intuitive and easy to-use! Let's see a few examples:
1. Download video from YouTube in maximum resolution possible (`-vQ max`) and then [remux](https://cobalt.tools/remux) it (`-r`).
```sh
cobalt "https://youtube.com/watch?v=DG2QqcHwNdE" -r -vQ max
```
2. Remux video on your device
```sh
cobalt "C://Users/nichind/Videos/video.mp4" -r
```
3. Download videos from the links in the text file
```sh
cobalt "c://Users/nichind/Desktop/very-important.txt"
```
> View all possible arguments using `-h`, pass them accordingly to the [api docs](https://github.com/imputnet/cobalt/blob/main/docs/api.md)
# 💻 Integrate to your project
pybalt originally comes as-a python module, integrating pybalt into your project is just **2 lines of code**:
```python
from pybalt import download
from asyncio import run
async def main():
path = await download("your-video-url", filenameStyle="pretty", remux=True, youtubeHLS=False, videoQuality="1080", status_parent=status)
print(path)
run(main())
```
you can also construct custom `Cobalt` instance.
```python
from pybalt import Cobalt
cobalt = Cobalt(debug=True, proxy="http://...", user_agent="idk :)")
# then use await cobalt.download(url) to download
```
run detached download and monitor progress using `StatusParent`
```python
from pybalt import StatusParent
status = StatusParent() # You can use default python dict instead of StatusParent!
run_detached(await download(url, status_parent=status)) # run detached with your own logic
while not status.completed:
print(f"Still downloading... size: {status.downloaded_size}, time passed: {status.time_passed}")
print(f"download finished: {status.file_path}")
```
disable print info
```python
await download(url, status_callback=None, done_callback=None) # You can replace callbacks with your custom sync/async funcion!
```
# 👥 Used by
pybalt is used by the following projects:
- [download.nichind.dev](https://download.nichind.dev) - Website for downloading media files from various platforms
# 👥 Contributors
[](https://github.com/nichind/pybalt/graphs/contributors)
# 🌟 That's it!
I spent too much time on this project... please consider leaving a :star: if you like it!
[](https://github.com/nichind/pybalt)
Raw data
{
"_id": null,
"home_page": "https://github.com/nichind/pybalt",
"name": "pybalt",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"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/0b/24/79fb434bc9623240144003c378bf6bdeb03a20979b9016b3124415ad228c/pybalt-2025.1.1.tar.gz",
"platform": null,
"description": "\n# pybalt [](https://cobalt.tools) [](https://pypi.org/project/pybalt/) [](https://pypi.org/project/pybalt/) [](https://nichind.dev) [](https://github.com/nichind/pybalt)\n\n<img src=\"./assets/cli-preview2.gif\" align=\"right\" alt=\"pybalt cli preview gif\" height=\"240\">\n\n**pybalt** is a powerful and flexible tool for downloading media files from various platforms, including but not limited to YouTube, X (formerly Twitter), Reddit, Instagram, and TikTok. It works using [cobalt processing instances](https://github.com/imputnet/cobalt) and serves both as a CLI and a Python module.\n\n* Download media files to your desktop effortlessly using pybalt as a **command-line interface**, with support for downloading **playlists** and **links from text files**.\n* Integrate pybalt into your Python projects with ease with **just 2 lines of code**.\n* **Easily** replace and build custom code extensions to suit your needs.\n\nhttps://github.com/user-attachments/assets/cf5fd9a9-520b-4970-b8c2-42baa80d7523\n\n# \u2699\ufe0f Installation\n\ninstall pybalt with pip\n\n```sh\npip install pybalt -U\n```\n\nor install pybalt on windows with the [bat file](./install.bat) included in the repo (if you dont have python installed)\n\n1. Open powershell or cmd with the administator rights (to allow pip create aliases `cobalt` and `pybalt` in the terminal)\n2. Type this command\n\n```sh\npowershell -Command \"Invoke-WebRequest -Uri https://raw.githubusercontent.com/nichind/pybalt/main/install.bat -OutFile install.bat; .\\install.bat\"\n```\n\n# \u26a1\ufe0f Quickstart\n\n> [!NOTE]\n> pybalt will auto-detect if you are hosting a local cobalt-api instance and will try to use it first instead of instances from [public instance list](https://instances.cobalt.best) and my fallback one.\n\n> [!NOTE]\n> if alias `cobalt` isn't working for you in the terminal use `python -m pybalt <command>` instead.\n\n> [!CAUTION]\n> Remuxing (`-r`) requires for ffmpeg to be installed on your device and being in system path.\n\nThe cli part of this project is very intuitive and easy to-use! Let's see a few examples:\n \n1. Download video from YouTube in maximum resolution possible (`-vQ max`) and then [remux](https://cobalt.tools/remux) it (`-r`). \n```sh\ncobalt \"https://youtube.com/watch?v=DG2QqcHwNdE\" -r -vQ max\n```\n2. Remux video on your device\n```sh\ncobalt \"C://Users/nichind/Videos/video.mp4\" -r\n```\n3. Download videos from the links in the text file\n```sh\ncobalt \"c://Users/nichind/Desktop/very-important.txt\"\n```\n> View all possible arguments using `-h`, pass them accordingly to the [api docs](https://github.com/imputnet/cobalt/blob/main/docs/api.md)\n\n# \ud83d\udcbb Integrate to your project\n\npybalt originally comes as-a python module, integrating pybalt into your project is just **2 lines of code**:\n\n```python\nfrom pybalt import download\nfrom asyncio import run\n\nasync def main():\n path = await download(\"your-video-url\", filenameStyle=\"pretty\", remux=True, youtubeHLS=False, videoQuality=\"1080\", status_parent=status) \n print(path)\n\nrun(main())\n```\n\nyou can also construct custom `Cobalt` instance.\n\n```python\nfrom pybalt import Cobalt\n\ncobalt = Cobalt(debug=True, proxy=\"http://...\", user_agent=\"idk :)\")\n# then use await cobalt.download(url) to download\n```\n\nrun detached download and monitor progress using `StatusParent`\n\n```python\nfrom pybalt import StatusParent\n\nstatus = StatusParent() # You can use default python dict instead of StatusParent!\nrun_detached(await download(url, status_parent=status)) # run detached with your own logic\nwhile not status.completed:\n print(f\"Still downloading... size: {status.downloaded_size}, time passed: {status.time_passed}\")\nprint(f\"download finished: {status.file_path}\")\n```\n\ndisable print info\n\n```python\nawait download(url, status_callback=None, done_callback=None) # You can replace callbacks with your custom sync/async funcion!\n```\n\n# \ud83d\udc65 Used by\n\npybalt is used by the following projects:\n\n- [download.nichind.dev](https://download.nichind.dev) - Website for downloading media files from various platforms\n\n# \ud83d\udc65 Contributors\n\n[](https://github.com/nichind/pybalt/graphs/contributors)\n\n# \ud83c\udf1f That's it!\n\nI spent too much time on this project... please consider leaving a :star: if you like it!\n\n[](https://github.com/nichind/pybalt)\n",
"bugtrack_url": null,
"license": null,
"summary": "Download video from YouTube, Twitter (X), Instagram, Reddit, Twitch, Bilibili & more. CLI & python module for @imputnet's cobalt processing instance api.",
"version": "2025.1.1",
"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": "05f7cfe5d11b3c1722a31b7194383a89f8ebf3d62815441b57b32ea6c3ff1282",
"md5": "5b44eede06461095471f6cf1f4bc8992",
"sha256": "31a140abdfc956fca260d7f7ff09ec5088dbe6bae9a785105713a897a0b556f8"
},
"downloads": -1,
"filename": "pybalt-2025.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5b44eede06461095471f6cf1f4bc8992",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 23688,
"upload_time": "2025-01-17T23:27:30",
"upload_time_iso_8601": "2025-01-17T23:27:30.907893Z",
"url": "https://files.pythonhosted.org/packages/05/f7/cfe5d11b3c1722a31b7194383a89f8ebf3d62815441b57b32ea6c3ff1282/pybalt-2025.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0b2479fb434bc9623240144003c378bf6bdeb03a20979b9016b3124415ad228c",
"md5": "42b5aa884cb2fe17195b2704ccc49c83",
"sha256": "c6e72cd5ae52605a62299ef7447a5a622f4fc9b824e0a74dc82833beb8addb16"
},
"downloads": -1,
"filename": "pybalt-2025.1.1.tar.gz",
"has_sig": false,
"md5_digest": "42b5aa884cb2fe17195b2704ccc49c83",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 25122,
"upload_time": "2025-01-17T23:27:33",
"upload_time_iso_8601": "2025-01-17T23:27:33.651323Z",
"url": "https://files.pythonhosted.org/packages/0b/24/79fb434bc9623240144003c378bf6bdeb03a20979b9016b3124415ad228c/pybalt-2025.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-17 23:27:33",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "nichind",
"github_project": "pybalt",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "aiohttp",
"specs": []
},
{
"name": "aiofiles",
"specs": []
},
{
"name": "requests",
"specs": []
},
{
"name": "python-dotenv",
"specs": []
},
{
"name": "pytube",
"specs": []
},
{
"name": "rich",
"specs": []
}
],
"lcname": "pybalt"
}