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
-tar -zxvf whitey-0.1.tar.gz
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()
-youtube-dll –help for more details