youtube-dl urls

Tim Chase blinux.list at thechases.com
Wed Aug 6 01:44:55 UTC 2014


On July 27, 2014, Brian Tew wrote:
> I am just using lynx the cat to get youtube urls.
> How do yall get urls that work from youtube?
> tim?

Since you called me out directly, I'll give you my random ramblings
on the matter.  I've not used lynx-the-cat to get the urls per-se,
but I usually copy (and optionally paste) to get my download url.
I've got a helper bash script (below) that can pull the URL out of my
X clipboard using "xclip".  I've noticed that sometimes extra stuff
in the YouTube URL causes issues, so I try to limit them to just the
one magic number, usually of the form
http://youtube.com/watch?v=ABCD1234 or whatever that token is
(sometimes, things like play-list IDs or other URL bits get included).
The script below will take such a URL on the command-line, and if
it's not provided there, will reach into the system clipboard to grab
it instead.  The definition of "YT" at the top happens to point to my
local git checkout is, so adjust that accordingly.  I happen to
prefer them in free formats, so that's what the script brings back.
Alternatively, you can add the --get-url parameter and pipe it to
"xclip -selection clipboard" to then dump the resulting media URL
into the X clipboard so you can paste it into the downloader of your
choice (whether "wget" or whatever).

Hope this helps,

-tim
	

#!/bin/sh
YT=$HOME/bin/downloads/youtube-dl/youtube-dl
URL="$1"
if [ -z "$1" ]
then
    URL="$(xclip -o -selection clipboard)"
fi

if [ -z "$URL" ]
then
    echo "No URL in the clipboard or command-line"
else
    echo "Fetching from $URL"
    ${YT} --prefer-free-formats "${URL}"
fi




More information about the Blinux-list mailing list