#1
|
|||
|
|||
Jdownloader API approach to add video to linkcrawler, start download and delete then
Hey Guys,
I am currently trying to get this usecase to work. I want to add a tiktok link to the linkcrawler. I do that using: Code:
linkgrabberv2/addLinks?query= I then take the id that is coming back from that request as the jobID. With that jobId I am calling Code:
/downloadsV2/queryLinks?queryParams= I execute that over and over until I get a response that then has the packageuuid, meaning that link moved to the download list. Now I am calling Code:
downloadsV2/queryLinks?queryParams= With that I am trying to wait until that package is downloaded completely and then take action on the downloaded package. This works fine so far, even tho that does not feel really optimized, with how to get those IDs and checking the status. Then after I am done with getting the video and moving it somewhere, I want to clean the download list. I am calling Code:
downloadsV2/cleanup But even tho I set the packakgeId/UUID, everything from the download list is removed, even other packages. What's the issue here. Another question that seriously haunts me: Why is it called UUID here, and then ID there. That ID also is never an actual uuid, I guess it is just the creation timestamp in seconds. Thanks for any help and suggestions in advance. |
#2
|
||||
|
||||
@AnanasXpress: I would recommend different approach!
1.) do not use autostart 2.) wait for jobID to finish, via linkgrabberv2/queryLinkCrawlerJobs 3.) then query all link uuids from this job via linkgrabberv2/queryLinks and the jobID 4.) remove/manage those links (eg delete offline or other stuff) 5.) move those link uuids to download list via linkgrabberv2/moveToDownloadlist 6.) then you can start/manage your links 7.) then query all link uuids from this job via down downloadsV2/queryLinks via their uuids 8.) after downloads you can remove the links via downloadsV2/removeLinks and the link uuids 8.1) or use downloadsV2/cleanup Quote:
You want to use SelectionType=SELECTED (only those packages/links you specify) You just specify link uuids and JDownloader will auto remove empty packages. Quote:
Different naming because API has grown and now it's used/known that way You can also use "Namespace /events" and add listener and get informed/pushed status updates instead of polling.
__________________
JD-Dev & Server-Admin Last edited by Jiaz; 20.08.2024 at 14:04. |
#3
|
|||
|
|||
Okay thanks for the reply, I will try that approach.
I think the deletion is not that intuitive, if one thing can overwrite another parameter but as long as that works I will be fine. |
#4
|
||||
|
||||
Quote:
For me it's very clear that ALL= ALL SELECTED = only the selected, UNSELECTED(not supported via API)= everything that is not selected NONE = none That way you can easily handle thousands and millions of links, and yes, such users do exist!
__________________
JD-Dev & Server-Admin |
#5
|
|||
|
|||
Okay so I implemented the approach and I feel like for a moment that worked fine, with waiting for the links to be in the linkcrawler and moving them to the download list and starting them there. However now I have some in my eyes weird behaviour after the download starts:
After the download starts I am calling: /downloadsV2/queryLinks?queryParams= with Code:
{ availability: true, bytesTotal: true, finished: true, enabled: true, jobUUIDs:[jobId], status: true } The first time I call the API I am getting this response, which is good: Code:
data: [ { name: '2024-07-30_@rettet_die_tiere10_7397312923682524449.mp4', statusIconKey: 'run', packageUUID: 1724263522817, uuid: 1724263522720, bytesTotal: 8089022, enabled: true, status: 'Starte...' } ] This happens if I have a single Video on tiktok as well as when it downloads a mp3 and mp4 in one package. In that case most of the times only the mp4 disappears :D Do I set a wrong flag again? For me the params here are what I want to get back from the query, no? What I am wondering here now anyway is: Is there a way to ask for the status by linkid? /queryPackages takes packageIds but queryLinks takes jobIds. I feel like direclty querying for the linkid could prevent the missing links. Thanks for the help so far and looking forward to your answer |
#6
|
||||
|
||||
@AnanasXpress: Thanks for the feedback.
I was under the impression that it is alread possible to queryLinks with link ids but I was wrong. I will add support for this so you can specify job-,package,link id(s) ! I will ping you here once it is available You should also check out relative new advanced status features in queryLinks call with Quote:
__________________
JD-Dev & Server-Admin Last edited by Jiaz; 21.08.2024 at 22:05. |
#7
|
||||
|
||||
Found the cause, will be fixed with next update. Thanks for the report.
__________________
JD-Dev & Server-Admin |
#8
|
|||
|
|||
Man, you are quick. Thanks for the reply, I will definitely look into the advancedStatus feature and I'm looking forward to the update
Have a nice day/evening |
#9
|
||||
|
||||
Always happy when someone is using the api and providing feedback You're welcome!
__________________
JD-Dev & Server-Admin |
#10
|
||||
|
||||
Thanks for the report. Helped to find a bug in some plugins so this and other meta information might get lost.
__________________
JD-Dev & Server-Admin |
#11
|
||||
|
||||
@AnanasXpress: with next core update you will be able to use queryLinks with linkUUIDs:[..]. Please know that when setting linkUUIDs, packages and/or packages+jobUUIDs won't be processed but only linkUUIDs. So either set linkUUIDs or packageUUIDs and/or jobUUID
__________________
JD-Dev & Server-Admin |
#12
|
|||
|
|||
Amazing News *_*
Is there a rough estimation when the update will go live? Thank you very much |
#13
|
||||
|
||||
I do my best to release it by tomorrow, else beginning of next week as I will be in holidays then and not available at the weekend.
__________________
JD-Dev & Server-Admin |
#14
|
||||
|
||||
@AnanasXpress: Update is available Please test and provide feedback
__________________
JD-Dev & Server-Admin |
#15
|
||||
|
||||
CORE-Updates have been released!
All announced bugfixes and features are live! Please update your JDownloader and report any issues you find asap. If this thread gets marked as "[Solved]" by our forum staff you can still post in it and we will read- and reply to it! CORE-Updates wurden released! Alle angekündigten Bugfixes/Features sind nun verfügbar! Bitte JDownloader updaten und eventuelle Bugs schnellstmöglich an uns melden. Falls dieser Thread vom Team als "[Erledigt]" markiert wird, kannst du weiterhin darin antworten und wir lesen/beantworten auch solche Threads! -psp-
__________________
JD Supporter, Plugin Dev. & Community Manager
Erste Schritte & Tutorials || JDownloader 2 Setup Download |
#16
|
|||
|
|||
Thanks for the update, it works like a charm. I was able to use queryLinks with linkUUiDs and so far there were no missing videos.
However another question turned up but I think it is desired behaviour: The jobId returned from addLinks is not constant. So if I call addLinks with two different links after another, I am getting different jobIds with both, but whatever job is done crawling first is getting the jobId of the job that was started first, if you understand what I mean. So basically jobId is getting reassigned, is that expected behaviour? Now I am waiting that queryLinkCrawlerJobs is done, before calling addLinks with another link which solves the problem, but I am curious why jobId is getting reassigned Have a nice vacation and thanks for the fixes! Edit: I noticed the api doc wasn't updated yet regarding linkUUIDs, that might help others. |
#17
|
||||
|
||||
Once Jiaz finds the time, he will reply here.
__________________
JD Supporter, Plugin Dev. & Community Manager
Erste Schritte & Tutorials || JDownloader 2 Setup Download |
Thread Tools | |
Display Modes | |
|
|