mmarquezs / My.Jdownloader-API-Python-Library

My.Jdownloader API Python Library
MIT License
84 stars 36 forks source link

Compatibility with the depprecated API #50

Closed slarrain closed 2 years ago

slarrain commented 2 years ago

Hi,

Is this package compatible with the deprecated API? I have JDownloader running in a NAS on my LAN, so I can use the Deprecated API to connect directly without going through encription nor an external server. I've been trying to user the linkgrabberv2/addLinks endpoint with requests but I have been unsuccessful. I was thinking that maybe this package could work, but by looking at the code it doesn't seem so.

This is what I have been trying to do:

payload = {
'assignJobID': True,
 'autoExtract': False,
 'autostart': True,
 'dataURLs': [],
 'deepDecrypt': True,
 'destinationFolder': '',
 'downloadPassword': '',
 'extractPassword': '',
 'links': 'https://downmagaz.net/out.php?f=x&down=7751125400',
 'overwritePackagizerRules': True,
 'packageName': 'test',
 'priority': 'DEFAULT',
 'sourceUrl': ''
}
posturl = "http://NAS_IP:3128/linkgrabberv2/addLinks"

r = requests.post(
    posturl, 
    data=payload,
    headers={"Content-Type": "application/json; charset=utf-8"}
                 )

and I always get a 400 with

{
 "src"  : "DEVICE",
 "data" : "/linkgrabberv2/addLinks",
 "type" : "BAD_PARAMETERS"
}

I've tried multiple variations of data=json.dumps(payload) and so on. Nothing seems to work. Any ideas?

Thank you in advance.

mmarquezs commented 2 years ago

No, it's all based on the the new API using my.jdownloader.org website.

That said, the API supports direct connections without going to my.jdownloader if it can connect to it and after the account has validated with my.jdownloader.org. The support for this was added in this PR https://github.com/mmarquezs/My.Jdownloader-API-Python-Library/pull/9 and mentioned in this issue https://github.com/mmarquezs/My.Jdownloader-API-Python-Library/issues/8#issuecomment-323521115 . So unless there is a bug or something is blocking the connection most of the requests will be sent locally.

That said... I can understand not wanting to have an account at my.jdownloader and so on.... but unfortunately this library currently doesn't support the old API. I am open to PR for adding support for it, but I don't use the library at all currently so except for small stuff or bug fixes I am not planning on doing big implementations.