chrippa / livestreamer

Command-line utility that extracts streams from various services and pipes them into a video player of choice. No longer maintained, use streamlink or youtube-dl instead.
http://livestreamer.io/
BSD 2-Clause "Simplified" License
3.88k stars 581 forks source link

play youtube embedded videos #341

Closed dynamitemedia closed 10 years ago

dynamitemedia commented 10 years ago

we are working on embedding youtube videos on our site but wanted to still be able to watch these videos on the raspberry pi but can't seem to get any of the following urls to work

http://www.youtube.com/embed/u1zgFlCw8Aw?version=3&start=135&end=145&autoplay=1 or https://www.youtube.com/v/u1zgFlCw8Aw?version=3&start=135&end=145&autoplay=1

i have tried using the following:

livestreamer "http://www.youtube.com/embed/u1zgFlCw8Aw?version=3&start=135&end=145&autoplay=1" best

holomorph commented 10 years ago

other tools like youtube-dl and quvi (mpv uses this) exist for parsing youtube links

dynamitemedia commented 10 years ago

i would prefer using livestreamer if possible because of the great support here. I would entertain youtube-dl but no idea how to set that up to work without downloading video first

athoik commented 10 years ago

Adding the following probably will done the job.

    def _get_stream_info(self, url):
+      match = re.search("/(embed|v)/([^?]+)", url)
+      if match:
+          url = "http://youtube.com/watch?v={0}".format(match.group(2))
        res = http.get(url)
dynamitemedia commented 10 years ago

where would i make that change or is that something that needs to be done by Chirrpa?

athoik commented 10 years ago

Here: https://github.com/chrippa/livestreamer/blob/develop/src/livestreamer/plugins/youtube.py

You can place the modified file with changes into livestreamer/plugins folder, but you should delete youtube.pyc

PS. C:\Program Files\Livestreamer\livestreamer-1.7.5-py2.7.egg\livestreamer\plugins\youtube.pyc

dynamitemedia commented 10 years ago

sorry but no idea where to put the changes and what directory on a linux box?

basically what line do i change in that file above?

holomorph commented 10 years ago

youtube-dl -g prints a link which can be opened by your-favorite-media-playerâ„¢

dynamitemedia commented 10 years ago

still missing something here, sorry but i can't get it working... any help with a working version?

karlo2105 commented 10 years ago

@athoik It would be more simple if you can push youtube embed implementation into youtube.py plugin so everybody will be able to use it without any custom modification. ;)

dynamitemedia commented 10 years ago

chirppa, it will now play the embedded video but does not work with start and stopping the video can you test that and see what is going on? it works fine in browser but it starts at beginning each time with the start and stop commands

chrippa commented 10 years ago

That is intended, seeking is not supported.

dynamitemedia commented 10 years ago

:(