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 583 forks source link

503 error from Youtube #1284

Open BreadMaker opened 8 years ago

BreadMaker commented 8 years ago

Every time I try to watch a youtube video the following message appears:

breadmaker@hostname:~$ livestreamer youtube.com/watch?v=tufY_UfHsow best
[cli][info] Found matching plugin youtube for URL youtube.com/watch?v=tufY_UfHsow
error: Unable to open URL: http://youtube.com/get_video_info (503 Server Error: Service Unavailable for url: http://ipv4.google.com/sorry/IndexRedirect?continue=http://youtube.com/get_video_info%3Fel%3Dplayer_embedded%26video_id%3DtufY_UfHsow&q=CGMSBL5fLXQYw9C2uAUiGQDxp4NLDKn_kPXhn7B7vUfn3HF6NlghoBoqSWh0dHA6Ly95b3V0dWJlLmNvbS9nZXRfdmlkZW9faW5mbz9lbD1wbGF5ZXJfZW1iZWRkZWQmdmlkZW9faWQ9dHVmWV9VZkhzb3c)

For the record, the video can be watched via broswer without problems.

Using livestreamer 1.12.2 with Debian 3.16.7-ckt25-2 (2016-04-08) x86_64 GNU/Linux

wlingke commented 8 years ago

Also having this issue

v1kn commented 8 years ago

Same here. livestreamer 1.12.2

JackSaat commented 8 years ago

Also got this issue

ghost commented 8 years ago

If use proper user-agent string, then it is accepted and working again! https://github.com/nitpicker/livestreamer/commit/d5d814fbf673c8bf62c5d34cfed824f8088e30a4

Save https://raw.githubusercontent.com/nitpicker/livestreamer/d5d814fbf673c8bf62c5d34cfed824f8088e30a4/src/livestreamer/plugins/youtube.py to your livestream plugin folder

Is it a profit or law issue??

[Edited] For guy who is unfamiliar with python, there is pre-built one at https://github.com/nitpicker/livestreamer/releases/download/untagged-781898b0704c7ac99ca2/livestreamer-1.12.2.win-amd64.zip (Python 2.7/Windows x64)

hiepnhl commented 8 years ago

it also happened to me ;'(

v1kn commented 8 years ago

@nitpicker I don't seem to have any plugins directory. Ubuntu 15.10
In my case it's /usr/share/livestreamer/livestreamer_cli, with packages and utils folders. Creating plugins folder and putting Your youtube.py file, has not helped.
Where is plugins folder supposed to be placed?

ghost commented 8 years ago

@v1kn, usr\lib\python2.7\dist-packages\livestreamer\plugins (I have extracted the deb package under Windows)

dojima commented 8 years ago

You're my hero, nitpicker.

v1kn commented 8 years ago

@nitpicker works! Thanks, great job

JackSaat commented 8 years ago

Want to try this but I'm on Windows 10 can't find the file on my system

ghost commented 8 years ago

@JackSaat , maybe it's in <python dir>\Lib\site-packages\<livestreamer-x.yy.z-py2.7.egg>\livestreamer\plugins.

JackSaat commented 8 years ago

@nitpicker found that folder here: C:\Program Files (x86)\Livestreamer\livestreamer-1.12.2-py2.7.egg\livestreamer\plugins but it got .pyc files in it.

scottbernstein-zz commented 8 years ago

Windows version has the .py files compiled into .pyc files. For any updates (for example, this update for Youtube) you will have to compile the youtube.py into a youtube.pyc to make it work.

Date: Wed, 13 Apr 2016 10:46:33 -0700 From: notifications@github.com To: livestreamer@noreply.github.com Subject: Re: [chrippa/livestreamer] 503 error from Youtube (#1284)

@nitpicker found that folder here: C:\Program Files (x86)\Livestreamer\livestreamer-1.12.2-py2.7.egg\livestreamer\plugins but it got .pyc files in it.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub

JackSaat commented 8 years ago

@scottbernstein @nitpicker thanks, working great now again!

Luwangel commented 8 years ago

@nitpicker I've the same issue with livestreamer 1.12.2 in Debian. I tried to replace youtube.py with your version, but it doesn't work better. Do you have any idea?

error: Unable to open URL: http://youtube.com/get_video_info (503 Server Error: Service Unavailable for url: http://ipv4.google.com/sorry/IndexRedirect?continue=http://youtube.com/get_video_info%3Fel%3Dplayer_embedded%26video_id%3DAlZa8oRwc0g&q=CGMSBFAPxwoYvYC-uAUiGQDxp4NLHpRM5dj1SSS_V7oBGgFDu0nOUCAqSWh0dHA6Ly95b3V0dWJlLmNvbS9nZXRfdmlkZW9faW5mbz9lbD1wbGF5ZXJfZW1iZWRkZWQmdmlkZW9faWQ9QWxaYThvUndjMGc)

scottbernstein-zz commented 8 years ago

The issue is with the odd URL you have tried to pass the livestreamer. What's with the "ipv4.google.com" URL? Just use the direct youtube.com/watch?v=XXXX URL and it should work fine.

Date: Thu, 14 Apr 2016 04:35:46 -0700 From: notifications@github.com To: livestreamer@noreply.github.com CC: scott_bernstein@hotmail.com Subject: Re: [chrippa/livestreamer] 503 error from Youtube (#1284)

@nitpicker

I've the same issue with livestreamer 1.12.2 in Debian. I tried to replace youtube.py with your version, but it doesn't work better. Do you have any idea?

error: Unable to open URL: http://youtube.com/get_video_info (503 Server Error: Service Unavailable for url: http://ipv4.google.com/sorry/IndexRedirect?continue=http://youtube.com/get_video_info%3Fel%3Dplayer_embedded%26video_id%3DAlZa8oRwc0g&q=CGMSBFAPxwoYvYC-uAUiGQDxp4NLHpRM5dj1SSS_V7oBGgFDu0nOUCAqSWh0dHA6Ly95b3V0dWJlLmNvbS9nZXRfdmlkZW9faW5mbz9lbD1wbGF5ZXJfZW1iZWRkZWQmdmlkZW9faWQ9QWxaYThvUndjMGc)

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub

jcxmej commented 8 years ago

@nitpicker You are a f*king life saver. I had a project that was using livestreamer and you literally saved me. I am new to streaming videos. Can someone tell me why it was broken before and how it is fixed now? Edit: This fix worked on my linux computer but I get the error on my raspberry pi. Any idea why? Edit: Found the problem and solved. But not sure why or how it happened. /usr/bin had a 'livestreamer' with version number 1.10.2 and /usr/local/bin had a 'livestreamer' with version number 1.12.2. And the command which was used was from /usr/local/bin/. I changed the version number back to 1.10.2 and voila it starts working. Any comments anyone?

chrishukill commented 8 years ago

@nitpicker Where would I find that file on OS X Yosemite?

karlo2105 commented 8 years ago

@nitpicker Could you please pull request of your Youtube fix in order to be merged with Livestreamer ?

ghost commented 8 years ago

@jcxmej, @chrishukill,

I have no machine which is not running Windows 7, may re-install livestreamer from source is preferred. (See http://docs.livestreamer.io/install.html Source section).

zackmorgs commented 8 years ago

I'm on OSX and used easy_install to install livestreamer.

All I had to to do is replace this /Library/Python/2.7/site-packages/livestreamer-1.12.2-py2.7.egg/livestreamer/plugins/youtube.py with this: https://raw.githubusercontent.com/nitpicker/livestreamer/d5d814fbf673c8bf62c5d34cfed824f8088e30a4/src/livestreamer/plugins/youtube.py

Thanks so much @nitpicker you've made my csgo dreamhack video watching an actual 60fps tonight/next couple days. Now all I have to do is figure out how to/if i have to manually update with easy_install.

@chrishukill check if this is where yours is

People that have mpv can try something like this to watch youtube videos before this gets updated fully:

mpv --ytdl "https://www.youtube.com/watch?v=sLprVF6d7Ug"

v1kn commented 8 years ago

Will this be merged into master?

hiepnhl commented 8 years ago

@scottbernstein I tried to compile that youtube.py into a youtube.pyc and when I run livestreamer, I got this error message:

C:\Users\hiepn>livestreamer https://www.youtube.com/watch?v=ybtnI9qvXj8 720p Failed to load plugin youtube: ImportError: Bad magic number in c:\program files (x86)\livestreamer\livestreamer-1.12.2-py2.7.egg\livestreamer\plugins\youtube.pyc'

error: No plugin can handle URL: https://www.youtube.com/watch?v=ybtnI9qvXj8

What's wrong with me? I use the py_compile modules, Python 3.5 (x64): >>> import py_compile >>> py_compile.compile('youtube.py')

mdc2008 commented 8 years ago

@nitpicker The fix worked great. I am trying to learn why, so I can hopefully troubleshoot these things in the future. i have compared the old youtube.py to yours and I see only one change on one line pertaining to hls headers. Was that the only issue and how would that be determined? Do I need to learn python?

ghost commented 8 years ago

@mdc2008, it's not related to python. I uses Telerik Fiddler to modify/replay the API request.

mdc2008 commented 8 years ago

@nitpicker Awesome... I already have that installed, I just don't know much about it...thank you.

scottbernstein-zz commented 8 years ago

@hiepnhl -- you have to use the latest version of Python 2.7.

Livestreamer does not support Python 3 at this time

On Apr 15, 2016, at 4:37 AM, hiepnhl notifications@github.com wrote:

@scottbernstein I tried to compile that youtube.py into a youtube.pyc and when I run livestreamer, I got this error message:

C:\Users\hiepn>livestreamer https://www.youtube.com/watch?v=ybtnI9qvXj8 720p Failed to load plugin youtube: ImportError: Bad magic number in c:\program files (x86)\livestreamer\livestreamer-1.12.2-py2.7.egg\livestreamer\plugins\youtube.pyc'

error: No plugin can handle URL: https://www.youtube.com/watch?v=ybtnI9qvXj8

What's wrong with me? I use this py_compile modules, Python 3.5 (x64):

import py_compile py_compile.compile('youtube.py')

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub

mgs1725 commented 8 years ago

@nitpicker

I compiled the youtube.py into .pyc and placed in the plugin folder.

I am no longer getting the 503 error , however I am only getting the first frame of the video loading into VLC. If i use -O output.mp4 it does the same thing.

scottbernstein-zz commented 8 years ago

This has been reported many times before. You need to update to the nightly build version of VLC for your platform and it will work fine

Date: Fri, 15 Apr 2016 13:11:15 -0700 From: notifications@github.com To: livestreamer@noreply.github.com CC: scott_bernstein@hotmail.com Subject: Re: [chrippa/livestreamer] 503 error from Youtube (#1284)

@nitpicker

I compiled the youtube.py into .pyc and placed in the plugin folder.

I am no longer getting the 503 error , however I am only getting the first frame of the video loading into VLC. If i use -O output.mp4 it does the same thing.

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub

mgs1725 commented 8 years ago

updated to nightly VLC 3.0 and working Thanks

JuPlutonic commented 8 years ago
  1. Don't understand there I have to place youtube.pyc file... In my case I got 'livestreamer' in /home/juplutonic/venv/PyLearn/bin directory.
  2. There aren't VLC 3 packages for my Ubuntu 14.04.[04|xx] at all... There is 3.0.0~~git20141105 in one repo, but that looks untrustable.

P.S. Last week Youtube live stream recorded well, but now I dealing with this issue.

JuPlutonic commented 8 years ago

(1) Done... Replaced youtube.py & youtube.pyc files in ~/venv/PyLearn/lib/python2.7/site-packages/livestreamer/plugins/

ThisIsFineCopium commented 8 years ago

Thanks @nitpicker For people that didn't understand.

  1. Go to your livestreamer folder
  2. Find / search for "youtube.py"
  3. Open "youtube.py" in notepad++ or w/e text editor
  4. find "res = http.get(API_VIDEO_INFO, params=params)"
  5. replace that line with "res = http.get(API_VIDEO_INFO, params=params, headers=HLS_HEADERS)"
Koisell commented 8 years ago

line 162 ;) In _get_stream_info Does this problem come from a change in Youtube? Why we have to add the navigator in Header now and not before?

ninjada commented 8 years ago

Thanks for the youtube plugin fix.

I can write the youtube stream now, but after closing the stream I can't open the file. I'm trying to save the live coachella streams for example..

Just seems to error when I try to open in vlc or quicktime etc? vlc will show the first frame or something try to run it and blip out..

If i run the same command on a standard non-stream youtube, it saves and plays fine.

On MacOSX tried with VLC 2.2.2 and latest nightly build 2.2.3 17thApril -- saving with 'best', which seems to be outputting 1080p60fps hls.


Update: seems to just be an issue with VLC playback? if i open the saved stream in mpv for example it plays fine.. i've tested with both latest vlc nightly build and mpv writing the stream, but playing the file back in vlc fails while mpv is normal....

scottbernstein-zz commented 8 years ago

@ninjada ...not the 2.x nightly build. You need to install the 3.x nightly build for it to work.

Date: Sun, 17 Apr 2016 18:04:33 -0700 From: notifications@github.com To: livestreamer@noreply.github.com CC: scott_bernstein@hotmail.com Subject: Re: [chrippa/livestreamer] 503 error from Youtube (#1284)

Thanks for the fix.

I can write the youtube stream now, but after closing the stream I can't open the file. Just seems to error out.

On MacOSX tried with VLC 2.2.2 and latest nightly build 2.2.3 17thApril

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub

ninjada commented 8 years ago

Ahh doh missed that, last Mac v3 nightly build was Feb. Working now, thanks for clearing it up!

tobilektri commented 8 years ago

@skules thanks for your instructions, but on Windows I don't have a "youtube.py" I just have a "youtube.pyc" which I can not open with an Editor. How to fix the Problem on Windows? Path to the file: C:\Program Files (x86)\Livestreamer\livestreamer-1.12.2-py2.7.egg\livestreamer\plugins\youtube.pyc

Koisell commented 8 years ago

read the nitpicker post (13 day ago).

fadster commented 8 years ago

I'm also getting this on vaughlive.tv streams.

jmuff44xv commented 8 years ago

@tobilektri I compiled the .py file with Python. It wouldn't let me upload a .pyc file, so I changed the extension to .txt. Be sure to change it back to .pyc

youtube.txt

saucecode commented 8 years ago

Quicker solution: Run as: livestreamer --http-header "User-Agent"="UA" https://www.youtube.com/watch?v=123

Where UA is a user agent string, such as that which appears at http://whatsmyuseragent.com/

This error comes because YouTube treats livestreamer's HTTP requests as bot requests. The ipv4.google.com address that comes out with the error is a redirect to a captcha page. As far as I know there is no way for livestreamer to prompt a user to solve the captcha. Using a recognised user agent solves this problem.

Konc commented 8 years ago

For what it's worth, on Windows 10 I put the youtube.py file in my plugins folder (mentioned a few times), removed youtube.pyc and ran Livestreamer as usual. It doesn't compile the file to .pyc but it still works just fine (for me).

joshdvx commented 8 years ago

This fixed it for me, upgrading to the latest nightly build v3.0 for VLC. I didn't need to mess with the .pyc file.