#1
|
|||
|
|||
any working cli tool for linux using the API
Hi, i just learned that there is an api for jd, and i'm wondering if there is any tool (maybe third party) that has basic functionality like checking download status from linux terminal, maybe in python or javascript.... or anything?
My google search didn't get much results... |
#2
|
||||
|
||||
@kkkira: you can find several third party api clients on github, search for "github myjdownloader"
github.com/search?q=myjdownloader You can also write own clients yourself or own tools based on other clients, see docs my.jdownloader.org/developers/index.html In case you need help/got questions, just ask
__________________
JD-Dev & Server-Admin |
#3
|
|||
|
|||
Thanks!! how simply, my search terms where a little more complicated lol...
where do i get an api key? |
#4
|
||||
|
||||
just use your email or github project or anything we can use to contact you in case your client/tool is getting messy
__________________
JD-Dev & Server-Admin |
#5
|
|||
|
|||
Here it is a little script using a python fork of the API, I use it with a python shebang for linux, but you can modify that
https://bit.ly/3sHqjy5 feel free to modify and add functionality, just let me know to test |
#6
|
||||
|
||||
@kkkira: thanks for sharing your script
__________________
JD-Dev & Server-Admin |
#7
|
|||
|
|||
new version:
Code:
#!/usr/bin/python3 #Jdownloader wrapper V2.0 #necessary #pip3 install myjdapi def main(): import myjdapi, datetime, json from sys import exit import argparse parser = argparse.ArgumentParser() deb = "dev" #jdownloader instance jd=myjdapi.Myjdapi() jd.connect("user","pass") jd.update_devices() try: device=jd.get_device("JDownloader@" + dev) except myjdapi.exception.MYJDDeviceNotFoundException: print(json.dumps({"message":"device not found"})); exit() #downloads full_query = device.downloads.query_packages([{ "bytesLoaded" : True, "bytesTotal" : True, "comment" : False, "enabled" : True, "eta" : True, "priority" : False, "finished" : True, "running" : True, "speed" : True, "status" : True, "childCount" : True, "hosts" : True, "saveTo" : False, "maxResults" : -1, "startAt" : 0, "statusIconKey" : False, "uuid" : True, }]) if len(full_query) == 0 : print(json.dumps({"message":"No downloads found!"})); exit() #parsing downloads = [] for download in full_query: download_info = { "uuid": download["uuid"], "name": download["name"], "hosts": download["hosts"][0] if "hosts" in download and len(download["hosts"]) > 0 else "", "childCount": download.get("childCount", ""), "eta": download.get("eta", ""), "speed": download.get("speed") / (2**20) if "speed" in download else "", "bytesLoaded": download.get("bytesLoaded", "") / 1000000, "bytesTotal": download.get("bytesTotal", "") / 1000000, } downloads.append(download_info) # print the final JSON structure print(json.dumps(downloads)) if __name__ == '__main__': main() Last edited by pspzockerscene; 05.04.2023 at 18:10. Reason: Added CODE tag |
#8
|
|||
|
|||
@kkkira: Thanks for the updated version.
|
Thread Tools | |
Display Modes | |
|
|