PDA

View Full Version : username:password urls


JaniL
2008-10-18, 17:22
Okay so my first script is almost completely done but it has this bug that forces users to change password something that doesn't contain punctuation before using this plugin.

So if password has punctuation something like that there's in the start or end of password some punctuation, it cannot find the right address to resolve.

This might be basic python question, not relative to xbmc but i asked here anyways.. Sorry. :D

urlii = 'http://%s:%s@www.tvkaista.fi/netpvr/Download/%s.%s' % (xbmcplugin.getSetting("username"), xbmcplugin.getSetting("password"), progurl, bitrate)

althekiller
2008-10-18, 19:15
URL encode the uname and pass?

JaniL
2008-10-18, 19:50
Didn't get it but taking a look on functions of urllib found me solution to my problem. Thanks! :laugh:

JaniL
2008-10-19, 22:34
Sorry if posting doubles isn't allowed but this is necessary that topic would get attention again.

It seems that my solution works on Windows, but not on Xbox.

I modfied variable of url to this which became the solution of the previous problem:
urlii = 'http://%s:%s@www.tvkaista.fi/netpvr/Download/%s.%s' % (urllib.quote(xbmcplugin.getSetting("username")), urllib.quote(xbmcplugin.getSetting("password")), urls, bitrate())

22:22:38 M: 31887360 DEBUG: msg: Authentication required for "TVkaista"
22:22:38 M: 31887360 DEBUG: msg: Authentication failed. Please use the -user and -passwd options to provide your
username/password for a list of URLs, or form an URL like:
http://username:password@hostname/file
And it works on xbox if password hasn't got punctutation in the start/end.

rwparris2
2008-10-19, 22:57
What exactly is the xbox's output when you do urllib.quote(xbmcplugin.getSetting("username"))? use print or xbmc.log to figure it out. If it is correctly changing the string then you've got a problem elsewhere.

Is it only punctuation at the start/end, or can it be anywhere?
What exactly is the punctuation? If it is non-ascii characters, that MIGHT be a problem? Not really sure there as I've only programed for English.

JaniL
2008-10-21, 13:08
Okay it seems that it can authenticate properly because it forwards to it's right address:
22:22:35 M: 40005632 DEBUG: Curl:: Debug About to connect() to www.tvkaista.fi port 80 (#0)
22:22:35 M: 40005632 DEBUG: Curl:: Debug Trying 93.90.50.252...
22:22:35 M: 40005632 DEBUG: Curl:: Debug connected
22:22:35 M: 40005632 DEBUG: Curl:: Debug Connected to www.tvkaista.fi (93.90.50.252) port 80 (#0)
22:22:35 M: 40005632 DEBUG: Curl:: Debug Server auth using Basic with user 'username'
22:22:35 M: 40005632 DEBUG: Curl:: Debug HEAD /netpvr/Download/431588.h264 HTTP/1.1

Authorization: Basic ************************

User-Agent: XBMC/pre-2.1 (compatible; MSIE 6.0; Windows NT 5.1; WinampMPEG/5.09)

Host: www.tvkaista.fi

Accept: */*
22:22:36 M: 40005632 DEBUG: Curl:: Debug HTTP/1.1 302 Moved Temporarily
22:22:36 M: 40005632 DEBUG: Curl:: Debug Server: Apache-Coyote/1.1
22:22:36 M: 40005632 DEBUG: Curl:: Debug Set-Cookie: JSESSIONID=*********************************; Path=/netpvr
22:22:36 M: 40005632 DEBUG: Curl:: Debug Location: http://transcode4.tvkaista.fi/recorder/ResourceLoader?session=******-*************&file=431588.2M.mp4&outputfilename=Idols_25.09.2008_MTV3_431588.2M.mp4
22:22:36 M: 40005632 DEBUG: Curl:: Debug Content-Type: text/html;charset=UTF-8
22:22:36 M: 40005632 DEBUG: Curl:: Debug Content-Language: fi-FI
22:22:36 M: 40005632 DEBUG: Curl:: Debug Content-Length: 0
22:22:36 M: 40005632 DEBUG: Curl:: Debug Date: Sun, 19 Oct 2008 19:22:52 GMT
22:22:36 M: 40005632 DEBUG: Curl:: Debug
22:22:36 M: 40005632 DEBUG: Curl:: Debug Connection #0 to host www.tvkaista.fi left intact
22:22:36 M: 40005632 DEBUG: Curl:: Debug Issue another request to this URL: 'http://transcode4.tvkaista.fi/recorder/ResourceLoader?session=******-*************&file=431588.2M.mp4&outputfilename=Idols_25.09.2008_MTV3_431588.2M.mp4 '
22:22:36 M: 40005632 DEBUG: Curl:: Debug Disables POST, goes with HEAD
22:22:36 M: 40005632 DEBUG: kernel32.dll fake function GetFullPathNameA called
22:22:36 M: 40005632 DEBUG: Curl:: Debug About to connect() to transcode4.tvkaista.fi port 80 (#1)
22:22:36 M: 40005632 DEBUG: Curl:: Debug Trying 93.90.50.221...
22:22:36 M: 40005632 DEBUG: Curl:: Debug connected
22:22:36 M: 40005632 DEBUG: Curl:: Debug Connected to transcode4.tvkaista.fi (93.90.50.221) port 80 (#1)
22:22:36 M: 40005632 DEBUG: Curl:: Debug HEAD /recorder/ResourceLoader?session=******-*************&file=431588.2M.mp4&outputfilename=Idols_25.09.2008_MTV3_431588.2M.mp4 HTTP/1.1

User-Agent: XBMC/pre-2.1 (compatible; MSIE 6.0; Windows NT 5.1; WinampMPEG/5.09)

Host: transcode4.tvkaista.fi

Accept: */*
22:22:36 M: 40005632 DEBUG: Curl:: Debug HTTP/1.1 200 OK
22:22:36 M: 40005632 DEBUG: Curl:: Debug Server: Apache-Coyote/1.1
22:22:36 M: 40005632 DEBUG: Curl:: Debug Accept-Ranges: bytes
22:22:36 M: 40005632 DEBUG: Curl:: Debug Content-Disposition: inline; filename=Idols_25.09.2008_MTV3_431588.2M.mp4
22:22:36 M: 40005632 DEBUG: Curl:: Debug Content-Type: video/mp4
22:22:36 M: 40005632 DEBUG: Curl:: Debug Content-Length: 794071120
22:22:36 M: 40005632 DEBUG: Curl:: Debug Date: Sun, 19 Oct 2008 19:22:53 GMT
22:22:36 M: 40005632 DEBUG: Curl:: Debug
22:22:36 M: 40005632 DEBUG: Curl:: Debug Connection #1 to host transcode4.tvkaista.fi left intact
22:22:37 M: 31887360 DEBUG: msg: Filename for url is now http://username:password@www.tvkaista.fi/netpvr/Download/431588.h264
22:22:37 M: 31887360 DEBUG: msg: Filename for url is now
22:22:37 M: 31887360 DEBUG: msg: Not an URL!