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.
diliban Wrote:Hi,

I am new to XBMC and python plugins. I was able to figure out how to call the Youtube plugin with the video id (page 33 of this thread). But when I do call the plugin I get the following error in the log.

Code:
14:03:37 T:5904 M:1049944064 ERROR: XFILE::CPluginDirectory::SetResolvedUrl - called with an invalid handle.

When I copy the link and paste it in Chrome browser, the file starts downloading with out any issues. So why is XBMC not playing the link? Can you please help?
Hi, I don't know how you are telling xbmc to execute the command, but it sounds like you're having trouble with handles and video playback as was explained in the post on page 33:
http://forum.xbmc.org/showpost.php?p=628...tcount=321

It is very important that the url you pass is executed with a call like XBMC.PlayMedia(<plugin url>)
as xbmc will otherwise give it the wrong handle for video playback and the operation will fail Smile

diliban Wrote:Also on a different note, how do I call the plugin with a playlist parameter? Currently my URL is of the format

Code:
http://www.youtube.com/p/0F50DD75842E0226?hl=en_US&fs=1


I am passing this to the API
[/CODE]

http://gdata.youtube.com/feeds/api/playlists/....[/CODE] to get the individual video ids and then calling the youtube plugin. I am hoping I can just call the plugin with the Playlistid. is that possible ? if so how? I did try changing the videoid to playlistid in the plugin call but I got an error.

any help on this is appreciated

Thanks
I Don't know what you're trying to accomplish but I'm guessing that it would be to queue a playlist of "plugin" video items and start playback, this is as far as i know currently impossible with XBMC.

I've tried implementing something like this in the plugin:
Code:
        xbmc.executebuiltin('XBMC.Action(Queue(plugin://plugin.video.youtube.beta/?path=/root/playlists&feed=playlist_root&playlist=02B8B3DB2F90E8BD))')
player = xbmc.Player()
player.playnext()
But no dice Wink

A lot of users have been asking for similar functionality (albeit from within xbmc), so I've also created a patch for XBMC that would allow someone to implement similar behavior by adding a new builtin function "PlayAll(<plugin path>)" (see trac ticket: http://trac.xbmc.org/ticket/10959).

But the horizon for getting this patch accepted and committed to trunk seems to be very long, so we'll probably see if we can't code around it for the next beta.

tl;dr: Auto play of YouTube playlists not possible yet.. Smile

In case you're trying to do something else with playlists please elaborate Smile
Thanks for the reply HenrikDK. All I am trying to do is parse a website and get all the YouTube videos and pass it to Youtube addon to play the video(s). Smile

I think I am calling the plugin using the correct URL and the method as I can see the from the logs that the plugin is retrieving the information about the videoid. But when the URL generated for the videoplayback/download is generated it errors out as shown in the log.

The URL I use for the Plugin Call

Code:
url = "plugin://plugin.video.youtube/?action=play_video&videoid=%s" % videoid


Also the code to execute the url is
Code:
xbmc.PlayMedia(url)

As seen in the log, the plugin seems to kick in fine to get the details of the video but then ends with an error when trying to play the video

Code:
23:21:31 T:8820 M:1321521152  NOTICE: Name: Airtel Super S..
23:21:31 T:8820 M:1321521152  NOTICE: http://tamilkacheri.com/?page=view&id=2403
23:21:43 T:3100 M:1323032576  NOTICE: -->Python Interpreter Initialized<--
23:21:43 T:3100 M:1323016192  NOTICE: YouTube-2.0.0 ARGV: ['plugin://plugin.video.youtube/', '-1', '?action=play_video&videoid=XecLsVXi6oM']
23:21:43 T:3100 M:1321312256  NOTICE: YouTube-2.0.0 construct_video_url : 'XecLsVXi6oM'
23:21:43 T:3100 M:1321312256  NOTICE: YouTube-2.0.0 _get_details: 'XecLsVXi6oM'
23:21:43 T:3100 M:1321312256  NOTICE: YouTube-2.0.0 fetching page : http://gdata.youtube.com/feeds/api/videos/XecLsVXi6oM
23:21:43 T:3100 M:1321283584  NOTICE: YouTube-2.0.0 _getvideoinfo: 4022
23:21:43 T:3100 M:1321074688  NOTICE: plot updated
23:21:43 T:3100 M:1321074688  NOTICE: YouTube-2.0.0 _getvideoinfo done : 1
23:21:43 T:3100 M:1321074688  NOTICE: YouTube-2.0.0 _get_details done
23:21:43 T:3100 M:1321074688  NOTICE: YouTube-2.0.0 extractVariables : 'XecLsVXi6oM'
23:21:43 T:3100 M:1321074688  NOTICE: YouTube-2.0.0 fetching page : http://www.youtube.com/watch?v=XecLsVXi6oM&safeSearch=none&hl=en_us
23:21:44 T:3100 M:1322086400  NOTICE: YouTube-2.0.0 extractVariables done
23:21:44 T:3100 M:1322082304  NOTICE: YouTube-2.0.0 construct_video_url: stream_map : False
23:21:44 T:3100 M:1322082304  NOTICE: YouTube-2.0.0 construct_video_url: non stream map
23:21:44 T:3100 M:1322082304  NOTICE: YouTube-2.0.0 construct_video_url done
23:21:44 T:3100 M:1322082304  NOTICE: YouTube-2.0.0 - Playing video: ATSS 3 - XecLsVXi6oM - http://v8.lscache8.c.youtube.com/videoplayback?sparams=id,expire,ip,ipbits,itag,algorithm,burst,factor&fexp=906338,900203,910205&algorithm=throttle-factor&itag=35&ipbits=8&burst=40&sver=3&signature=C3740DBE63ADFC97CFF0967D3DCF38C12B6C4BD3.2B152490FB6FF657A1D3B1308841109CCDD887B6&expire=1298372400&key=yt1&ip=71.0.0.0&factor=1.25&id=5de70bb155e2ea83 | Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8
23:21:44 T:3100 M:1322082304   ERROR:  XFILE::CPluginDirectory::SetResolvedUrl - called with an invalid handle.
23:21:49 T:6824 M:1319911424  NOTICE: Storing total System Uptime
23:21:49 T:6824 M:1319911424  NOTICE: Saving settings
23:21:49 T:6824 M:1319866368  NOTICE: stop all

Where am I going wrong?

When I enter the VideoID in the youtube Addon under Playbyid the video play's fine. So I do know the video works. But I want it to work from my addon.
diliban Wrote:Thanks for the reply HenrikDK. All I am trying to do is parse a website and get all the YouTube videos and pass it to Youtube addon to play the video(s). Smile

I think I am calling the plugin using the correct URL and the method as I can see the from the logs that the plugin is retrieving the information about the videoid. But when the URL generated for the videoplayback/download is generated it errors out as shown in the log.

The URL I use for the Plugin Call

Code:
url = "plugin://plugin.video.youtube/?action=play_video&videoid=%s" % videoid


Also the code to execute the url is
Code:
xbmc.PlayMedia(url)

As seen in the log, the plugin seems to kick in fine to get the details of the video but then ends with an error when trying to play the video

Code:
23:21:31 T:8820 M:1321521152  NOTICE: Name: Airtel Super S..
23:21:31 T:8820 M:1321521152  NOTICE: http://tamilkacheri.com/?page=view&id=2403
23:21:43 T:3100 M:1323032576  NOTICE: -->Python Interpreter Initialized<--
23:21:43 T:3100 M:1323016192  NOTICE: YouTube-2.0.0 ARGV: ['plugin://plugin.video.youtube/', '-1', '?action=play_video&videoid=XecLsVXi6oM']
23:21:43 T:3100 M:1321312256  NOTICE: YouTube-2.0.0 construct_video_url : 'XecLsVXi6oM'
23:21:43 T:3100 M:1321312256  NOTICE: YouTube-2.0.0 _get_details: 'XecLsVXi6oM'
23:21:43 T:3100 M:1321312256  NOTICE: YouTube-2.0.0 fetching page : http://gdata.youtube.com/feeds/api/videos/XecLsVXi6oM
23:21:43 T:3100 M:1321283584  NOTICE: YouTube-2.0.0 _getvideoinfo: 4022
23:21:43 T:3100 M:1321074688  NOTICE: plot updated
23:21:43 T:3100 M:1321074688  NOTICE: YouTube-2.0.0 _getvideoinfo done : 1
23:21:43 T:3100 M:1321074688  NOTICE: YouTube-2.0.0 _get_details done
23:21:43 T:3100 M:1321074688  NOTICE: YouTube-2.0.0 extractVariables : 'XecLsVXi6oM'
23:21:43 T:3100 M:1321074688  NOTICE: YouTube-2.0.0 fetching page : http://www.youtube.com/watch?v=XecLsVXi6oM&safeSearch=none&hl=en_us
23:21:44 T:3100 M:1322086400  NOTICE: YouTube-2.0.0 extractVariables done
23:21:44 T:3100 M:1322082304  NOTICE: YouTube-2.0.0 construct_video_url: stream_map : False
23:21:44 T:3100 M:1322082304  NOTICE: YouTube-2.0.0 construct_video_url: non stream map
23:21:44 T:3100 M:1322082304  NOTICE: YouTube-2.0.0 construct_video_url done
23:21:44 T:3100 M:1322082304  NOTICE: YouTube-2.0.0 - Playing video: ATSS 3 - XecLsVXi6oM - http://v8.lscache8.c.youtube.com/videoplayback?sparams=id,expire,ip,ipbits,itag,algorithm,burst,factor&fexp=906338,900203,910205&algorithm=throttle-factor&itag=35&ipbits=8&burst=40&sver=3&signature=C3740DBE63ADFC97CFF0967D3DCF38C12B6C4BD3.2B152490FB6FF657A1D3B1308841109CCDD887B6&expire=1298372400&key=yt1&ip=71.0.0.0&factor=1.25&id=5de70bb155e2ea83 | Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8
23:21:44 T:3100 M:1322082304   ERROR:  XFILE::CPluginDirectory::SetResolvedUrl - called with an invalid handle.
23:21:49 T:6824 M:1319911424  NOTICE: Storing total System Uptime
23:21:49 T:6824 M:1319911424  NOTICE: Saving settings
23:21:49 T:6824 M:1319866368  NOTICE: stop all

Where am I going wrong?

When I enter the VideoID in the youtube Addon under Playbyid the video play's fine. So I do know the video works. But I want it to work from my addon.

As far as i can see the xbmc python module doesn't have a PlayMedia function, so I'm kinda puzzeled as to how you're executing the plugin Smile. Anyway I just tried copying this line of code into a random function on my dev machine and it worked:
Code:
xbmc.executebuiltin("XBMC.PlayMedia(plugin://plugin.video.youtube/?action=play_video&videoid=XecLsVXi6oM)")
HenrikDK Wrote:Hi, I will look into this, but I'm kinda doubting its possible as i don't know what subtitle format YouTube uses or if XBMC will even allow me to add it. But anyways I will give it a look see Wink

On the Roku the Unofficial Youtube channel has Subtitle support so it proves that the Subs are at least Accessible through the API. Although what format the Subs are using, I don't know. Youtube allows uploading of SRT files so hopefully that's what they Output.
japzone Wrote:On the Roku the Unofficial Youtube channel has Subtitle support so it proves that the Subs are at least Accessible through the API. Although what format the Subs are using, I don't know. Youtube allows uploading of SRT files so hopefully that's what they Output.

Well I spent some time looking into it and theres plenty of bad news ahead:
Quote:Captions for a video can only be created, retrieved, modified and deleted by the owner of that video. To perform these operations for a video, you must submit authenticated API requests for which the video's owner is the logged-in user. Accordingly, API requests for caption operations must contain a properly formatted Authorization header.
taken from:
http://code.google.com/apis/youtube/2.0/...ate_Format

In short the API doesn't expose subtitle streams to anyone else but the videos owner, this means we have to scrape the video page for the feed. While this seems easy enough to do, the format that YouTube provides seems to be proprietary (or some variation of the W3C's timed text, but I didn't spend enough time looking at it to tell whether or not YouTube follows the standard as it seems *a lot* more complex).

Currently this format is unsupported by XBMC, and it's highly unlikely that it will ever be added, as such the plugin will need to do an on the fly conversion to .srt or some other supported format. While this is possible I have yet to figure out how to provide the final subtitle stream to xbmc (but that might be solvable too)

In any case this is a feature that won't make it into the plugin until development on the next beta begins Oo

http://pastebin.com/5HvfFzKb
Hi, could you make it auto login when you select the addon? it is VERY annoying having to open options then go to ok every time I want to use it. Or at least add a login option to the main direcotry list.

Also is there a way to make it login any quicker? takes several minutes stuck on 'loading directory' when it's logged in (after going to options and clicking ok...)

Great addon apart from these flaws... main one being it takes forever to login. Nothing to do with pc connection.


Final edit: confirmed my user and password is working on the site, confirmed I typed them in correctly by looking at the settings xml. All correct but still wont login. Videos work on browse youtube etc.
Death-Axe Wrote:Hi, could you make it auto login when you select the addon? it is VERY annoying having to open options then go to ok every time I want to use it. Or at least add a login option to the main directory list.

Once you're logged in the plugin will remember the authentication token between sessions, this token might expire (either if a long time passes between you using the plugin, or you logging in with the plugin from some other machine) both these cases require you to login again, but the should be pretty infrequent. We could probably look into doing an automagic re-login, but that might annoy windows users due to the login speed issues explained below.

Death-Axe Wrote:Also is there a way to make it login any quicker? takes several minutes stuck on 'loading directory' when it's logged in (after going to options and clicking ok...)

Great addon apart from these flaws... main one being it takes forever to login. Nothing to do with pc connection.

The long login time is due to youtubes login mechanism being flaky, and therefore the plugin tries to login multiple times, unfortunately this often results in the user waiting the standard 30 seconds between logins. We've tried implementing a fix for this but it cause problems with windows (see trac) so we disabled it again.

Death-Axe Wrote:Final edit: confirmed my user and password is working on the site, confirmed I typed them in correctly by looking at the settings xml. All correct but still wont login. Videos work on browse youtube etc.

If you're having issues loging on then please follow the guide:
http://code.google.com/p/youtubexbmc/wik...oginIssues

/HenrikDK
I followed your guide...and strangely it just logged in. crazy stuff... but thanks for the heads up.
Death-Axe Wrote:I followed your guide...and strangely it just logged in. crazy stuff... but thanks for the heads up.

Yeah I know Wink, I would hardly call the login function deterministic right now especially for windows users. I was looking at the youtube api description and it seems that we're now using an outdated entry point for our login function so I've added a refresh of the login code and some work on better re-login to the todo. The change is non trivial though so it wont be included before the next beta.
I'm having some trobles with catagory views, all though all the TV shows appear none of the episodes do when selecting any of them. So far it seems to be mostly 4od stuff but I have found a few other that dont work, so far HISHE and MOD2 killcams are the only ones I've found that work.
XBMC PRE-11.0 r35744
youtube V2.0.0
Any help would be apreciated.
tomolac Wrote:I'm having some trobles with catagory views, all though all the TV shows appear none of the episodes do when selecting any of them. So far it seems to be mostly 4od stuff but I have found a few other that dont work, so far HISHE and MOD2 killcams are the only ones I've found that work.
XBMC PRE-11.0 r35744
youtube V2.0.0
Any help would be apreciated.

Hi just tested that the "Show" scraper was still working on my end and everything seems fine, but I can't vouch for 4oD content since I don't have access to that stuff.

Playback of 4oD stuff has been problematic / non working for some time and I think it's got something to do with their added commercials. To say anything more I would need some examples of shows that won't work which are not region restricted like 4oD..

Also if you are getting any error messages while listing episodes or playing anything from within xbmc please post a log with the plugins debug mode enabled.
i don't know if this has been asked before, but is it possible to have this script access hyperlinks in annotations? seeing as interactive videos are getting more and more popular.
Shinu Wrote:i don't know if this has been asked before, but is it possible to have this script access hyperlinks in annotations? seeing as interactive videos are getting more and more popular.

Ehm, I can't really see how thats supposed to work in a media center application like XBMC, we don't really have access to a webbrowser and most people navigate exclusively with their remote, and on top of that theres the whole problem drawing the links on screen which I'm unsure of how to accomplish. In short I don't think this is possible, and falls well out side of the expectations of a mediacenter application for now.
Quote:11:00:28 T:140368469456640 M:3182301184 NOTICE: YouTube-2.0.0 parseVideoList, got videoid false

is the error I get
tomolac Wrote:is the error I get

Hi,

First, That's not an error it's a notification that YouTube returned a video id which is not viewable in your country.

Second and I should probably have elaborated on this earlier, if you want to report an error you have to (taken from our login troubleshooting page):

Quote:1. Upload your debug log to http://pastebin.ca/upload.php ( Do NOT upload part of the log, we need the ENTIRE log. The easiest method is through the link provided).
2. Post a message in this thread with your debug log, and with your selected installation method ( Install from zip / Manual install / From repository ) and any other information that might be relevant.

A one line description of some error is practically useless and amounts to nothing more than spam