# (gtk)-youtube-viewer



## sunnyg (May 31, 2013)

Hey everybody.

I'm running FreeBSD 9.1-RELEASE and I've just installed both youtube-viewer and gtk-youtube-viewer from the ports collection, as well as mplayer and vlc from the packages. I didn't want to install linuxulator/linux_base-f10 (don't know enough the mitigate the security risks), so I chose youtube-viewer. I'm trying to get acclimated to FreeBSD and if I can get YouTube to work, then I can finish the Udacity cs101 course in FreeBSD without having to go back to Windows or OSX. 

But I digress; when I try any YouTube link from the CLI or from the GTK program, nothing happens when I either choose the number-code from the list or when I click add to queue/play from queue. I've switched between mplayer and vlc as the default mplayer on the CLI to no avail. 

I'm new to the forums so I'm a bit unsure of what other information I should include so please pardon my newbishness. Anyone have any ideas/tips that I can try?


----------



## sunnyg (May 31, 2013)

*Youtube-viewer not loading videos or opening mplayer*

Ok well I've only just noticed the new message in my account about the rules so let me reformat this question more appropriately:

I run `youtube-viewer` and am given the prompt `>`. I type `freebsd` as the keyword and type `11` as the number of the link in the search results. I'm given the description and a URL and a GET URL, neither of which open in VLC nor Mplayer successfully. After about 30 seconds, `youtube-viewer` returns me to its prompt `>`.

In VLC, Tools > Messages, opening http://www.youtube.com/watch?v=Y0av1OOMKOA as a network stream, the first error is (after I stop the operation since it's set to continually reconnect):

```
access_http error: cannot connect to r2---sn-xun-p5ie.c.youtube.com:80
```

Obviously it's not connecting, but I don't know quite enough to know if it's 
something I did,
something with youtube-viewer, or
an error with YouTube's servers
though I'm leaning on 1. When running `vlc -vv input_stream [url=http://www.youtube.com/watch?v=Y0av1OOMKOA]http://www.youtube.com/watch?v=Y0av1OOMKOA[/url]`, I can see it sending and accepting cookies multiple times before getting 
	
	



```
[0x802301a58] access_http access debug: Connection: close
[0x802301a58] access_http access debug: got disconnected, trying to reconnect
[0x802301a58] main access debug: net: connecting to www.youtube.com port 80
[0x802301a58] main access debug: connection succeeded (socket = 12)
```
 again and sending and accepting the cookies again. 

Any thoughts or recommendations?


----------



## shepper (Jun 1, 2013)

> In VLC, Tools > Messages, opening http://www.youtube.com/watch?v=Y0av1OOMKOA as a network stream, the first error is (after I stop the operation since it's set to continually reconnect):



That video is available in HTML5 and should play for you when viewed in an HTML5 capable browser. A quick search of these forum did reveal a recent [thread=38627]thread[/thread] about HTML5 videos in www/firefox.  By the way, thanks for the [thread=38808]tip[/thread] in the multimedia section.


----------



## teckk (Jun 1, 2013)

```
youtube-dl -F http://www.youtube.com/watch?v=Y0av1OOMKOA
......
Available formats:
35	:	flv	[480x854]
44	:	webm	[480x854]
34	:	flv	[360x640]
18	:	mp4	[360x640]
43	:	webm	[360x640]
5	:	flv	[240x400]
17	:	mp4	[144x176]
```
If you have mplayer installed, install youtub-dl also. This script will let you watch any YouTube video on the fly:


```
#!/bin/sh

echo "Enter URL"
while read URL
do
mplayer -cookies -cookies-file /tmp/cookies.txt $(youtube-dl -f 18 -g --cookies /tmp/cookie.txt "$URL")
done
```
If you want to download a copy of it, then something like `youtube-dl -F 18 [url=http://www.youtube.com/watch?v=Y0av1OOMKOA]http://www.youtube.com/watch?v=Y0av1OOMKOA[/url]`. You could modify that script to play your YouTube video without X, in framebuffer, something like, 
	
	



```
#!/bin/sh

echo "Enter URL"
while read URL
do
mplayer -vo fbdev2 -vf scale=320:240 -cookies -cookies-file /tmp/cookies.txt $(youtube-dl -f 18 -g --cookies /tmp/cookie.txt "$URL")
done
```

Easier to just download it I think.


----------

