Hi! 😊

Youtube on Raspberry Pi [using Omxplayer/Youtube-dl/YT]

Couple of days ago, wanted to watch youtube videos on my pi. So, i came up with chrome and tried to load a video :P; unfortunately, this process takes lots of memory space (especially the chromium browser) and eventually came up with a solution after some googling πŸ˜€ , that is, to install 3 programs (Youtube-dl , YT(whitey) and Omxplayer). Just follow this guide from the Raspberry.org guide or mine πŸ˜€
All you have to do is copy paste in the terminal πŸ˜‰
wget https://github.com/rg3/youtube-dl/raw/2012.02.27/youtube-dl
chmod +x youtube-dl
-sudo cp youtube-dl /usr/bin/youtube-dl

-sudo apt-get install python-setuptools
-wget https://pypi.python.org/packages/source/w/whitey/whitey-0.1.tar.gz
-tar -zxvf whitey-0.1.tar.gz
“Navigate to whitey’s /src/yt/ directory, and edit __init__.py as follows: The line that has the mplayer command in it, change mplayer to omxplayer, and remove the argument switches.” found in play_url function almost at the end of the file
or change to this one:-

def play_url(url):
    yt_dl = subprocess.Popen([‘youtube-dl’, ‘-g -f 34/18/43/35/44/22/45/37/46’, url], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
    (url, err) = yt_dl.communicate()
    if yt_dl.returncode != 0:
        sys.stderr.write(err)
        raise RuntimeError(‘Error getting URL.’)
    mplayer = subprocess.Popen(
            [‘omxplayer’, url.decode(‘UTF-8’).strip()],
            stdout = subprocess.PIPE, stderr = subprocess.PIPE)
    mplayer.wait()

sudo python setup.py install
Now type the command [to update youtube-dl]]
-youtube-dl -u
-yt

-youtube-dll –help for more details

use keys like 0-9 to select a video, s to search for a video
the code above [‘youtube-dl’, ‘-g -f 34/18/43/35/44/22/45/37/46‘] for “-f” is the type of video format to download. 37 refers to mp4 of 1080p,34 for 360p etc.. unless u have a great internet access to load all max resolutions of videos, remove the “-f 22…/44/34/35/37″‘ part.
when video is playing .. use omxplayer controls keys like “space/p for pause -/+ for volume” will be really helpfully

happy surfing on Youtube πŸ˜€ 
Its being a great experience watching youtube videos/movies on my tv set ^_^ 


Problems on my pi πŸ˜›
running too many apps on the background and viewing a 1080p video can make it glitch at times .. so BEWARE

otherwise its a germ πŸ™‚


Made with β™‘ β™₯πŸ’•β€ from Mauritius