JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #2801  
Old 06.03.2024, 10:22
Docoakere Docoakere is offline
Vacuum Cleaner
 
Join Date: Feb 2024
Posts: 15
Default Problem with callAPI /accounts/updateAccount?accountId&username&password

I'm trying to update an existing account via the Event Scripter from an imported text/csv file but unfortunately I get an error. For that I used more or less a combination of two script from this forum:

1. to import the file: https://board.jdownloader.org/showpo...postcount=1862

HTML Code:
var myfile = "/config/import/accounts.txt";
var newFilePath = "/config/import/processed";
var myFilePath = getPath(myfile);

if (myFilePath.exists()) {
    try {
        readFile(myfile).trim().split("\r\n").forEach(function(item) {
            var substrings = item.split("\t");
            var account = substrings[0];
            var email = substrings[1];
            var cookie = substrings[2];
            callAPI("accounts", "addAccount", account, email, cookie);
        });
        getPath(myfile).moveTo(newFilePath)
    } catch (e) {
        alert(e.message);
    }
};
-> Works fine!

2. to get the account id: https://board.jdownloader.org/showpo...18&postcount=3
HTML Code:
var myfile = "/config/import/accounts.txt";
if (myFilePath.exists()) {
    try {
        readFile(myfile).trim().split("\r\n").forEach(function(item) {
            var substrings = item.split("\t");
            var account = substrings[0];
            var premiumAccounts = callAPI("accountsV2", "listAccounts", {});
            for (i = 0; i < premiumAccounts.length; ++i) {
                if (premiumAccounts[i].hostname.indexOf(account) > -1) {
                    var ids = [];
                    ids.push(premiumAccounts[i].uuid);
                }
            }
            alert(callAPI("accounts", "getAccountInfo", ids));
        });
        getPath(myfile).moveTo(newFilePath)
    } catch (e) {
        alert(e.message);
    }
};
-> Works fine!

As a side note:
this still doesnt work, as mentioned by neygen in the above mentioned link:
HTML Code:
var ids = new long[] {premiumAccounts[0].uuid};
this workaround does work:
HTML Code:
var ids = [];
ids.push(premiumAccounts[0].uuid);
Now to the Problem:
Both scripts work on their own. So my final script for reading the file, parsing the values, getting the account id based on the host name in the file and then updating the respective account looks like that:

HTML Code:
var myfile = "/config/import/accounts.txt";
var newFilePath = "/config/import/processed";
var myFilePath = getPath(myfile);

if (myFilePath.exists()) {
    try {
        readFile(myfile).trim().split("\r\n").forEach(function(item) {
            var substrings = item.split("\t");
            var account = substrings[0];
            var email = substrings[1];
            var cookie = substrings[2];
            var premiumAccounts = callAPI("accountsV2", "listAccounts", {});
            for (i = 0; i < premiumAccounts.length; ++i) {
                if (premiumAccounts[i].hostname.indexOf(account) > -1) {
                    var ids = [];
                    ids.push(premiumAccounts[i].uuid);
                }
            }
            var values=[ids, email, cookie];
            // callAPI("accounts", "updateAccount", item.split("\t"));
            callAPI("accounts", "updateAccount", ids, email, cookie);
            // callAPI("accounts", "updateAccount", values);
        });
        getPath(myfile).moveTo(newFilePath)
    } catch (e) {
        alert(e.message);
    }
};
Error on line
HTML Code:
callAPI("accounts", "updateAccount", ids, email, cookie);
HTML Code:
org.jdownloader.extensions.eventscripter.EnvironmentException: Line 20
org.appwork.remoteapi.exceptions.BadParameterException: BAD_PARAMETERS(ERROR_BAD_REQUEST)
	at org.jdownloader.api.RemoteAPIController.call(RemoteAPIController.java:779)
	at org.jdownloader.extensions.eventscripter.sandboxobjects.ScriptEnvironment.callAPI(ScriptEnvironment.java:232)
	at sun.reflect.GeneratedMethodAccessor531.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:153)
	at net.sourceforge.htmlunit.corejs.javascript.NativeJavaMethod.call(NativeJavaMethod.java:213)
	at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1536)
	at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:798)
	at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:105)
	at net.sourceforge.htmlunit.corejs.javascript.NativeArray.iterativeMethod(NativeArray.java:1687)
	at net.sourceforge.htmlunit.corejs.javascript.NativeArray.execIdCall(NativeArray.java:405)
	at net.sourceforge.htmlunit.corejs.javascript.IdFunctionObject.call(IdFunctionObject.java:93)
	at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1536)
	at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:798)
	at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:105)
	at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:411)
	at org.jdownloader.scripting.JSHtmlUnitPermissionRestricter$SandboxContextFactory.doTopCall(JSHtmlUnitPermissionRestricter.java:134)
	at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3286)
	at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.exec(InterpretedFunction.java:115)
	at net.sourceforge.htmlunit.corejs.javascript.Context.evaluateString(Context.java:1361)
	at org.jdownloader.extensions.eventscripter.ScriptThread.evalUNtrusted(ScriptThread.java:344)
	at org.jdownloader.extensions.eventscripter.ScriptThread.executeScipt(ScriptThread.java:192)
	at org.jdownloader.extensions.eventscripter.ScriptThread.run(ScriptThread.java:172)
Caused by: java.lang.ClassCastException
  • All of the variables are properly assigned, same as in the first script, which works
  • ids is also found and works, as in the second script
  • I tried with different version of callAPI as you see from the commented lines

I do not know why it wont work in combination. Any help is appreciated.
Reply With Quote
  #2802  
Old 06.03.2024, 13:02
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,591
Default

Quote:
Originally Posted by Docoakere View Post
this still doesnt work, as mentioned by neygen in the above mentioned link:
Code:
var ids = new long[] {premiumAccounts[0].uuid};
long[] is used in the help file to indicate that the parameter is array

if you see:
Code:
 ids (long[])
you will need to use:
Code:
var ids = [object ids];

Also for namespace "updateAccount" the parameter is 'accountId (Long)', not 'array'.

Quote:
Originally Posted by Docoakere View Post
Code:
var ids = [];
ids.push(premiumAccounts[0].uuid);
Instead of this, you can just use:
Code:
var ids = [ids.push(premiumAccounts[0].uuid];

But in the case of 'updateAccounts' the parmeter should be 'long' not 'array'

Quote:
Originally Posted by Docoakere View Post
Code:
Error on line .. callAPI("accounts", "updateAccount", ids, email, cookie);
org.appwork.remoteapi.exceptions.BadParameterException: BAD_PARAMETERS(ERROR_BAD_REQUEST)
Most likely caused by passing 'array' as parameter, where 'long' was expected.

In conclusion, would be easier for me to re-write the code block rather than try to troubleshoot it.

Code:
readFile(myfile).trim().split("\r\n").forEach(function(item) {
    var [host, user, pass] = item.split("\\n");

    callAPI("accountsV2", "listAccounts", {}).forEach(function(account) {
        if (account.hostname == host) {
            callAPI("accounts", "updateAccount", item.uuid, user, pass);
        }
    });
})

Perhaps you can fix your code based on the logic used in the above code block.
Reply With Quote
  #2803  
Old 06.03.2024, 13:21
Docoakere Docoakere is offline
Vacuum Cleaner
 
Join Date: Feb 2024
Posts: 15
Default

Thanks @mgpai! I think I fixed it. Mainly I mixed up the "ids (List)" vs. "ids (Long[])".
Reply With Quote
  #2804  
Old 06.03.2024, 13:23
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 72,951
Default

@mgpai
Thanks once more for helping out!

I assume that the user Docoakere is trying to build something which in the end will auto re-import current login-cookies for services where Cloudflare tends to kick in.
Reference:
https://board.jdownloader.org/showth...119#post531119
__________________
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
  #2805  
Old 06.03.2024, 13:41
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,591
Default

Quote:
Originally Posted by pspzockerscene View Post
@mgpai
Thanks once more for helping out!
My pleasure.

Quote:
Originally Posted by pspzockerscene View Post
I assume that the user Docoakere is trying to build something which in the end will auto re-import current login-cookies for services where Cloudflare tends to kick in.
Shoule be possible to autmaitcally update it directly from browser by using MYJD API in userscript, eliminating the need to export/import it from text file using eventscripter script.
Reply With Quote
  #2806  
Old 06.03.2024, 13:59
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 72,951
Default

Quote:
Originally Posted by mgpai View Post
Shoule be possible to autmaitcally update it directly from browser by using MYJD API in userscript, eliminating the need to export/import it from text file using eventscripter script.
Agree.

I'm sure Docoakere will come back to us regarding this topic.
__________________
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
  #2807  
Old 06.03.2024, 17:10
Docoakere Docoakere is offline
Vacuum Cleaner
 
Join Date: Feb 2024
Posts: 15
Default

Thanks for the help and the idea with MYJD API/broswer userscript. That sounds more efficient indeed. However I'm not a developer and my JS skills are minimal. I'll see what I can figure out with the help of GPT, Google and Trial-and-Error.

By briefly thinking about it the following things must be (probably) done in one way or another:

(3. Might be optional but is maybe a good idea to prevent updating the account too often (resulting in unnecessary requests at the hoster), depending also on the trigger of when the script fires.)

1. Accessing & reading the local cookies by some trigger which I dont know yet
2. Filtering by domain name & cookie name
3. Storing the current values/datetime or the hash of it in an "own" cookie for later comparison (I don't know about any other way of storing data within a browser for later use)
4. Building the cookie json if the current cookies are newer then last version based on the hash of our "own" cookie
5. Sending the latest cookie json as password together with the correct account id and the user name/email via /accounts/updateAccount?accountId&username&password to JD

If you have another approach or suggestions feel free to colaborate.
Reply With Quote
  #2808  
Old 07.03.2024, 08:38
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 72,951
Default

* do not forget about periodically reloading specific URLs of the websites you want the cookies for to always have a current set of Cloudflare cookies.

Just as a side-hint: Using FlareSolverr might still be the better attempt.
__________________
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
  #2809  
Old 07.03.2024, 11:46
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,591
Default

Quote:
Originally Posted by Docoakere View Post
...
> (3. Might be optional but is maybe a good idea to prevent updating the account too often (resulting in unnecessary requests at the hoster), depending also on the trigger of when the script fires.)

You can use "// @run-at context-menu" in greasemonkey/tampermonkey to run the userscript.

> 1. Accessing & reading the local cookies by some trigger which I dont know yet

By local if you mean browser cookies, they can be accessed using 'document.cookie' method.

> 2. Filtering by domain name & cookie name

This will not be necessary if you use run the userscript using context menu.

> 3. Storing the current values/datetime or the hash of it in an "own" cookie for later comparison (I don't know about any other way of storing data within a browser for later use)

Not necessary to compare. Just run the script from context menu when you want to update the cookies in JD.

> 4. Building the cookie json if the current cookies are newer then last version based on the hash of our "own" cookie

Use the for/forEach loop on document.cookie to convert it to json format.

> 5. Sending the latest cookie json as password together with the correct account id and the user name/email via /accounts/updateAccount?accountId&username&password to JD

Pretty much similar to what is done in eventscripter. You have to enable deprecated API in JD and make the same request to localhost in userscript.

Using a injection method other than '@run-at ' will not result in any additional request.

While comparision is not required, you can limit the account update frequency by checking the account status (for error relating to cookies) at reqular intervals, and only then make a API request to update it.

If fully automated you can use for e.g. '// @include *://www.mysite.com/*" to run on specific sites.
Reply With Quote
  #2810  
Old 07.03.2024, 13:00
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 72,951
Default

Addendum:
I don't know if browser addons can provide internal APIs but as for getting the cookies and getting them in a supported json format, the easiest way would be if FlagCookies or EditThisCookie would provide a single line method to get all cookies of the currently open tab programmatically.

I'am not into that topic at all but it might be worth looking into this and/or even asking the developer of such a browser addon e.g. public support thread of browser addon "FlagCookies":
ngb.to/threads/addon-ff-gc-o-e-flagcookies.32496/
github:
github.com/jrie/flagCookies/issues
__________________
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
  #2811  
Old 07.03.2024, 13:08
Docoakere Docoakere is offline
Vacuum Cleaner
 
Join Date: Feb 2024
Posts: 15
Default

Thanks for the input to both of you. Yeah, I read about FlareSolverr multiple times in this forum. I don't expect a guide on how to setup and configure it but just to sort things out I have a question about how the interaction with JD could look like.

What I found out about FS:
Other then a "normal" proxy FS does not just tunnel the requests but rather act as a client which calls the website using a browser, solves the CF challenge and returns a json-like object with different information including the cookies and userAgent:

HTML Code:
{
    "status": "ok",
    "message": "Challenge solved!",
    "solution": {
        "url": "**External links are only visible to Support Staff**,
        "status": 200,
        "cookies": [
            {
                "domain": "www.petsathome.com",
                "httpOnly": false,
                "name": "WC_MOBILEDEVICEID",
                "path": "/",
                "secure": false,
                "value": "0"
            },
            {
                "domain": ".petsathome.com",
                "expiry": 1673531559,
                "httpOnly": false,
                "name": "FPLC",
                "path": "/",
                "secure": true,
                "value": "k03jwEFLbwxG2InqkF8yDy5%2BxWFeypsVETpfQGAFNO9M33HudoClDsp%2FY9BH89yLrGpQRLYL2WCgOkBrWRwdcK%2BycvG8%2F3m3SjDu3ZDXXHodwcxEhm4fQo7x8G%2BMrw%3D%3D"
            },
            ...
        ],
        "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36",
        "headers": {},
        "response": "<html><head>...</head><body>...</body></html>"
    },
    "startTimestamp": 1673459546891,
    "endTimestamp": 1673459560345,
    "version": "3.0.2"
}
So, as far as I can tell you cannot simply add the FS as proxy in JD. Jiaz hinted that in another post: **External links are only visible to Support Staff**.... Instead there needs to be some piece of code/script on some machine to call FS, wait for the response, extract cookie (potentially also modify the FS cookie so that it looks like how the website expects it) and forwards it into JD either by file/Event Scripter or MYJD API.

Do I miss something? Is JD capable of calling FS direclty and doing the response handling itself? If so I guess it needs to be within the Event Scripter.

Last edited by Docoakere; 07.03.2024 at 18:23.
Reply With Quote
  #2812  
Old 07.03.2024, 17:46
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 72,951
Default

Quote:
Originally Posted by Docoakere View Post
So, as far as I can tell you cannot simply add the FS as proxy in JD.
Hm okay this is what I initially thought.

Then let's put it this way:
If it was possible to integrate FlareSolverr as a"normal" proxy, all you'd need to do is to set it up and add it as a proxy in JD.

Just by the first glance on their readme, it looks like it does provide said proxy functionality:
github.com/FlareSolverr/FlareSolverr

I won't take a deep-dive here since I'm providing JD support here, not support to setup 3rd party tools
If I misunderstood the concept of FlareSolverr I'm sorry.
I will leave it in the Cloudflare FAQ either way since it is a helpful tool which can be used to solve Cloudflare related problems.
__________________
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?

Last edited by pspzockerscene; 07.03.2024 at 17:46. Reason: Fixed typo
Reply With Quote
  #2813  
Old 09.03.2024, 14:31
Keroel Keroel is offline
Junior Loader
 
Join Date: Oct 2022
Posts: 10
Default

Hi,


if very long tracks have chaptermarks, is it possible to cut the file at the same time?


So that we get all the songs contained as individual tracks?
Reply With Quote
  #2814  
Old 09.03.2024, 23:46
Dockel Dockel is offline
JD Legend
 
Join Date: Feb 2020
Posts: 700
Default

Quote:
Originally Posted by Jiaz View Post
@Dockel: Typical issue caused by firewall/av blocking access to this url. Please check firewall/av and in doubt try to add it to exclude list or white/exclude list JDownloader.
This URL is part of the update cycle
The URL to the updates? Which one is it?
__________________
Aktuelles Windows
Reply With Quote
  #2815  
Old 12.03.2024, 15:31
Sokub Sokub is offline
JD Adviser
 
Join Date: Feb 2018
Posts: 107
Default

Dear mgpai,

a few years back you helped me with a wonderful script,, which let me start videos straight out of JD with one click in the context menu. ... it worked like a charm for all these years. :-)

But now, with a new OS, I need to start the player scaled down with:

HTML Code:
export QT_SCALE_FACTOR=.6 ; smplayer
Could you help me to modify the script in a way, that the player starts scaled?
I suppose the "var player" needs a little change, but my trials were not succesful.

This is the original script:
HTML Code:
if (name == "Play") {
    var player = "/usr/bin/smplayer";

    dlSelection.getLinks().filter(function(link) {
        return link.getBytesLoaded();
    }).forEach(function(link) {
        var file = link.getDownloadPath();
        file = link.isFinished() ? file : file + ".part";
        callSync(player, file);
    })
}
Reply With Quote
  #2816  
Old 13.03.2024, 08:43
Sokub Sokub is offline
JD Adviser
 
Join Date: Feb 2018
Posts: 107
Default

Oh, I found a solution:

Just call JD itself with the scale factor. It does not respect it (unfortunately) but at least it passes it on to its child-processes:

HTML Code:
export QT_SCALE_FACTOR=.6 ; java -jar JDownloader.jar
Reply With Quote
  #2817  
Old 13.03.2024, 12:58
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,591
Default

Quote:
Originally Posted by Sokub View Post
Could you help me to modify the script in a way, that the player starts scaled?
I suppose the "var player" needs a little change, but my trials were not succesful.
Zero experience with this, but from what I could find on the web, maybe something like this :
Code:
callSync("QT_SCALE_FACTOR=.6", player, file);
Reply With Quote
  #2818  
Old 14.03.2024, 09:47
Sokub Sokub is offline
JD Adviser
 
Join Date: Feb 2018
Posts: 107
Default

Quote:
Originally Posted by mgpai View Post
Code:
callSync("QT_SCALE_FACTOR=.6", player, file);
Unfortunately this does not work. The error message is:

HTML Code:
Wrapped org.jdownloader.extensions.eventscripter.EnvironmentException: Line 9
java.io.IOException: Cannot run program "QT_SCALE_FACTOR=.6": error=2, Datei oder Verzeichnis nicht gefunden
As another quite clean solution, if you could help me to write the video-file-path into a text-file (without starting the player directly) ... I could handle it from there with a bash script. ... So is there an equivalent in java for "echo" in bash?

I tried several things in place of "callSync(player, file);" ... but without success, like:

HTML Code:
Files.writeString(Path.of("filename.txt"), "file");
... or:
HTML Code:
PrintWriter out = new PrintWriter("filename.txt");
out.println(file);
out.close();
But actually I'm completely blind in Java. :-/
Reply With Quote
  #2819  
Old 14.03.2024, 10:22
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,591
Default

Quote:
Originally Posted by Sokub View Post
... write the video-file-path into a text-file (without starting the player directly) ... I could handle it from there with a bash script. ... So is there an equivalent in java for "echo" in bash?
JD uses Java but eventscripter uses Javascript.

I guess the qt parameter should be preceded by interpreter or other parameters. In any case, it is not necessary to write the path to a text file. You can call the terminal command directly using callsync and pass the file path to it as a parameter. So also with a script.

Code:
callSync(binary, parameter1, parameter2, file);
or
callSync(myscript.sh, file);
Code:
var myFile = getPath("/preview.txt");

myFile.delete();
writeFile(myFile,file,false);
Reply With Quote
  #2820  
Old 14.03.2024, 13:04
Sokub Sokub is offline
JD Adviser
 
Join Date: Feb 2018
Posts: 107
Default

Ah, thank you very much, mgpai!

I testet both, calling it directly and writing it to a text-file. Both works perfectly!
I learned quite a bit here.

Thanks, mate!

:-)
Reply With Quote
  #2821  
Old 18.03.2024, 11:57
Dockel Dockel is offline
JD Legend
 
Join Date: Feb 2020
Posts: 700
Default Script that marks ne / certain hosters in one or more packages in the download window

This would be great: a script that marks (e.g with the context menu after right clicking) one / certain hosters in one or more packages in the download window?

https://board.jdownloader.org/showth...952#post531952
__________________
Aktuelles Windows
Reply With Quote
  #2822  
Old 18.03.2024, 18:36
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,591
Default

Quote:
Originally Posted by Dockel View Post
This would be great: a script that marks (e.g with the context menu after right clicking) one / certain hosters in one or more packages in the download window?
What action do you want to perform after selecting them? You can also just set the search filter at the bottom to "Hoster" and type the host(s) name in the search field.
Reply With Quote
  #2823  
Old 18.03.2024, 19:26
Dockel Dockel is offline
JD Legend
 
Join Date: Feb 2020
Posts: 700
Default

Yes, for one hoster at a time (I believe).

For example set / change priorities, (de)activate (a) special hoster(s). (De)activate sound notification.

So maybe the script would just allow to do a right click on a special hoster and in the context menu one could choose to mark that hoster or to mark other hosters of the same package as well. Or one marked two or more packages and could choose to select special hosters of these packages.
__________________
Aktuelles Windows
Reply With Quote
  #2824  
Old 19.03.2024, 09:04
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,591
Default

Quote:
Originally Posted by Dockel View Post
Yes, for one hoster at a time (I believe).

For example set / change priorities, (de)activate (a) special hoster(s). (De)activate sound notification.

So maybe the script would just allow to do a right click on a special hoster and in the context menu one could choose to mark that hoster or to mark other hosters of the same package as well. Or one marked two or more packages and could choose to select special hosters of these packages.
It does not work the way you seem to think it would. Selection made in the script cannot be used outside the script (in GUI). You will have to create multiple scripts which perform different actions, which might be quite a lot.

For your use case the best option is to use the search filter at the bottom of the donwload tab.

Select' hoster' and type the hostname(s) you want to filter.
Reply With Quote
  #2825  
Old 19.03.2024, 09:59
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 81,013
Default

Quote:
Originally Posted by mgpai View Post
It does not work the way you seem to think it would. Selection made in the script cannot be used outside the script (in GUI).
I could provide api methods for this
__________________
JD-Dev & Server-Admin
Reply With Quote
  #2826  
Old 19.03.2024, 12:42
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,591
Default

Quote:
Originally Posted by Jiaz View Post
I could provide api methods for this
Give me the place to stand, and I shall move the earth. - Archimedes
Reply With Quote
  #2827  
Old 19.03.2024, 12:58
Dockel Dockel is offline
JD Legend
 
Join Date: Feb 2020
Posts: 700
Default

Maybe moving JD a little bit would be enough (at the moment). - Dockel

But if it is too much work I absolutely could understand...so I would go on using the search filter...
__________________
Aktuelles Windows
Reply With Quote
  #2828  
Old 20.03.2024, 22:37
HughJazz HughJazz is offline
Vacuum Cleaner
 
Join Date: Apr 2017
Posts: 16
Default

[Request]

I need a script to trigger a url when there's a new captcha to solve.

I'm using a headless JD on a linux server if that matters.

Thanks in advance.

EDIT: nevermind, found it in the help file.

Last edited by HughJazz; 20.03.2024 at 22:52.
Reply With Quote
  #2829  
Old 21.03.2024, 22:22
Mesenzio Mesenzio is offline
Junior Loader
 
Join Date: Nov 2018
Posts: 12
Default Switch the larger one between two versions of videos

I need a script to switch the larger one between two versions (mp4 and mkv) of videos from YouTube to put in linkgrabber, as lower compression tend to result in larger file sizes.
Reply With Quote
  #2830  
Old 22.03.2024, 10:08
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 81,013
Default

@Mesenzio: mkv with vp9 or av1 has much better quality as h264 in mp4 container.
__________________
JD-Dev & Server-Admin
Reply With Quote
  #2831  
Old 23.03.2024, 05:53
hideas hideas is offline
Vacuum Cleaner
 
Join Date: Feb 2024
Posts: 17
Default

how do you use/what do you use "myBrowser.getDownload(myString, myString);" for?
is it for adding download links to the linkgrabber? what does it take as arguments?
I am currently trying to use myBrowser.setHeader() to get through a cloudflare protected site, I am successful in getting the browser object to bypass it, but using callAPI linkgrabberv2 to add link to list gets blocked so I am stuck.
Reply With Quote
  #2832  
Old 23.03.2024, 06:27
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,591
Default

Quote:
Originally Posted by hideas View Post
how do you use/what do you use "myBrowser.getDownload(myString, myString);" for?
is it for adding download links to the linkgrabber? what does it take as arguments?
I am currently trying to use myBrowser.setHeader() to get through a cloudflare protected site, I am successful in getting the browser object to bypass it, but using callAPI linkgrabberv2 to add link to list gets blocked so I am stuck.
To download a file using the browser instance.

Code:
myBrowser.getDownload(savePath, url);

If the final link is behind cf protection, adding it via api will not work since JD will use a different browser instance, with different cookies.

While 'getDownload' can be used, it might not be practical to download many/large files. If you add the cookies to a linkcrawler rule, adding links via API might work, since JD will then use those cookies to crawl/download them.
Reply With Quote
  #2833  
Old 23.03.2024, 06:47
hideas hideas is offline
Vacuum Cleaner
 
Join Date: Feb 2024
Posts: 17
Default

Quote:
Originally Posted by mgpai View Post
If you add the cookies to a linkcrawler rule, adding links via API might work, since JD will then use those cookies to crawl/download them.
Thanks for the response!
This is a website for which a JD plugin already exist, so as I understand I cannot use linkcrawler rules in that case, Is this correct? or am I misunderstanding what you meant?

In any case, can I ask how to write the cookies? or, where I can learn the syntax of writing cookies
the only line I needed to add for using scripter was myBrowser.setHeader("Origin", "/*the site host link*/");

Last edited by hideas; 23.03.2024 at 07:23.
Reply With Quote
  #2834  
Old 23.03.2024, 21:51
Mesenzio Mesenzio is offline
Junior Loader
 
Join Date: Nov 2018
Posts: 12
Default

Quote:
Originally Posted by Jiaz View Post
@Mesenzio: mkv with vp9 or av1 has much better quality as h264 in mp4 container.

Thanks for the response.
In some cases .mkv files are not present, so I would need a script that normally filters mp4 but lets them in when .mkv are not found.
Reply With Quote
  #2835  
Old 26.03.2024, 00:13
hideas hideas is offline
Vacuum Cleaner
 
Join Date: Feb 2024
Posts: 17
Default

In case anyone else is interested or need to pass headers, I snooped around for solutions for a bit and just ended up using a script to call an external app ytdlp that can add headers to handle what I wanted. you can make it more seamless than I thought (can trigger at the same time as the JD grabber list, save to the same folder you want etc.) only drawback is you cannot track download status because it runs in the background so i just made it do alert(package + " done"); when it is done
Reply With Quote
  #2836  
Old 26.03.2024, 01:44
mwl mwl is offline
Linkgrabbing Monster
 
Join Date: Mar 2013
Posts: 80
Default

Getting an odd error in a couple of my scripts.

The jscore runtime is throwing "Cannot call method `indexOf` on null (#10)"

I have several scripts all following the same pattern, but the full script for this case is at: pastebin com ivTZxkm9

Code:
if (isDownloadControllerRunning() && !isDownloadControllerStopping()) {
    var candidates = getAllDownloadLinks().filter(function(dl) {
        return dl.getStatus() != null && dl.isEnabled() && (dl.getStatus().indexOf('found') === -1) && (  // <-- line 10
I don't understand why this is happening, and I can't reproduce it in my testing. At the point where .indexOf() is being called, dl.getStatus() can't be null, because of the short-circuit null check earlier in the chain:
Code:
dl.getStatus() != null && dl.isEnabled() && (dl.getStatus().indexOf('found') === -1)
Reply With Quote
  #2837  
Old 26.03.2024, 09:40
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 81,013
Default

@hideas: Can you provide example links and headers you used to bypass cloudflare/to make it work in JDownloader. Then we can check/update JDownloader. Also it might be possible to customize headers for links you want to download but for that we need example links. Either post here ot send to support@jdownloader.org
__________________
JD-Dev & Server-Admin
Reply With Quote
  #2838  
Old 26.03.2024, 09:49
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 81,013
Default

@mwl: you should store dl.getStatus in variable and then process on it. because of timing, the dl.getStatus still might be != null but just the next moment it returns null and dl.getStatus.indexOf will fail because now it's null. many of those get methods are live
__________________
JD-Dev & Server-Admin
Reply With Quote
  #2839  
Old 26.03.2024, 11:35
pspzockerscene's Avatar
pspzockerscene pspzockerscene is offline
Community Manager
 
Join Date: Mar 2009
Location: Deutschland
Posts: 72,951
Default

@Jiaz
The best solution would be to add the ability to add headers via LinkCrawler rules because this is what is definitely missing.
__________________
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
  #2840  
Old 26.03.2024, 16:11
hideas hideas is offline
Vacuum Cleaner
 
Join Date: Feb 2024
Posts: 17
Default

Quote:
Originally Posted by Jiaz View Post
@hideas: Can you provide example links and headers you used to bypass cloudflare/to make it work in JDownloader. Then we can check/update JDownloader. Also it might be possible to customize headers for links you want to download but for that we need example links. Either post here ot send to support@jdownloader.org
example link is **External links are only visible to Support Staff****External links are only visible to Support Staff** (any from this website)
and header used was "Origin: **External links are only visible to Support Staff**
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 00:35.
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.