If you have not already, we suggest setting your Plex username to something else rather than email which is displayed on your posts in forum. You can change the username at https://app.plex.tv/desktop#!/account
Welcome to our forums! Please take a few moments to read through our Community Guidelines (also conveniently linked in the header at the top of each page). There, you'll find guidelines on conduct, tips on getting the help you may be searching for, and more!

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!

Best Answer

Answers

  • celeste.andrewceleste.andrew Posts: 9Members ✭✭

    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.

  • celeste.andrewceleste.andrew Posts: 9Members ✭✭

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

  • celeste.andrewceleste.andrew Posts: 9Members ✭✭
    edited September 10

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

  • celeste.andrewceleste.andrew Posts: 9Members ✭✭

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

    https://www.sbs.com.au/ondemand/video/single/353161795529

    ... 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)
    and...
    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.)

  • czukowskiczukowski Posts: 143Members ✭✭✭

    @celeste.andrew

    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.

  • celeste.andrewceleste.andrew Posts: 9Members ✭✭

    I was afraid you were going to say that :s

  • shopgirl284shopgirl284 Posts: 2,782Members, Plex Pass, Plex Ninja, Forum Moderator Plex Ninja

    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.

    Many issues and questions can be resolved by reviewing the Plex Support Documentation
    Providing details about your issue, Plex setup, and including log files are important when when asking for help on the forums.
    See Log Files
    Before posting channel plugin questions or issues, please review the pinned threads at the top of the Channel Plugin forum:
    READ FIRST: Guidelines for Posting Channel Plugin Issues/Questions and Things to Check First
    FAQ for Channel Plugin FAQ

  • apiontekapiontek Posts: 39Members, Plex Pass Plex Pass

    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?

  • shopgirl284shopgirl284 Posts: 2,782Members, Plex Pass, Plex Ninja, Forum Moderator Plex Ninja

    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.

    Many issues and questions can be resolved by reviewing the Plex Support Documentation
    Providing details about your issue, Plex setup, and including log files are important when when asking for help on the forums.
    See Log Files
    Before posting channel plugin questions or issues, please review the pinned threads at the top of the Channel Plugin forum:
    READ FIRST: Guidelines for Posting Channel Plugin Issues/Questions and Things to Check First
    FAQ for Channel Plugin FAQ

  • shopgirl284shopgirl284 Posts: 2,782Members, Plex Pass, Plex Ninja, Forum Moderator Plex Ninja

    I would also suggest that you first review this thread - https://forums.plex.tv/discussion/290538/code-for-logging-in-to-certain-channels, 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.

    Many issues and questions can be resolved by reviewing the Plex Support Documentation
    Providing details about your issue, Plex setup, and including log files are important when when asking for help on the forums.
    See Log Files
    Before posting channel plugin questions or issues, please review the pinned threads at the top of the Channel Plugin forum:
    READ FIRST: Guidelines for Posting Channel Plugin Issues/Questions and Things to Check First
    FAQ for Channel Plugin FAQ

Sign In or Register to comment.