Hey folks, there is a new Podcast category for forums https://forums.plex.tv/categories/podcasts
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!

Finding the video source URL

ChrisTarczonChrisTarczon Posts: 160Members, Plex Pass Plex Pass
I've had limited XPath / Python experience but I thought I'd jump into some existing code and see if I could get a hand on things. I was going to try a plugin for South Park Studios but I can't find the SWF that Plex would need. I just want to get a hard coded one playing before I dig in to parsing episodes and seasons.

The closest URL I could find to an actual episode is this. I'm not sure that would be the right thing anyway since you need to click Play for it to start. Given that URL, Plex logs "Compressed SWF format not supported." It seems like that file may just be a pointer to the actual video. Are some sites just not going to work with this or am I missing something? (I'm assuming the latter!)

Comments

  • jamjam Plex Dev Team Posts: 4,303Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee
    You may want to choose a site other than South Park Studios, it could end up being wasted effort in a few days time... ;)
  • elanelan CTO and Co-founder MauiPosts: 6,981Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee
    I know what it looks like, we're big plug-in hogs...We can't help it, they're easy, fun, and addictive to write :)

    instagram @elan // the wife's photography site.
    the Medium page // the dog's twitter feed.

  • FinxFinx Posts: 38Members
    elan wrote on Feb 26 2009, 10:35 AM:
    I know what it looks like, we're big plug-in hogs...We can't help it, they're easy, fun, and addictive to write :)


    So true. But nice to get to know to Python at the same time :rolleyes:
    YLE Areena plug-in Plex wiki | download
  • ChrisTarczonChrisTarczon Posts: 160Members, Plex Pass Plex Pass
    jam wrote on Feb 26 2009, 04:01 AM:
    You may want to choose a site other than South Park Studios, it could end up being wasted effort in a few days time... ;)


    I can't say I didn't think that was a good possibility! Still I'm interested in getting my bearings with this for the future. Maybe when you (or whoever) finishes, you could let me know how you go about finding the path to each site's videos? Depending on when the doc is coming, that is.
  • jamjam Plex Dev Team Posts: 4,303Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee
    Are you trying to load the SWF directly in Plex? This won't work. The way we get Flash video playing is by loading the entire page in the media server using WebKit (it behaves exactly like loading the page in Safari). We then capture the output of the player and pass it along to Plex.

    If you take a look inside SiteConfigurations.bundle, you'll see the config files for the sites we currently support. You can create your own site configs by adding them to "~/Library/Application Support/Plex Media Server/Site Configurations". Then, to play Flash video in Plex, your plugin needs to send a MediaContainer containing a WebVideoItem back to Plex containing the URL of the page containing the video. If everything's been set up properly, the page will be loaded, the player will be captured & any mouse events you've defined to start the video will be sent.
  • atrusatrus Posts: 11,100Members, Plex Pass, Plex Ninja Plex Ninja
    jam wrote on Feb 26 2009, 05:33 PM:
    Are you trying to load the SWF directly in Plex? This won't work. The way we get Flash video playing is by loading the entire page in the media server using WebKit (it behaves exactly like loading the page in Safari). We then capture the output of the player and pass it along to Plex.

    If you take a look inside SiteConfigurations.bundle, you'll see the config files for the sites we currently support. You can create your own site configs by adding them to "~/Library/Application Support/Plex Media Server/Site Configurations". Then, to play Flash video in Plex, your plugin needs to send a MediaContainer containing a WebVideoItem back to Plex containing the URL of the page containing the video. If everything's been set up properly, the page will be loaded, the player will be captured & any mouse events you've defined to start the video will be sent.

    Jam, you tha man =)
    Can you point me in a direction to a specific app that would be useful to look at when we will try to create an App for www.svtplay.se this weekend? I know you guys are busy as heck, but I see some different solutions for each site and it drives me nuts while Im trying to figure out which app is closest to the ones that we want to write.

    Kick-ass method by the way, I really like your thinking on this framework.
     Mac mini 2,3 GHz Quad-Core Intel Core i7 (With Fusion drive) (PM score: 7347)  Panasonic VT50 (55 inch)  Pioneer VSX-2021 Receiver  Norco 24-bay NAS (CPU: Intel Xeon E3-1240v2 3,4GHz, PM score: 9300) 
    New to Plex/Nine? Watch my screencast video (slightly out-dated nowadays, but still informative for new users)
    Want to know how to handle subtitles? Watch my subtitle screencast video (out-dated, but still informative), and this One Minute Subtitle Addendum screencast
    Always attach log files if you are reporting an issue: Log file info & location
    Get Plex guides here: Howto name your files NAS guide Troubleshooting Plex Support Page
  • jamjam Plex Dev Team Posts: 4,303Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee
    Thanks for the support!! Once things are a bit quieter we'll be releasing updates for the framework that should hopefully reduce the amount of code you need to write even more, and smooth out some code conventions & naming inconsistencies between the different modules. This won't break any existing code, but newer plug-ins will be able to target updated framework versions & benefit from the more streamlined API.

    Yeah, it drove us nuts too working out some of the solutions! They're all very different because the sites all present their information in different ways, so each plug-in targets a site very specifically. Luckily, the awesome lxml library included in the framework makes it very easy to grab content from pages using XPath.

    The best ones for you to check out would probably be Hulu and Joost, as they're the ones that present the most complicated content trees. Which part are you having trouble with? Creating the content tree, or getting data off the site? Yes, we are very busy at the moment as the new releases have generated quite a lot of buzz online, but please feel free to PM or email me if you have any questions - for us, the major part of the plug-in system is that anyone can write plug-ins, and we want to do everything we can to help & encourage developers :) We want to get as many plug-ins in the App Store as possible!

    Oh, and if you haven't got it already, I highly recommend Firefox + the "XPath Checker" extension. This saves SO much time when trying to find the right XPath queries for sites.
  • atrusatrus Posts: 11,100Members, Plex Pass, Plex Ninja Plex Ninja
    jam wrote on Feb 26 2009, 07:29 PM:
    Thanks for the support!! Once things are a bit quieter we'll be releasing updates for the framework that should hopefully reduce the amount of code you need to write even more, and smooth out some code conventions & naming inconsistencies between the different modules. This won't break any existing code, but newer plug-ins will be able to target updated framework versions & benefit from the more streamlined API.

    Yeah, it drove us nuts too working out some of the solutions! They're all very different because the sites all present their information in different ways, so each plug-in targets a site very specifically. Luckily, the awesome lxml library included in the framework makes it very easy to grab content from pages using XPath.

    The best ones for you to check out would probably be Hulu and Joost, as they're the ones that present the most complicated content trees. Which part are you having trouble with? Creating the content tree, or getting data off the site? Yes, we are very busy at the moment as the new releases have generated quite a lot of buzz online, but please feel free to PM or email me if you have any questions - for us, the major part of the plug-in system is that anyone can write plug-ins, and we want to do everything we can to help & encourage developers :) We want to get as many plug-ins in the App Store as possible!

    Oh, and if you haven't got it already, I highly recommend Firefox + the "XPath Checker" extension. This saves SO much time when trying to find the right XPath queries for sites.

    Hmm... where should I right click to get correct Xpath?
     Mac mini 2,3 GHz Quad-Core Intel Core i7 (With Fusion drive) (PM score: 7347)  Panasonic VT50 (55 inch)  Pioneer VSX-2021 Receiver  Norco 24-bay NAS (CPU: Intel Xeon E3-1240v2 3,4GHz, PM score: 9300) 
    New to Plex/Nine? Watch my screencast video (slightly out-dated nowadays, but still informative for new users)
    Want to know how to handle subtitles? Watch my subtitle screencast video (out-dated, but still informative), and this One Minute Subtitle Addendum screencast
    Always attach log files if you are reporting an issue: Log file info & location
    Get Plex guides here: Howto name your files NAS guide Troubleshooting Plex Support Page
  • jamjam Plex Dev Team Posts: 4,303Members, Plex Employee, Plex Pass, Plex Ninja Plex Employee
    It saves time mostly by matching as you type & giving you an instant preview of what items will be returned.
  • FinxFinx Posts: 38Members
    edited February 2009
    I have used FireBug extension to check XPaths... works as well. Though, I noticed that if I try to use too long absolute XPath I might run into problems. One neat feature in XPath, I found, is to find the specific element by its attribute, like this:
    xpath("//div[@class='video']")
    

    I had some problems with elements having multiple classes, though. But I found a solution. This finds all divs that are have a 'video' class declared:
    xpath("//div[contains(@class, 'video')]")
    


    Happy XPathing!

    edit: typos
    YLE Areena plug-in Plex wiki | download
Sign In or Register to comment.