need help with cookie problem for video plugin
#1
I am writing a plugin for wtso.net(Watch The Simpsons Online).

i am having a problem with cookies though.
script download link
pastebin of the script

The problem is in the last step of grabbing the video url
i am grabbing a episodes html file to for the swf link.
example
http://cold-link.com/vid/3a464818/.swf

it sets a cookie when i retrieve it.
example
Set-Cookie PHPSESSID=7f21cb75e7d0b036fbb8a52098eeab60; path=/
Expires Thu, 19 Nov 1981 08:52:00 GMT

the link actually redirects to
example
http://player.cold-link.com/player.swf?f...ffle=false

It uses the cookie set before the redirect in its header
example
Cookie PHPSESSID=7f21cb75e7d0b036fbb8a52098eeab60

i grab the file parameter from this url like below.
example
http://cold-link.com/xml/2948ab0486eb756...6e7db/.xml

I need to grab this url using the same cookie. The local proxy i use for debugging indicates that the cookie is not getting sent for xml file though. It does however get sent to the redirected url.

I suspect my code is faulty but i am not sure.
does it have to do with the expiration set in the past?

Thanks for any help.
Reply
#2
this is the routine i use.
PHP Code:
def _install_openerself ):
        
# set cookie jar
        
self.cookie_jar cookielib.LWPCookieJar()
        
# load cookie if it exists
        
if ( os.path.isfileself.BASE_COOKIE_PATH ) ):
            
self.cookie_jar.loadself.BASE_COOKIE_PATH )
        
# create the opener object
        
opener urllib2.build_openerurllib2.HTTPCookieProcessorself.cookie_jar ) )
        
# install opener
        
urllib2.install_openeropener 

then i just use the standard urllib2.Request(), request.add_header() and urllib2.urlopen().

you check if cookie exists before you open it, which is good, but you then check it before you save it. which will never save if it doesn't exist.

you also don't call install_opener().
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#3
i already had the cookie file created. i was trying to copy code from another plug in because i didn't understand how the cookielib worked. the documents on it i have been reading just seem to confuse me.

I will try to wrap my head around what you mean and see what i can do. sorry I'm a bit slow =)
Reply

Logout Mark Read Team Forum Stats Members Help
need help with cookie problem for video plugin1