Help with api addurl

Get help with all aspects of SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
xxhds
Release Testers
Release Testers
Posts: 15
Joined: October 11th, 2008, 8:16 pm
Contact:

Help with api addurl

Post 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
Last edited by switch on November 23rd, 2008, 12:39 am, edited 1 time in total.
User avatar
switch
Moderator
Moderator
Posts: 1380
Joined: January 17th, 2008, 3:55 pm
Location: UK

Re: Help with api addurl

Post 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
xxhds
Release Testers
Release Testers
Posts: 15
Joined: October 11th, 2008, 8:16 pm
Contact:

Re: Help with api addurl

Post by xxhds »

Thanks alot.  That did the trick :)


msgid=re.sub("\?", "%3F", msgid)
msgid=re.sub("=", "%3D", msgid)
msgid=re.sub("&", "%26", msgid)
User avatar
switch
Moderator
Moderator
Posts: 1380
Joined: January 17th, 2008, 3:55 pm
Location: UK

Re: Help with api addurl

Post by switch »

yep, either that or just:
msgid = urlllib.quote(msgid)
Post Reply