| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
JDownloader2 plugin with a local HTTP API to add new files for download
This plugin is loaded by JDownloader2, which then starts up an embedded Jetty HTTP server to receive
From there, just about anything can send requests to queue up a new link. I like to use Tampermonkey userscripts to scrape links directly from web pages as I browse.
Note: it binds to your IP address, therefore other PCs on the network can add links. Configure a password or update the code to bind to something else - there is not currently a way configure local-only access. This plugin also accepts all Origins over ajax.
{
"settings" : true,
"configInterface" : "org.jdownloader.extensions.httpAPI.HttpAPIConfig",
"quickToggle" : false,
"headlessRunnable" : true,
"description" : "Http API.",
"lng" : "en_US",
"iconPath" : "folder_add",
"linuxRunnable" : true,
"macRunnable" : true,
"name" : "HTTP API",
"version" : -1,
"windowsRunnable" : true,
"classname" : "org.jdownloader.extensions.httpAPI.HttpAPIExtension",
"jarPath" : "/absolute/path/to/jd2/extensions/JDHttpApi.jar"
}
Note: there is no official extension install process, so most of this is tricking JD into thinking the JAR is already installed. It's possible that an update will trigger a cache invalidation that boots out this extension. Just reapply the steps above and you should get it back.
This plugin has four settings to configure through the JDownloader GUI. In order to make changes take effect, disable and then re-enable the extension.
There is currently only one URL: /addLink. You may submit via POST or GET.
There are three parameters, only url is required:
The response has three possible values:
On success: {"success":true} On malformed input: {"errorMessage":"some error message"} On authentication failure: Login to access API (this is not JSON)
CURL Examples:
curl 'http://localhost:8297/addLink?url=https://i.imgur.com/muChjiN.jpg' curl 'http://localhost:8297/addLink?url=https://i.imgur.com/muChjiN.jpg&packageName=cutebunny&forcePackageName=true'
Send a JSON object via POST with the same values as in the GET request:
curl -X POST 'http://localhost:8297/addLink' \
-d '{"url":"https://i.imgur.com/muChjiN.jpg"}'
curl -X POST 'http://localhost:8297/addLink' \
-d '{"url":"https://i.imgur.com/muChjiN.jpg","packageName":"cutebunny","forcePackageName":true}'
If you choose to use a password, send it as the password portion of HTTP Basic Authentication - leave the username blank.
CURL Example:
curl -u ':mypassword' 'http://192.168.1.7:8297/addLink?url=https://i.imgur.com/muChjiN.jpg'
curl -u ':mypassword' -X POST 'http://localhost:8297/addLink' \
-d '{"url":"https://i.imgur.com/muChjiN.jpg"}'
JDownloader2's extension system is surprisingly modular and easy to understand (aside from the install process). Feel free to use this project as an example for building other JD extensions as even the built-in ones are a bit more complex than this. Just make sure to have the source code open up in another window for reference - there is virtually no documentation available and this project only uses the bare minimum of features.
| Back | FazBrowse Home | New Git URL |