Skip to content

khyerdev/tcobalt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Packaging status GitHub Downloads GitHub Release GitHub License GitHub Actions Workflow Status Evil Purged

tcobalt Command Line Utility

tcobalt (or tcb) is a command-line tool for downloading your favorite videos and audios from the internet. This tool uses the api of wukko's cobalt.tools, which is an amazing website to save what you love without ads, trackers, or anything creepy. Stop using random websites to download videos, just use cobalt.tools, or the unofficial command-line version, tcobalt.

Features

  • tcobalt allows you to download videos and audios just as easily as you can with cobalt.tools with tcb get
  • tcobalt also allows you to download multiple videos/audios at once with tcb bulk get and tcb bulk execute
  • tcobalt allows some integration with other commands, by allowing a url to be piped into tcb get +
  • tcobalt includes all the settings that web cobalt has, along with a few extra features that will get extended in the future
  • tcobalt gives methods to check cobalt's version and to list the supported services right from your terminal
  • tcobalt has support for using a different cobalt api instance than the main one
  • You can change the default tcobalt flags in a configuration file
  • tcobalt's help method is easy to understand, and gives the option to list usage examples
  • tcobalt supports single letter methods for lazy people tcb g, tcb b e

Examples

Basic downloading of a video

tcb get 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' -o rickroll.mp4

Downloading of a song with '.ogg' format and using the default filename

tcb get -af ogg 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'

Shuffling a list of youtube links and downloading the first one as a .webm file

cat links.txt | shuf | head -n 1 | tcb get -c vp9 +

Downloading the same video twice, but with one being audio-only:

tcb bulk execute links.txt
https://www.youtube.com/watch?v=dQw4w9WgXcQ -o roll.mp4
https://www.youtube.com/watch?v=dQw4w9WgXcQ -ao silly-song.mp3

Downloading three coding videos at once with 720p resolution each

tcb bulk get -q 720 'https://www.youtube.com/watch?v=qclZUQYZTzg' 'https://www.youtube.com/watch?v=wvQCIMjlxHw' 'https://www.youtube.com/watch?v=3T3ZDquDDVg'

Full usage help is available with tcb help, but can also be seen in the usage.txt and info.txt files

tcobalt also supports tcb --help, tcb -h, tcb --version, and tcb -v for people who have not read the help or this page

Support

x86_64 is the only architecture officially supported. It is hard for me to cross-compile to other architectures or run other architectures. If you are on a different arch, you can compile tcobalt yourself. You can contribute prebuilt binaries too if you feel like it.

OS/Packager Support Progress Packaging status

  1. Arch Linux (AUR) (COMPLETE)
  2. Windows 10/11 (Prebuilt binary)
  3. Fedora
  4. Ubuntu (Prebuilt PKG)

The repos that contain tcobalt can be seen on the right, along with the highest version the repo has.

Installation

Prebuilt Binary Downloads

Arch Linux (pkg) Ubuntu (pkg) Linux Windows
v1.2.0-1 x86_64 v1.0.2 amd64 v1.2.0 x86_64 v1.2.0 x86_64

Arch Linux

  1. Install yay or paru:
    sudo pacman -S base-devel
    git clone https://aur.archlinux.org/yay.git # or paru.git
    cd yay # or paru
    makepkg -si
  2. Use either yay or paru to install tcobalt:
    yay -S tcobalt
    
    paru -S tcobalt
    

OR

Get it directly from the AUR without installing an AUR helper:

sudo pacman -S base-devel
git clone https://aur.archlinux.org/tcobalt.git
cd tcobalt
makepkg -si

OR

  1. Download the pkg from the above prebuilt binaries (or use cURL)
  2. Open a terminal and navigate to the directory containing the donwloaded .pkg.tar.zst file
  3. Run the following command (replacing the fields in the angle brackets as necessary)
    sudo pacman -U tcobalt-<version>-<rel>-<arch>.pkg.tar.zst
    

The PKGBUILD declares that this only supports x86_64, but since it builds from source, yay/paru will allow you to install tcobalt on any architecture

This process will also work on arch-based distros

Ubuntu

Packaging to a PPA has literally no good documentation online, and the official Ubuntu website for it has LITERALLY NO TEXT ON IT (its undergoing maintenance). Debian docs and launchpad docks also suck. You are stuck with this process until I feel like requesting tcobalt to be added to the official Ubuntu repositories. I won't bother with debian because they release stable updates every 2 years.

  1. Download the pkg from the above prebuilt binaries (or use cURL)
  2. Open a terminal and navigate to the directory containing the downloaded .deb file
  3. Run the following command (replacing the fields in the angle brackets as necessary)
    sudo dpkg -i tcobalt-<version>-<arch>.deb
    

Windows 10/11

Download the .exe from the above prebuilt binaries, put it into any %PATH% folder, and rename it to tcb.exe

I will figure out how to add tcobalt to winget-pkgs sometime in the future

Other Linux

You can try downloading the linux binary from the above prebuilt binaries, putting it into /usr/bin, and renaming it to tcb

Unsupported OSes

More support will come later. If you are on an unsupported operating system or architecture, or downloading a prebuilt binary didnt work, do this:

  1. Clone the repository
    git clone https://github.com/khyerdev/tcobalt.git
    cd tcobalt
    
  2. Compile (make sure rust is installed and the default rust toolchain is also installed)
    • On Linux:
      make
      
    • On Windows/MacOS:
      cargo build --release
      
  3. Install tcobalt
    • On Linux:

      sudo make install
      
    • On Windows/MacOS:

      Copy the tcobalt binary from target/release into a folder that has your PATH and rename it to tcb with the file extension corresponding to your OS (.exe on windows)

Dependencies

tcobalt is designed to use as little dependencies as possible. Here are the ones it uses:

The tokio runtime, for easily handling asynchronous code

futures, for easily parralelizing bulk downloads

reqwest, for making web requests with HTTPS. Requires tokio to work

I have reinvented the wheel for things that are possible for me to do without dependencies, like parsing json

Other Projects

tcobalt is not original, and a few other projects have the same concept implemented in other languages. Check them out, see if you prefer them over this one.

License

This project is licensed under the GNU GPL v3, meaning you are allowed to freely use, modify, and distribute this project as long as you keep it as free and open-source as this project is, and as long as you include the same lisence and indicate your changes. More information about this license is here (fossa.com) and here (gnu.org).

Cobalt has granted permission for anyone to use the cobalt api in their personal perojects, and not for commercial use. tcobalt is a personal project of mine, and I am not affiliated with wukko in any way.

I would prefer if you credited my work when you share this.