made it so i just click file and paste YouTube url

Linux is amazing

#! /usr/bin/bash
echo "Enter a url"
read a

yt-dlp -x $a
you are viewing a single comment's thread
view the rest of the comments
[–] 4 points 8 months ago (2 children)

this isn't perfect but i made one when i wanted to fetch a video for a specific resolution (because i prefer 480)

ytgrab() {  
  local id="$1"  
  local res="${2:-480}" # default to 480  
  local url="https://www.youtube.com/watch?v=$id"  

  # fetch formats  
  local fmt  
  fmt=$(yt-dlp -F --cookies-from-browser vivaldi "$url")  

  # printing the format output  
  echo "$fmt"  

  # pick video format matching the requested resolution  
  local vfmt  
  vfmt=$(echo "$fmt" | awk -v r="${res}p" '$0 ~ r && /video/ {print $1}' | head -n1)  

  # pick best m4a audio  
  local afmt  
  afmt=$(echo "$fmt" | awk '/m4a/ && /audio/ {print $1}' | head -n1)  

  # safety check  
  if [ -z "$vfmt" ] || [ -z "$afmt" ]; then  
    echo "Could not find matching formats (video ${res}p or m4a audio)."  
    return 1  
  fi  

  echo fetching: yt-dlp -f ${vfmt}+${afmt} --cookies-from-browser vivaldi --write-subs --no-write-auto-subs --sub-lang "en.*" $url  
  yt-dlp -f "${vfmt}+${afmt}" --write-subs --cookies-from-browser vivaldi --no-write-auto-subs --sub-lang "en.*" "$url"  
}  
  • source
  • hideshow 2 child comments
  • [–] 2 points 8 months ago (1 child)
  • usually i just like older videos but in this case i was saving a bunch of wcw vault videos to my jellyfin library and i prefer 480 since it was as close to tv as can be (also i've never been a fan of hd and tv after 2000 because i felt that's when it went downhill)

  • source
  • parent