Watching Youtube videos in Elinks

January 2, 2010

Elinks is a great browser, but rather limited when it comes to websites that use more than just text. Youtube, or other websites that host flash videos, are fairly useless in Elinks, as you can’t access that what they are all about (and, let’s admit, no one really wants to read the comments on Youtube…)

It is, however, possible to use Elinks in combination with other applications to access and view the flash videos on Youtube and other such sites. I will describe two ways here, one using youtube-dl (wholly following finferlu’s explanations) and the other clive (or cclive if you prefer that). Both methods use mplayer to play the video, though you could adapt both to use any other media player that plays flash videos if you so prefer.


First download and install youtube-dl, which is available in the repositories of most distros. If you use Debian Testing, download the package from the sid repostories and install that (dpkg -i youtube-dl_2009.09.13-2_all.deb), as for some reason it has not made its way to the Testing repos.

Once youtube-dl is installed, create the following script:


video_url=`youtube-dl -g $1`
mplayer -vc ffflv -ac mp3 -cache 300 -prefer-ipv4 $video_url > /dev/null 2>&1

Save the script somewhere in one of your executable paths (I have it in /usr/local/bin as utube), and make it executable (chmod +x filename).

Now start elinks, and go to the “Options manager” by pressing o or through the menu (press Escape) in Setup > Options manager. Select the category “Document” and press + to show all the options. At the very end of the the list (just before the next section, ECMAScript) there is an subsection called “URI passing”. Navigate to that section and press a to add an entry, and give it an appropriate name (I called mine youtube). Select the newly created entry and press e to edit it. You should see the following window:

Add the command utube %c (replace utube with whatever you called the above script) into the “Value” field as in the above picture, press Enter, and press v to save the new settings.

Now you need to assign a keybinding to this script, so that you can tell Elinks to launch it when you want to view a Youtube video. Close the Options manager if you haven’t done so already (press c) and open the “Keybindings manager” (press k or go to “Setup > Keybindings manager” in the menu). Open the first section called “Main mapping” with the + key.

You now have two options (or three if you decide to use both). You can assign a keybinding to tell Elinks to view the Youtube video of either the selected link, or of the current page. With the former, you don’t actually have to browse to the page of the Youtube video you want to view, but can just select the link to that page from your Youtube search results list. With the latter you’d have to be on the page that contains the video.

To assign a keybinding to play the video of the selected link, select the “Pass URI of current link to external command” and press a to add a keybinding, and enter the keybinding you want to use in the “Keystroke” field.

To play the video of the current page, select the “Pass URI of current tab to external command” and add your keybinding there. Inverting finferlu’s choice, I use “Alt-p” for the current link, and “Alt-o” for the current page or tab.

Once all the above is done, you’re all set to watch Youtube videos with Elinks and Mplayer. Simply press “Alt-o” to view the video of the current page, or “Alt-p” to view the video that is linked to by the selected link, and Mplayer should stream the video nearly instantly.


Using youtube-dl to watch Youtube videos has a few disadvantages. First of all, it is limited to Youtube (though you could modify the above with metacafe-dl or nicovideo-dl to watch videos from and the to me entirely unknown Secondly, though mplayer streams the videos very fast (much faster than the flash player in a graphical browser on my old computers!), it is hard to jump ahead with this method, as the mplayer first stutters and then freezes whenever I attempt that.

Using clive instead of youtube-dl handles both of these better. According to the website, clive supports the following websites (most of which I had never heard of): Youtube, Google, Sevenload, Break, Liveleak, Evisor TV, Dailymotion, CCTV (not to be confused with “closed-circuit television”), Redtube, Vimeo,, Golem,, Clipfish, Funyhub, adn Myubo. Secondly, fast forwarding with clive works really well (as long as it has streamed that far ahead), and results in smoother playback. Clive does have some disadvantages. It will download the video file to your harddisk, and it takes a little longer before Mplayer starts playing the video.

The method to use clive instead is largely similar to that of youtube-dl. Open the Options manager in Elinks, go to the “URI passing” subsection of the “Document” section and create a new entry: press a and name the new entry “clive”. Select the new entry, press e to edit it, and add the following command in the “Value” field:

clive -q --save-dir=/tmp --stream-exec=\"mplayer -really-quiet %i\" --stream=10 %c

If you would prefer to let clive stream more before mplayer starts to play, increase the value after the “–stream” option (in percentage). If you want to view the best quality of the video available add “–format=best” to the above command (before “%c”!). For more options, see man clive.

If you have used both the clive and youtube-dl methods (or if you have created some other URI passing options), you will be presented with a list of commands that appears at the position of your cursor when you press Alt-o or Alt-p. Select the one you prefer, and press enter. If you only have one “URI passing” command, that one will automatically load when you press your keybinding.

And so you can watch your favourite Youtube (or Google Video, or Vimeo, or …) clips without having to rely on Flash, or even X. Now K.Mandla can finally watch his favourite slug races on the framebuffer! 😈

22 Responses to “Watching Youtube videos in Elinks”

  1. Thuban said

    Very nice trick! thanks a lot!

  2. Thuban said

    Oh, you also can write options in a .cliverc file.
    It’s really lighter than gnash. I would like to add such things on midori 🙂

  3. Leon said

    That’s Awesome, and nothing else.

  4. […] Zum Beispiel hielt ich es bis vor kurzem fĂŒr unmöglich youtube Videos auf speedy anzuschauen. Ein genialer Blogeintrag, elinks und mplayer haben das aber dann doch möglich gemacht. Da selbst auf  leistungsfĂ€higeren […]

  5. […] Grundidee ist einfach. AusfĂŒhrlich vorgestellt wurde sie Anfang des Jahres in Englisch von Urukrama. Gesucht ist ein Programm, welches schnell Suchergebnisse von Youtube zurĂŒckliefert, die URL des […]

  6. aqa said

    try youtube-viewer is for search a video in youtube and download and play with mplayer

  7. robert said

    Hey, this looks promising … !
    so I chose ‘cclive’ way and went for looking for the latest tarballs I needed. These I didn’t have installed :
    I went a way of compiling ( MY FIRST ATTEMPT EVER ).
    Many problems occurred straight during configuring, mostly like:
    “configure: error: Package requirements (libquvi >= 0.4.0) were not met:

    No package ‘libquvi’ found

    Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix.

    Alternatively, you may set the environment variables libquvi_CFLAGS
    and libquvi_LIBS to avoid the need to call pkg-config.
    See the pkg-config man page for more details.”

    This was situation when I didn’t know what to do next !!!
    For previous similar ones I found answers on the web.

    BUT there is installed ‘libquvi-0.4.0’ !!! … maybe there is missing a development file which I found in Synaptic ‘libquvi-dev’ but not sure about this. There are 2 more packages:
    … do I need to install them? If I compiled before newer version of libquvi-0.4.0?

    Where to go next? anyone can light up my way?

    thanx, robert

  8. robert said

    Ok,managed to install all I’ve needed, but …!!
    WHY when play videos is ‘command’s output’ shown in elinks, then when scrolling webpage it looks that output stays behind the text.
    do you have the same case ??
    … and
    for playing videos I am using VLC player and ‘quvi’ with command:
    quvi –exec=\”vlc %u\” %c
    … VLC plays only .flv files not VP80 !!!

  9. srikanth ganta said

    Reblogged this on Srikanth's Blog.

  10. Ross said

    With havin so much written content do you ever run into any issues of plagorism or copyright infringement?

    My site has a lot of completely unique content I’ve either created myself or outsourced but it seems a lot of it is popping it up all over the internet without my agreement. Do you know any methods to help prevent content from being stolen? I’d genuinely appreciate it.

  11. -error said

    […] more see this blog at of this blog at […]

  12. […] for more see this blog at of this blog at […]

  13. […] the latest blog here at or here from […]

  14. […] learn more about this at or at […]

  15. […] learn more about this at or at […]

  16. Braden said

    “Bad string

    options may only contain alphanumeric characters in addition to ‘-‘ and ‘_’ ”

    when I try to enter “clive -q –save-dir=/tmp –stream-exec=\”mplayer -really-quiet %i\” –stream=10 %c” into the value field

    What gives?

  17. […] Zum Beispiel hielt ich es bis vor kurzem fĂŒr unmöglich youtube Videos auf speedy anzuschauen. Ein genialer Blogeintrag, elinks und mplayer haben das aber dann doch möglich gemacht. Da selbst auf  leistungsfĂ€higeren […]

  18. inukaze said

    Hi, i wanna know if possible to use something like this but with links2 . when i open direct a url from web browser to use youtube-dl and mplayer to play it ???

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: