JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1  
Old 13.09.2015, 17:24
Zordon Zordon is offline
JD Alpha
 
Join Date: Jun 2010
Posts: 21
Default Adding multiple Links via MyJdownloader. Links separator?

I want to add multiple links via the MyJdwonloader API.
I found this API class for php: **External links are only visible to Support Staff****External links are only visible to Support Staff**
Im also looking at the doc: **External links are only visible to Support Staff****External links are only visible to Support Staff**

It works when I add one link, but multiple links fail.
Here an example request:
{"url":"/linkgrabberv2/addLinks","params":["{"priority":"DEFAULT","links":"**External links are only visible to Support Staff**,"autostart":true, "packageName": "test"}"],"rid":1442154803,"apiVer":1}{
"data" : "",
"rid" : 1442154803
}


As soon as I add 2 or more links, they get separated by "," and look like this (a string variable with the links separated by comma):
"links":"**External links are only visible to Support Staff**

BUT with some hosters (for example HDStream.to) then only the first links gets parsed correctly by JD. All following ones have the comma as part of their URL and are therefore considered offline.

This bug is not present on the Webinterface of MyJD. So how do you separate links there?
I also tried separating them by "\r\n". But then JD simply does not add anything.
Reply With Quote
  #2  
Old 13.09.2015, 17:36
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 75,053
Default

Use NewLines and Don't forget to proper escape your json (in case you create it by manually)
__________________
JD-Dev & Server-Admin
Reply With Quote
  #3  
Old 13.09.2015, 17:49
Zordon Zordon is offline
JD Alpha
 
Join Date: Jun 2010
Posts: 21
Default

Fixed. Thank you

To others struggeling:
If you have an array of links:
$links = implode( "\\r\\n", $array);
You have to use 2 backslashes on it.

Then you can build your json via with the json_encode() encode function afterwards:
Code:
$params = array("autostart" => false,
        		"links" => $links,
        		"packageName" => $package_name,
        		"extractPassword" => empty($extractPassword) ? null : $extractPassword,
        		"priority" => "DEFAULT",
        		"downloadPassword" => empty($downloadPassword) ? null : $downloadPassword,
        		"destinationFolder" => null);
$params = json_encode($params);

Last edited by Zordon; 13.09.2015 at 17:51.
Reply With Quote
  #4  
Old 13.09.2015, 19:50
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 75,053
Default

Thanks for the feedback!
__________________
JD-Dev & Server-Admin
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 21:40.
Provided By AppWork GmbH | Privacy | Imprint
Parts of the Design are used from Kirsch designed by Andrew & Austin
Powered by vBulletin® Version 3.8.10 Beta 1
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.