JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1  
Old 20.08.2024, 13:13
AnanasXpress AnanasXpress is offline
Baby Loader
 
Join Date: Aug 2024
Posts: 6
Default 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=
with assignJobID = true and autostart also = true.

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=
with jobUUIDS = [jobId].

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 packageUUIDs = [packageUUID] and finished = true.

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
I have linkIds set to [], packageIds = [packageUUID], action = DELETE_FINISHED, mode = REMOVE_LINKS_ONLY and selectionType=ALL.

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.
Reply With Quote
  #2  
Old 20.08.2024, 13:52
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 80,977
Default

@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:
Originally Posted by AnanasXpress View Post
I have linkIds set to [], packageIds = [packageUUID], action = DELETE_FINISHED, mode = REMOVE_LINKS_ONLY and selectionType=ALL.
But even tho I set the packakgeId/UUID, everything from the download list is removed, even other packages. What's the issue here.
Because you use SelectionType=ALL -> ALL so you don't have to specify thousands/millions of IDs
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:
Originally Posted by AnanasXpress View Post
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.
It's called UUID because it's "JDownloader instance 'universal' unique identifier" Has nohing to do with UUID(Universally Unique Identifier). It's unique for that running JDownloader instance. Internally it's creation timestamp of that UUID :p guaranteed to be unique within that JDownloader instance.
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.
Reply With Quote
  #3  
Old 20.08.2024, 14:00
AnanasXpress AnanasXpress is offline
Baby Loader
 
Join Date: Aug 2024
Posts: 6
Default

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.
Reply With Quote
  #4  
Old 20.08.2024, 14:08
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 80,977
Default

Quote:
Originally Posted by AnanasXpress View Post
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.
That's what SelectionType is for. And depends on the view of point
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
Reply With Quote
  #5  
Old 21.08.2024, 20:23
AnanasXpress AnanasXpress is offline
Baby Loader
 
Join Date: Aug 2024
Posts: 6
Default

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...'
    }
  ]
However once the download is done, the data array is just empty :(

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
Reply With Quote
  #6  
Old 21.08.2024, 21:58
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 80,977
Default

@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:
advancedStatus: true
returns a complete/standardized response field with all available status information that JDownloader *knows*.
__________________
JD-Dev & Server-Admin

Last edited by Jiaz; 21.08.2024 at 22:05.
Reply With Quote
  #7  
Old 21.08.2024, 22:08
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 80,977
Default

Quote:
Originally Posted by AnanasXpress View Post
In that case most of the times only the mp4 disappears :D
Found the cause, will be fixed with next update. Thanks for the report.
__________________
JD-Dev & Server-Admin
Reply With Quote
  #8  
Old 21.08.2024, 22:13
AnanasXpress AnanasXpress is offline
Baby Loader
 
Join Date: Aug 2024
Posts: 6
Default

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
Reply With Quote
  #9  
Old 21.08.2024, 22:18
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 80,977
Default

Quote:
Originally Posted by AnanasXpress View Post
Man, you are quick. Thanks for the reply
Always happy when someone is using the api and providing feedback You're welcome!
__________________
JD-Dev & Server-Admin
Reply With Quote
  #10  
Old 21.08.2024, 22:29
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 80,977
Default

Quote:
Originally Posted by AnanasXpress View Post
In that case most of the times only the mp4 disappears :D
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
Reply With Quote
  #11  
Old 22.08.2024, 19:39
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 80,977
Default

@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
Reply With Quote
  #12  
Old 22.08.2024, 20:34
AnanasXpress AnanasXpress is offline
Baby Loader
 
Join Date: Aug 2024
Posts: 6
Default

Amazing News *_*
Is there a rough estimation when the update will go live?
Thank you very much
Reply With Quote
  #13  
Old 22.08.2024, 21:12
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 80,977
Default

Quote:
Originally Posted by AnanasXpress View Post
Is there a rough estimation when the update will go live?
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
Reply With Quote
  #14  
Old 23.08.2024, 15:31
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 80,977
Default

@AnanasXpress: Update is available Please test and provide feedback
__________________
JD-Dev & Server-Admin
Reply With Quote
  #15  
Old 23.08.2024, 15:31
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 72,894
Default

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
Spoiler:

A users' JD crashes and the first thing to ask is:
Quote:
Originally Posted by Jiaz View Post
Do you have Nero installed?
Reply With Quote
  #16  
Old 24.08.2024, 23:47
AnanasXpress AnanasXpress is offline
Baby Loader
 
Join Date: Aug 2024
Posts: 6
Default

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.
Reply With Quote
  #17  
Old 27.08.2024, 15:16
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 72,894
Default

Quote:
Originally Posted by AnanasXpress View Post
I noticed the api doc wasn't updated yet regarding linkUUIDs, that might help others.
Once Jiaz finds the time, he will reply here.
__________________
JD Supporter, Plugin Dev. & Community Manager

Erste Schritte & Tutorials || JDownloader 2 Setup Download
Spoiler:

A users' JD crashes and the first thing to ask is:
Quote:
Originally Posted by Jiaz View Post
Do you have Nero installed?
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 17:38.
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 - 2024, Jelsoft Enterprises Ltd.