Kodi Community Forum

Full Version: [depricated] old YouTube Plugin - XBMC 13.0 Frodo/Gotham only
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I read you,

(As sparaxin says if you select the plugin to "Ask" what "Max video quality" to play back in it should play just fine
Or
Edit %USERPROFILE%\XBMC\addons\plugin.video.youtube\YouTubePlayer.py and comment out lines 217 and 218

Change:
Code:
if get("action") != "download":
video_url += " | " + self.common.USERAGENT
To:
Code:
# if get("action") != "download":
# video_url += " | " + self.common.USERAGENT)

I did everything
Not play video youtube.
sorry for my english (I can not speak well)
thanks
I just started getting the error "Playback failed couldn't locate video URL." This happened right after updating to Frodo v12.1 from a nightly. I tried going back to the nightly, and tried to change to "ask" for video quality, but I'm still having the problem (there are no selectable options for video quality when it asks). I also uninstalled the plug-in and reinstalled 4.4.3 from the repository, but that didn't help either.

My log file when I tried to play two videos from my subscribed channels, and then tried play a searched video:
http://pastebin.com/GwmzR9g2
(2013-03-21, 00:04)quaternio Wrote: [ -> ]I just started getting the error "Playback failed couldn't locate video URL." This happened right after updating to Frodo v12.1 from a nightly. I tried going back to the nightly, and tried to change to "ask" for video quality, but I'm still having the problem (there are no selectable options for video quality when it asks). I also uninstalled the plug-in and reinstalled 4.4.3 from the repository, but that didn't help either.

My log file when I tried to play two videos from my subscribed channels, and then tried play a searched video:
http://pastebin.com/GwmzR9g2
Ye It just happen to me too i did not update or anything but i guess Youtube changed something.
Now i can't play anything
-- Edited since this post is no longer relevant and was just more noise --
I have the same problem and did the following steps too.

(2013-03-21, 00:07)razord93 Wrote: [ -> ]
(2013-03-21, 00:04)quaternio Wrote: [ -> ]I just started getting the error "Playback failed couldn't locate video URL." This happened right after updating to Frodo v12.1 from a nightly. I tried going back to the nightly, and tried to change to "ask" for video quality, but I'm still having the problem (there are no selectable options for video quality when it asks). I also uninstalled the plug-in and reinstalled 4.4.3 from the repository, but that didn't help either.

My log file when I tried to play two videos from my subscribed channels, and then tried play a searched video:
http://pastebin.com/GwmzR9g2
Ye It just happen to me too i did not update or anything but i guess Youtube changed something.
Now i can't play anything
Fixed it. from line 299 in YouTubePlayer, change
Code:
if line.strip().startswith("yt.playerConfig = "):
                found = True
                p1 = line.find("=")
                p2 = line.rfind(";")
                if p1 <= 0 or p2 <= 0:
                    continue
                data = line[p1 + 1:p2]
                break

to

Code:
index = line.find("ytplayer.config =")
            if index != -1:
                found = True
                p1 = line.find("=", (index-3))
                p2 = line.rfind(";")
                if p1 <= 0 or p2 <= 0:
                    continue
                data = line[p1 + 1:p2]
                break

sorry that the indents are not properly aligned in the code pasting

This demonstrates why whenever you're scraping a web page, it's dangerous to assume where on the page something will be located. Youtube changed their page format so that ytplayer.config is no longer at the beginning of a line.
(2013-03-21, 00:48)Kaylakaze Wrote: [ -> ]Fixed it. from line 299 in YouTubePlayer, change
Code:
if line.strip().startswith("yt.playerConfig = "):
                found = True
                p1 = line.find("=")
                p2 = line.rfind(";")
                if p1 <= 0 or p2 <= 0:
                    continue
                data = line[p1 + 1:p2]
                break

to

Code:
index = line.find("ytplayer.config =")
            if index != -1:
                found = True
                p1 = line.find("=", (index-3))
                p2 = line.rfind(";")
                if p1 <= 0 or p2 <= 0:
                    continue
                data = line[p1 + 1:p2]
                break

sorry that the indents are not properly aligned in the code pasting

This demonstrates why whenever you're scraping a web page, it's dangerous to assume where on the page something will be located. Youtube changed their page format so that ytplayer.config is no longer at the beginning of a line.

Thanks for your input. I have tried amending as stated above. Unfortunately, nothing happens and the same error still occurs.

Would you be able to provide your YoutubePlayer.py ?

Thanks.
________________________________________________________________________________
Xbmc Frodo 12.1
Youtube 4.4.3
(2013-03-21, 00:48)Kaylakaze Wrote: [ -> ]Fixed it. from line 299 in YouTubePlayer, change
[...]
sorry that the indents are not properly aligned in the code pasting

This demonstrates why whenever you're scraping a web page, it's dangerous to assume where on the page something will be located. Youtube changed their page format so that ytplayer.config is no longer at the beginning of a line.

Tried to replace those lines with what you provided, but doing so breaks the plugin for me. But I know next to nothing about scripting. I suppose I should just wait until somebody compiles a zip file with the fix that I can install, rather than tamper with it myself. Thanks though.
Managed to work out in the end, i replaced from line 298 instead of 299, here is what is in mine from lines 297 till the break.

http://pastebin.com/5kWkxNhn Pastebin is to hopefully get the spacing correct.

PHP Code:
for line in data.split("\n"):
            
index line.find("ytplayer.config =")
            if 
index != -1:
                
found True
                p1 
line.find("=", (index-3))
                
p2 line.rfind(";")
                if 
p1 <= or p2 <= 0:
                    continue
                
data line[p1 1:p2]
                break 
(2013-03-21, 01:16)quaternio Wrote: [ -> ]
(2013-03-21, 00:48)Kaylakaze Wrote: [ -> ]Fixed it. from line 299 in YouTubePlayer, change
[...]
sorry that the indents are not properly aligned in the code pasting

This demonstrates why whenever you're scraping a web page, it's dangerous to assume where on the page something will be located. Youtube changed their page format so that ytplayer.config is no longer at the beginning of a line.

Tried to replace those lines with what you provided, but doing so breaks the plugin for me. But I know next to nothing about scripting. I suppose I should just wait until somebody compiles a zip file with the fix that I can install, rather than tamper with it myself. Thanks though.

I have a feeling you pasted it directly (he did say it didn't indent right). Also at least for me it was from lines 298 to 306 that needed to be replaced.

here is how it worked for me:

Code:
for line in data.split("\n"):
            index = line.find("ytplayer.config =")
            if index != -1:
                found = True
                p1 = line.find("=", (index-3))
                p2 = line.rfind(";")
                if p1 <= 0 or p2 <= 0:
                        continue
                data = line[p1 + 1:p2]
                break

Image
For those who might struggle with code here is the file modified for you, just drop this over the top of the old YouTubePlayer.py
https://www.dropbox.com/s/q3ykhe2vn4j2z3...ePlayer.py

Thank you Kaylakaze for working it out so quickly Big Grin
The few lines of code from Kaylakaze worked a treat for me. Opened up youtubeplayer.py in notepad++, found the lines around 299, pasted in, saved, job done.
I should think there will be a new version soon correcting this however.

Thank you Kaylakaze!
(2013-03-21, 01:34)Elbulus Wrote: [ -> ]For those who might struggle with code here is the file modified for you, just drop this over the top of the old YouTubePlayer.py
https://www.dropbox.com/s/q3ykhe2vn4j2z3...ePlayer.py

Thank you Kaylakaze for working it out so quickly Big Grin

Thanks! Worked like a treat.
(2013-03-21, 01:34)Elbulus Wrote: [ -> ]For those who might struggle with code here is the file modified for you, just drop this over the top of the old YouTubePlayer.py
https://www.dropbox.com/s/q3ykhe2vn4j2z3...ePlayer.py

Thank you Kaylakaze for working it out so quickly Big Grin

Works for me, thanks

The following and a few other attempts didn't work:

Image
You're right about the line numbers. I forgot I had added a line in another function for debugging output. And the big pain about Python code pasting is Python has to have indentation correct which is a nightmare. That's pretty much the only reason I hate Python so much.