Hi all.  I’ve been learning Python for a few months and just started writing a Plex plugin and have made some good progress.  It essentially gets lists of videos on reddit that people have found interesting in different subreddits.
I have successfully setup categories and can play almost all of the videos, but some videos require that you sign in in order to watch them.  
This is the message I’ll get:
MediaNotAuthorized: (2004, ‘You are not authorized to access this media.’)
I’ve checked the urls for those videos and it is simply a matter of signing in in order to watch them.
Ideally I’d like to be able to add an option to my plugin for a user to login to YouTube, preferably using the functionality that is already in the YouTube plugin, but I don’t know how to go about that.  
Thank you for the help!
Hey,
I’m guessing that your plugin is using the current YouTube URL Service to translate a given URL into the available media items. The problem at the moment is that the URL Service does not handle authentication correctly which results in the above error. This is actually something that a few of us were discussing recently and started making steps to resolve this (https://github.com/plexinc-plugins/Services.bundle/commit/2bb0a179b59cf9f1dbc9edc21dfffd5cd75798ca). I think the current plan is to modify the URL Service to check to see if it has access to the user’s credentials, check the availability of the video and authenticate if required. 
Once this is done, it will then add a requirement for your channel users to provide their username/password, and probably initially via the YouTube channel. This is not ideal but likely to only be a stop gap until we get better channel preference support implemented…
Ian
Thanks for the reply. You probably saved me a day of fumbling around trying to figure out if I can code this on my own. I'll take a look at that github to see if I can understand it.
At the moment, we’ve only made the preferences available to the service. We’ll need to make further changes to the URL service to actually use them. This should allow channel playback for these types of videos, however will not allow these videos to be viewed when queued via the bookmarklet, since the server doing this in the cloud has no access to user details, etc. I’ll ask Sander to see if he was going to make that change soon…
I see, thank you. So there’s no way around that, right? I’m guessing that when Plex tries to play a YouTube video through one of its url services that YouTube tokens or keys are in the headers, and not in the url? I was hoping to bypass it by having some way to store user prefs in my plugin and then add those prefs with some sort of developer key in each url before the url service sees it, but I haven’t looked into the YouTube api and I obviously don’t have a firm grasp on how the url services even work. (I am still reading to learn about them.)
I'm afraid that wont work. I know there are plans to have this working better in the future but can't think of any short term solution for your specific plugin. Let me talk to some of the other channel developers to see if they have any ideas. Channels are essentially sandboxed so it isn't possible to modify another channels/services preferences (yet). I'll query the guy who develops the framework to see if he can think of anything as well....
Ian
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.