PBA Xtra Frame

Hi All!



I’m working on developing a plugin for PBA’s Xtra Frame (http://xtraframe.pba.com) service. I’m currently having some issues figuring out how to get the Plex Media Server to accept cookies (not having to log in via Safari).



Right now, what is happening is that I am having to re-query for a login to scrape the website. I’m not entirely sure that my Site Configuration works at all, since everytime that I go to grab it, I get the default authentication page and cannot continue. (Verified using Charles.app)



How can I ensure that the cookies that are passed stay with the system so I can leverage when using a Site Configuration?



Unfortunately, I cannot find any forum posts, and the current dev documentation does not seem to address.



Thoughts? Any/all help is much appreciated.



My code looks like this:



<br />
def GetVideoList(cat):<br />
    loginCheck = SignIn()<br />
    if (loginCheck != True):<br />
	    PMS.Log("Unable to Retrieve Video Item")<br />
	    return MessageContainer("No items available", "There are no items available.")<br />
<br />
.... video scraper code here ...<br />
<br />
def CheckLogin():<br />
    try:<br />
        cookies = Cookie.SimpleCookie(HTTP.GetCookiesForURL(WEBROOT))<br />
        if cookies["XtraFrameUser"].value != '':<br />
            return True<br />
    except (Cookie.CookieError, KeyError):<br />
        return False<br />
<br />
def SignIn():<br />
    if CheckLogin():<br />
        PMS.Log("Login - Already logged in")<br />
        return True<br />
<br />
    username = Prefs.Get('username')<br />
    password = Prefs.Get('password')<br />
    if not (username and password):<br />
        PMS.Log('username or password is empty')<br />
        return False<br />
<br />
    req = XML.ElementFromURL(WEBROOT, True)<br />
<br />
    eventvalidation = None<br />
    viewstate = None<br />
<br />
    eventvalidation = req.xpath('//input[@type="hidden"][@name="__EVENTVALIDATION"]/@value')<br />
    viewstate = req.xpath('//input[@type="hidden"][@name="__VIEWSTATE"]/@value')<br />
    <br />
    PMS.Log('signing in...')<br />
<br />
    params = {<br />
        '__EVENTVALIDATION': eventvalidation[0],<br />
        '__VIEWSTATE': viewstate[0],<br />
        'LoginWebUserControl:userName': username,<br />
        'LoginWebUserControl:password': password,<br />
        'LoginWebUserControl:LoginButton': 'LOGIN'<br />
		}<br />
<br />
    resp = HTTP.Request(WEBROOT + "/Default.aspx", values=params, cacheTime=CACHE_INTERVAL)<br />
<br />
    if CheckLogin():<br />
        PMS.Log("Login - Success")<br />
        return True<br />
    else:<br />
        PMS.Log("Login - Failed -Response '%s'" % (resp))<br />
        return False<br />





<br />
<site site="http://xtraframe.pba.com"<br />
      plugin="silverlight"<br />
      initialState="paused"<br />
      version="1.0"><br />
      <br />
      <!-- Seekbar --><br />
      <seekbar type="thumb"><br />
        <start x="175" y="344" /><br />
        <end x="265" y="344" /><br />
        <played><br />
            <color rgb="414141" /><br />
        </played><br />
      </seekbar><br />
      <br />
      <!-- Playing --><br />
      <state name="playing"><br />
        <event><br />
            <condition><br />
                <command name="pause" /><br />
            </condition><br />
            <action><br />
                <click x="110" y="344" /><br />
                <goto state="paused" /><br />
            </action><br />
        </event><br />
       </state><br />
       <br />
       <!-- Paused --><br />
       <state name="paused"><br />
        <event><br />
            <condition><br />
                <command name="play" /><br />
            </condition><br />
            <action><br />
                <click x="110" y="344" /><br />
                <goto state="playing" /><br />
            </action><br />
        </event><br />
       </state><br />
</site><br />


I’ve solved this problem by using the setCookie method within my Site Configuration. It’s hacky, but it works! :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.