How to Develop a Channel with a Login



Hi there,
I am attempting to write a channel plugin for a site that now requires a login.
I'm happy to 'hardcode' the login and password into the code for now, just to get it working.
Are there any good examples of plugin code that use logins? I know it will differ depending on the content provider.

The site is SBS On Demand (Australia) link.

Thanks for your help!


You can add a preferences file to your channel bundle. The Pandora channel does something similar (I'm not sure if the channel still works, but it still works as an example).

See the DefaultPrefs.json file:

You can use the values as Prefs['id-here'] (example)


Thanks! I had read about the preferences file before but that's a good example to see it in action.

What I was really after was an example of how a channel does the authentication - which the do_request function does. Hopefully I can do something similar.


Next question... how do you do an HTTP POST in Python (without importing the requests library)?


Nevermind about the request thing, as I don't need it if I get the below question answered...


And yet another question...
When I have a URL like the following:

... this loads a webpage with a player in it. How can I get Plex to play it?

I have tried both:
IndirectResponse(VideoClipObject, key=url)
return Redirect(url)
... with no luck :neutral:

(Note I picked that SBS On Demand video at random! I have no idea about it's content.)



This may be a tricky part. The url variable you've used in your examples of what you've tried must be a URL of the actual media file and not the webpage URL. Plex channels are half about getting the media URL from the web pages (the other, usually easier half, being navigation) and how exactly it is done, heavily depends on a specific website and could range from 'quite trivial' to 'major PITA'. You need to figure out where does the web page gets a video URL for the player and how to get that in your Plex channel. Sorry if it sounds too uncertain, your site is geo blocked and I can't see its contents to say anything more.


I was afraid you were going to say that :s


I created some basic channel dev support documents that are in a pinned thread at the top of this forum at Channel Plugin Development Support Documents.

In that thread, the Channel Plugin Development Overview document (especially the "Getting Videos from a Website to Play in Your Channel Plugin" section) and the Introduction to URL Services document provide some basic info about what you need to do for your channel plugin media to play in Plex that should at least help you get started.


I'm just starting to read docs for some development I'd like to do, and this seemed like a reasonable place to ask a question I have before I even get started:

Is it possible to have a channel that keeps separate logins per user? For example, if I wanted to add a subscription site to Plex, so that people could search and play its media without leaving Plex, but didn't want my partner to use my account for that site when she has her own and she'd want her playback history to reflect her use, not mine (and vice versa)...

When she opens Plex as her Plex user account and goes to the channel, I'd want it to ask her for her credentials even if I've already gone to the channel and entered mine on my account.

Does anyone know if Plex Channels allow for that?


People use Preferences to store and retrieve user data like username and passwords. But users can only access, enter, and change the Preferences data from the Plex Web app.

And you would have to use the PMS Web API that is discussed in the General (Third-Party Development) section of the forum to request any Plex user data from a plugin.

So, I guess you could program the channel with Preferences that allows for multiple sets of login data and then request the user's Plex login data from the Web API and use that to decide which login data from the Preferences to use.

There is also the InputDirecotryObject(), which allows a user to input data from within the channel plugin. But each InputDirecotryObject() can only request one query or input string and only a few Plex player apps support the InputDirectoryObject(). See Known Plex player app and PMS issues supporting Plugin Framework.


I would also suggest that you first review this thread -, since many websites do not provide the methods necessary to pull user specific data in a Plex channel plugin, like publicly available authentication API or the ability to send the user login data as part of the URL's parameters.