this post was submitted on 22 Feb 2026
202 points (98.6% liked)

Linux

63183 readers
741 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 6 years ago
MODERATORS
 

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
[–] EccTM@lemmy.ml 3 points 1 day ago

I have a similar scriptlet that I use to open YouTube URLs in mpv, using just and wl-clipboard... I just copy the URL and press my G1 key (it has a keybind of just yt-paste attached) which launches the yt-paste snippet below, reads the url from the clipboard, parses it and passes it to mpv.

# Parse the clipboard for YouTube URLs and open them in mpv
yt-paste:
  #!/usr/bin/env bash
  YOUTUBE_URL_REGEX="^https:\/\/(www\.youtube\.com\/watch\?v=|youtu\.be\/)[a-zA-Z0-9_-]{11}"
  YOUTUBE_PLAYLIST_URL_REGEX="^https:\/\/(www\.youtube\.com\/playlist\?list=)[a-zA-Z0-9_-]+"
  YOUTUBE_SHORTS_URL_REGEX="^https:\/\/(www\.youtube\.com\/shorts\/)[a-zA-Z0-9_-]{11}"
  # Youtube URL
  if [[ "$(wl-paste)" =~ $YOUTUBE_URL_REGEX ]]; then
    echo "Opening valid YouTube URL" >&2
    notify-send --app-name="YT-Paste" --icon=mpv --transient "Opening YouTube URL"
    mpv "$(wl-paste)"
  # Youtube Playlist URL
  elif [[ "$(wl-paste)" =~ $YOUTUBE_PLAYLIST_URL_REGEX ]]; then
    echo "Opening valid YouTube Playlist URL" >&2
    notify-send --app-name="YT-Paste" --icon=mpv --transient "Opening YouTube Playlist URL"
    mpv "$(wl-paste)"
  # Youtube Short URL
  elif [[ "$(wl-paste)" =~ $YOUTUBE_SHORTS_URL_REGEX ]]; then
    echo "Opening valid YouTube Shorts URL" >&2
    notify-send --app-name="YT-Paste" --icon=mpv --transient "Opening YouTube Shorts URL"
    mpv "$(wl-paste)"
  # No Match
  else
    echo "Clipboard does not contain a valid YouTube URL" >&2
    notify-send --app-name="YT-Paste" --icon=mpv --transient "Whoops!" "Clipboard does not contain a valid YouTube URL"
    exit 1
  fi