You are not logged in.
Hi,
I was looking for a good way to view youtube videos on my atom based netbook without flash (for obvious reasons...) and I actually used brad212's script for a while but it annoyed me that I still had to use flash to download the videos (for some reason flash can quite cpu intensive even when it's not actually playing a video). Therefore I wrote a small script which uses ngrep to search for youtube urls in my network traffic and youtube-dl to get the video urls for mplayer to playback. I've just been using it for a couple of hours but it actually seems to work surprisingly well So feel free to test it an report back if you find any bugs etc.
PKGBUILD: http://aur.archlinux.org/packages.php?ID=40172
Config:
- change INTERFACE in /usr/bin/ytmpd if you're not using eth0 (eg wlan0 if you're using wifi)
- by default, ytmp automatically downloads the best quality version of the video but with a max resolution of 480p. If you want to download the best version available (=HD), then simply remove (--max-quality=35 from /usr/bin/ytmpc in line 17). You can also customize the max-quality variable to your own liking (see here for available formats on youtube).
Usage:
- start the ngrep wrapper as root: /etc/rc.d/ytmpd start
- start the 'client' script as user: /usr/bin/ytmpc
- open any youtube video (url) in your browser
If you have zenity installed, it will display a small dialog when it detects a youtube url asking you if you want to view it with mplayer. If not, it will just start mplayer without confirmation. There will be a small delay before the video starts because youtube-dl needs a couple of seconds to detect the url and mplayer is caching 2mb of video data before starting playback.
Have fun
Last edited by honki (2010-08-23 19:17:08)
Offline
works nicely... do you think you can add a download option to the zenity message box?
He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.
Douglas Adams
Offline
That's really nice work.
It would be nice if you can configure the client and daemon using a config-file in /etc/ so you don't have to modify the "binary".
Website: andrwe.org
Offline
Thanks for the feedback guys. I just uploaded a new version.
New features:
- Configuration in /etc/ytmp.conf
- You can choose between zenity, kdialog and no GUI
- You can choose to download the video
Offline
Would it be possible to expand ytmp to support other sites using flash too?
Website: andrwe.org
Offline
This is really great, I highly recommend it to... everyone. Thanks for taking the time to create/share it honki, it's great to not have to bother with cpu-intensive flash or youtube's crappy interface.
Offline
Thanks for the feedback guys. I just uploaded a new version.
New features:
- Configuration in /etc/ytmp.conf
- You can choose between zenity, kdialog and no GUI
- You can choose to download the video
on some videos i get a "youtube-dl: unknown option -W" now...
He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.
Douglas Adams
Offline
honki wrote:Thanks for the feedback guys. I just uploaded a new version.
New features:
- Configuration in /etc/ytmp.conf
- You can choose between zenity, kdialog and no GUI
- You can choose to download the videoon some videos i get a "youtube-dl: unknown option -W" now...
Hm, I can't reproduce this myself, but it's probably because I forgot to quote a string in the youtube-dl call. I just uploaded a new version which should hopefully fix this. If not please send me a link to a video where this happens.
Would it be possible to expand ytmp to support other sites using flash too?
I don't see a way for this method to work for flash videos in general, but I can add support for flash video sites provided there is a known way to download the video based on only the url/html. Which sites do you have in mind particularly? youtube-dl supports metacafe.com, google video, photobucket, yahoo video an dailymotion, so these should be really easy to implement. I'll probably add support for them and vimeo in the next version.
Offline
This works beautifully with YouTube videos opened with my text browser of choice, w3m. Thanks!
Registed Linux User 483618
Offline
Wanna add support for dmenu too? Then it would be perfect for me!
Offline
Works perfectly on my netbook! Thank you very much!
Offline
Just tried this and it works great. Thanks
Offline
Wanna add support for dmenu too? Then it would be perfect for me!
oh yes, that would rock totally!
He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.
Douglas Adams
Offline
Wow, this plugin is nice!! Keep up the good work!
Edit: Getting this error
youtube-dl: error: no such option: -0
on http://www.youtube.com/watch?v=-0NT0dmxtdY
Video won't play. Can it be cause of the video url part (...=-0NT0...)? Can anyone reproduce?
Last edited by archman-cro (2010-08-27 11:30:06)
Offline
Wow, this plugin is nice!! Keep up the good work!
Edit: Getting this erroryoutube-dl: error: no such option: -0
on http://www.youtube.com/watch?v=-0NT0dmxtdY
Video won't play. Can it be cause of the video url part (...=-0NT0...)? Can anyone reproduce?
i want to add this one:
cUsage: youtube-dl [options] url...
youtube-dl: error: no such option: -7
Usage: youtube-dl [options] url...
on this url:
http://www.youtube.com/watch?v=-79gQG-UGZo&feature=sub
Last edited by Rasi (2010-08-27 15:09:53)
He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.
Douglas Adams
Offline
Seems like the "minus" ("-" sign) in url is a problem here. Just my inexperienced opinion.
Btw, is there a way to mod the app to use SMPlayer? I've tried bashing the code by replacing "mplayer" with "smplayer", but it failed to start cause SMPlayer doesn't recognize the "cache" flag.
Also, is it supposed to cache the file? I get "Cache not filling!" in a terminal.
Last edited by archman-cro (2010-08-27 16:15:21)
Offline
Always enclose the URL with " , there are many signs that will make it fail or act weird, eg: & -
Offline
There are many alternative ways to do this, but I like the idea behind this one. It may not be the most simple, but it's browser agnostic and works rather well!
However, I wanted to make some changes, but found the code difficult to read. Therefore, since it's GPL, I've made a fork:
(hope you don't mind).
As well as turning it into a proper project, the main changes can be found here and here.
Offline
There are many alternative ways to do this, but I like the idea behind this one. It may not be the most simple, but it's browser agnostic and works rather well!
However, I wanted to make some changes, but found the code difficult to read. Therefore, since it's GPL, I've made a fork:
(hope you don't mind).
As well as turning it into a proper project, the main changes can be found here and here.
your fork also has the escaping errors...
He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.
Douglas Adams
Offline
So it does... (sorry I didn't check for that). However, it looks like its an issue with youtube-dl itself:
$ youtube-dl "-0NT0dmxtdY"
Usage: youtube-dl [options] url...
youtube-dl: error: no such option: -0
$ youtube-dl "-79gQG-UGZo"
Usage: youtube-dl [options] url...
youtube-dl: error: no such option: -7
$ youtube-dl "flglMLKnoRY"
[youtube] Setting language
[youtube] flglMLKnoRY: Downloading video webpage
[youtube] flglMLKnoRY: Downloading video info webpage
[youtube] flglMLKnoRY: Extracting video information
...
Reported here: #199 Leading dash in url throws error
Last edited by tlvince (2010-08-28 12:54:28)
Offline
hi guys,
thanks for all the feedback. I just merged my changes with tlvince's improved version (thanks again!) and updated the PKGBUILD to fetch the newest version of ytmp from http://github.com/tlvince/ytmp
changes so far:
* youtube urls with - fixed
* support for vimeo
* a couple of small bugfixes / cosmetic changes
by tlvince:
* support for xdg config files ($HOME/.config/ytmp/ytmp.conf)
* initial support for dmenu
Offline
Seems like the "minus" ("-" sign) in url is a problem here. Just my inexperienced opinion.
Btw, is there a way to mod the app to use SMPlayer? I've tried bashing the code by replacing "mplayer" with "smplayer", but it failed to start cause SMPlayer doesn't recognize the "cache" flag.
Also, is it supposed to cache the file? I get "Cache not filling!" in a terminal.
Just update to the newest version and configure PLAYER= in /etc/ytmp.conf You don't need caching with smplayer because it already passes this parameter to mplayer (Preferences -> Performance -> Cache). But yes, it is actually supposed to cache the file and as far as I can tell it is also working, at least on my machine. But caching is not to important anyways as long as your internet connection is fast enough...
Offline
Just update to the newest version and configure PLAYER= in /etc/ytmp.conf
Nice!
You don't need caching with smplayer because it already passes this parameter to mplayer (Preferences -> Performance -> Cache). But yes, it is actually supposed to cache the file and as far as I can tell it is also working, at least on my machine. But caching is not to important anyways as long as your internet connection is fast enough...
Heh, well, when I'm trying to watch some 720p video, it's all choppy, and then I instictively press pause in hope it will cache some, so I can view it.
Without that feature (caching) I must just use a normal flash, pause at the start, wait for it to finish caching, and then view it mplayer. That way the clip is watchable.
Cheers!
Offline
Hi,
nice work, but ytmp works for me only on vimeo.com site. Ytmpd is storing only vimeo video ids in /tmp/ytmpurls. I tried run this command in terminal
sudo ngrep -W byline -qilw 'get' tcp dst port 80 -d eth0
and for videos on youtube.com i get this
T 10.109.253.113:40425 -> 74.125.157.101:80 [AP]
GET /csi?v=2&s=youtube&action=watch5&srt=527&fmt=34&asv=3&plid=AASPS6NaK3VK-kTy&sprot=0&fv=LNX%2010%2C1%2C82%2C76&manu=Adobe%20Linux&vid=jfveZIXSDCg&rt=ct.102,bf.107,ol.487,fs.907,gv.1342,fvb.3620,vr.3709,vl.2367,aft.3709&e=907113,907025,905602 HTTP/1.1.
Host: csi.gstatic.com.
Connection: keep-alive.
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.127 Safari/533.4.
Referer: [url]http://www.youtube.com/watch?v=G0_2FvKkDPo&feature=rec-LGOUT-real_rn-1r-35-HM[/url].
Accept: */*.
Accept-Encoding: gzip,deflate,sdch.
Accept-Language: cs-CZ,cs;q=0.8.
Accept-Charset: windows-1250,utf-8;q=0.7,*;q=0.3.
youtube-dl G0_2FvKkDPo
works.
Ngrep for vimeo.com
T 10.109.253.113:52323 -> 92.122.188.107:80 [AP]
GET /images/staff.gif HTTP/1.1.
Host: a.vimeocdn.com.
Connection: keep-alive.
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.127 Safari/533.4.
Referer: [url]http://vimeo.com/14592941[/url].
Accept: */*.
Accept-Encoding: gzip,deflate,sdch.
Accept-Language: cs-CZ,cs;q=0.8.
Accept-Charset: windows-1250,utf-8;q=0.7,*;q=0.3.
Offline
@cmudik: we experienced some oddities recently similar to what you describe. Firstly can you try updating? The latest commit hash is: c032575682b1a3150b64
Last edited by tlvince (2010-09-03 06:45:29)
Offline