Page 1 of 1

Help with api addurl

Posted: November 23rd, 2008, 12:28 am
by xxhds
Hi,

I am working on modifying popcornarsonist's autodownload script to fit my needs.  Mainly, use nzbs.org instead of newzbin since I dont have an account there and do not want to pay to search.  I can't get the api to add the download url's.  Using a link from tvnzb works fine but not nzbs.  Im thinking it has to do with the &'s or something.  Putting the url into the web interface works fine.  I tried using quotes and that didnt help.  Anyone got any ideas?


works:  http://192.168.7.144:7777/sabnzbd/api?m ... /nzb/15101

doesnt work: 
http://192.168.7.144:7777/sabnzbd/api?m ... &h=REMOVED

Thanks a lot!
~xxhds

Re: Help with api addurl

Posted: November 23rd, 2008, 12:39 am
by switch
The url needs to be properly encoded since it contains &'s and other characters.


Try:

Code: Select all

http://192.168.7.144:7777/sabnzbd/api?mode=addurl&name=http%3A//www.nzbs.org/index.php%3Faction%3Dgetnzbnzbid%3D136254%26i%3D0000%26h%3D00000000000
May be a bit overboard, you can try just replacing
& with %3D
and ? with %3F

Re: Help with api addurl

Posted: November 23rd, 2008, 12:51 am
by xxhds
Thanks alot.  That did the trick :)


msgid=re.sub("\?", "%3F", msgid)
msgid=re.sub("=", "%3D", msgid)
msgid=re.sub("&", "%26", msgid)

Re: Help with api addurl

Posted: November 23rd, 2008, 2:01 am
by switch
yep, either that or just:
msgid = urlllib.quote(msgid)