• 0 Posts
  • 119 Comments
Joined 2 years ago
cake
Cake day: August 2nd, 2023

help-circle


  • Freetube

    Edit: In my experience Piped or Invidious gets rate limited often and stop loading videos for a while and I need to change instances. Freetube doesn’t have that problem, the only times videos stop working is when youtube changes something, when that happens I use Freetube to grab the video link and run a script to download with yt-dl and watch on the mpv player.

    script that I grabbed on the internet
    #!/usr/bin/env bash
    
    # Directory for downloaded videos:
    DL_DIR="$HOME/Downloads/yt"
    mkdir -p $DL_DIR
    
    # Video player:
    #PLAYER="xdg-open"
    PLAYER="/usr/bin/mpv"
    #PLAYER="/usr/bin/smplayer"
    
    # Downloader and options:
    YTDL="/bin/yt-dlp"
    YTDL_OPTS=(--no-playlist -S "res:1080" -N 5 --add-chapters)
    YTDL_DIR_OPTS=(-P "$DL_DIR")
    
    set -e
    
    CMD() {
      printf "[CMD]: "
      printf "\"%s\" " "$@"
      printf "\n"
      "$@"
    }
    
    # Get URL from clipboard if run without argument:
    if [ -z "$1" ]; then
      URL="$(xclip -o -sel c)"
    #  CMD qdbus org.kde.klipper /klipper org.kde.klipper.klipper.clearClipboardHistory
    else
      URL="$1"
    fi
    
    # Get video filename
    printf "[URL]: %s\n" "$URL"
    FILENAME=$("$YTDL" --get-filename "${YTDL_DIR_OPTS[@]}" "$URL")
    printf "[FILE]: %s\n" "$FILENAME"
    
    # Download video
    CMD "$YTDL" "${YTDL_OPTS[@]}" "${YTDL_DIR_OPTS[@]}" "$URL"
    
    # Play video
    CMD "$PLAYER" "$FILENAME" >/dev/null 2>&1
    

    I also configured a cronjob to clean the directory everyday.