JDownloader Community - Appwork GmbH
 

Notices

Reply
 
Thread Tools Display Modes
  #761  
Old 05.06.2019, 17:00
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,286
Default

Quote:
Originally Posted by JDFan View Post
I really like INI files. And JSON, too. Scripter support?
What do you mean by that? You can read/write with api methods and toJSObject/toJson. you should also be able to use JSON methods
__________________
JD-Dev & Server-Admin
Reply With Quote
  #762  
Old 05.06.2019, 20:50
bobolecoco bobolecoco is offline
Super Loader
 
Join Date: Aug 2015
Location: France
Posts: 27
Default

Quote:
Originally Posted by Spyro70 View Post
I would like create a script to download some steaming with a scheduler that consider days, hours and minutes. I am not a programmer...can tell me how I can work out it?
What do you want to do exactly ?
Is the stream url always the same ?
What do you mean with days hours minutes (launch the download every "D" days, at "H" hour and "M" minutes / wait "D" days, at "H" hour and "M" minutes before running / launch the download every "a day of the week (Friday for example)", at "H" hour and "M" minutes) ?
Depending on your answer answer will not be the same. And you could/should consider using "folderwatch" to download a file when it's available.
Reply With Quote
  #763  
Old 05.06.2019, 23:23
bingo bingo is offline
Baby Loader
 
Join Date: Jan 2019
Posts: 9
Default

Hi ,

i would like a script that would allow me to download just a small chunk of lots of files (maybe 1 or 10 MB) (and possibly auto delete them afterwards as well)
Reply With Quote
  #764  
Old 06.06.2019, 12:18
bobolecoco bobolecoco is offline
Super Loader
 
Join Date: Aug 2015
Location: France
Posts: 27
Default

Quote:
Originally Posted by bingo View Post
Hi ,

i would like a script that would allow me to download just a small chunk of lots of files (maybe 1 or 10 MB) (and possibly auto delete them afterwards as well)

Is something like this what you want ?
Code:
var numberOfMB = 10

for (i = getAllDownloadLinks().length - 1; i >= 0; i--) {
    if (getAllDownloadLinks()[i].getBytesLoaded() > numberOfMB * 1024 * 1024) {
        getAllDownloadLinks()[i].setEnabled(false);
    }
}
It will check if more than (here 10) MB of the file are already downloaded. If that's the case, it will disable the link.

You can add this line (after or instead of "getAllDownloadLinks()[i].setEnabled(false);") :
Code:
removeDownloadLinkByUUID(getAllDownloadLinks()[i].getUUID());
//or
getAllDownloadLinks()[i].remove();
It will remove the link from the download list.

You can also look for the deleteFile() method to erase the downloaded file in combination with the getPath() method.
Reply With Quote
  #765  
Old 06.06.2019, 12:31
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,286
Default

@bobolecoco: you're trying to become new master of eventscripter mgpai will be great teacher to you
Thanks for helping out!
__________________
JD-Dev & Server-Admin
Reply With Quote
  #766  
Old 06.06.2019, 13:23
bobolecoco bobolecoco is offline
Super Loader
 
Join Date: Aug 2015
Location: France
Posts: 27
Default

I'm pretty sure mgpai will have a better script than mine !
And trying to solve somebody else problems teaches me how to use the eventscripter too.
Reply With Quote
  #767  
Old 06.06.2019, 14:28
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,286
Default

Great things you will learn, young padawan Proud mgpai will be of you
__________________
JD-Dev & Server-Admin
Reply With Quote
  #768  
Old 06.06.2019, 17:53
thecoder2012's Avatar
thecoder2012 thecoder2012 is offline
Official 9kw.eu Support
 
Join Date: Feb 2013
Location: Internet
Posts: 1,324
Default

Quote:
Originally Posted by mgpai View Post
True, but I am not comfortable helping anyone scam the hosters. If (I feel) the requirement is legitimate (as in this case), I will try to help in any way I can.
Okay, good. Special case filecrypt and too much links in one hour. I have already requested better proxy support.

Had the days a closer look at the Event Scripter, I can't do the proxy list there, especially sorting, adding and deleting proxies? Or did I overlook a function (call api?)?

Especially with Filecrypt this would be helpful if after e.g. 10 calls another proxy would be moved up by sorting. Otherwise I have an error 404 (returned by Filecrypt) although it would be available.

EDIT: Solved. (call api read/write with InternetConnectionSettings.customproxylist)
__________________
Join 9kw.eu Captcha Service now and let your JD continue downloads while you sleep.

Last edited by thecoder2012; 06.06.2019 at 18:07.
Reply With Quote
  #769  
Old 06.06.2019, 18:01
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,286
Default

Quote:
Originally Posted by thecoder2012 View Post
Especially with Filecrypt this would be helpful if after e.g. 10 calls another proxy would be moved up by sorting. Otherwise I have an error 404 (returned by Filecrypt) although it would be available.
At the moment there is no trigger for *after 10 calls*.
__________________
JD-Dev & Server-Admin
Reply With Quote
  #770  
Old 06.06.2019, 19:29
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

Quote:
Originally Posted by thecoder2012 View Post
Especially with Filecrypt this would be helpful if after e.g. 10 calls another proxy would be moved up by sorting.
@Jiaz: How does GeneralSettings.freeproxybalancemode CYCLE work? If the term CYCLE is used in literal sense, would it not mean it will use one proxy after another (in the order they are listed), for each new connection, till it reaches the end of the list and start again from the top?, in which case if this option is selected, will there be a need to sort?
Reply With Quote
  #771  
Old 06.06.2019, 19:40
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,286
Default

@mgpai: this one only works for downloads and yes, one after another
__________________
JD-Dev & Server-Admin
Reply With Quote
  #772  
Old 06.06.2019, 19:50
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

Quote:
Originally Posted by Jiaz View Post
@mgpai: this one only works for downloads and yes, one after another
I have noticed (also just tried) that if the decrypter (filecrypt.cc in this case) is blacklisted in the direct connection, it will use proxies. Will it cycle for the decrypter in such cases or does it keep only using the first proxy in list. In other words is there a workaround to cycle proxies with decryrpters, or does it only work strictly with downloads?
Reply With Quote
  #773  
Old 06.06.2019, 21:21
thecoder2012's Avatar
thecoder2012 thecoder2012 is offline
Official 9kw.eu Support
 
Join Date: Feb 2013
Location: Internet
Posts: 1,324
Default

Quote:
Originally Posted by mgpai View Post
I have noticed (also just tried) that if the decrypter (filecrypt.cc in this case) is blacklisted in the direct connection, it will use proxies.
Yes.

Quote:
Originally Posted by mgpai View Post
Will it cycle for the decrypter in such cases or ...
I think no.

Quote:
Originally Posted by mgpai View Post
... does it keep only using the first proxy in list. In other words is there a workaround to cycle proxies with decryrpters, or does it only work strictly with downloads?
With decrypters, nope. GeneralSettings.freeproxybalancemode is ONLY for downloads. Other functions only using the first good proxy in the list.

First the small export function in js for crazy config places.
Code:
writeFile(JD_HOME + "/tmp/biglist.json", JSON.stringify(callAPI("config", "list"),undefined,4), false);
Proxy list is under updatev2 says the list function.

My linkgrabber proxy cycle script:
Code:
// LinkGrabber Proxy cycle
// Trigger required: "New Crawler Job"

var old_proxylist = [];
var new_proxylist = [];
var first_active = "";

var settings = "org.jdownloader.updatev2.InternetConnectionSettings";
var storage = "cfg/org.jdownloader.settings.InternetConnectionSettings";
old_proxylist = callAPI("config", "get", settings, storage, "customproxylist");

for (var key in old_proxylist) {
    if (old_proxylist.hasOwnProperty(key)) {
        if (old_proxylist[key].enabled == true && first_active == "") {
            first_active = old_proxylist[key];
        } else {
            new_proxylist.push(old_proxylist[key]);
        }
    }
}
new_proxylist.push(first_active);
callAPI("config", "set", settings, storage, "customproxylist", new_proxylist);
__________________
Join 9kw.eu Captcha Service now and let your JD continue downloads while you sleep.
Reply With Quote
  #774  
Old 06.06.2019, 22:03
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

@Jiaz: Thanks for the reply.
@thecoder2012: Thanks for the response. Good to see you found a nice solution to your problem.
Reply With Quote
  #775  
Old 07.06.2019, 01:19
thecoder2012's Avatar
thecoder2012 thecoder2012 is offline
Official 9kw.eu Support
 
Join Date: Feb 2013
Location: Internet
Posts: 1,324
Default

Quote:
Originally Posted by mgpai View Post
@Jiaz: Thanks for the reply.
@thecoder2012: Thanks for the response. Good to see you found a nice solution to your problem.
Next question. I have the PluginException.LinkStatus.ERROR_RETRY,
PluginException.LinkStatus.ERROR_IP_BLOCKED,
PluginException.LinkStatus.ERROR_HOSTER_TEMPORARILY_UNAVAILABLE or
PluginException.LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE in the hoster-/downloadplugin (e.g. shareonline) but in the Event Scripter is "getStatus()"+"getSkippedReason()"+"getFinalLinkStatus()" only "null", why?
getEta() has the (retry or maintenance) time or "-1" with IP_BLOCKED.

I have no problem with ERROR_FATAL, ERROR_PLUGIN_DEFECT, ERROR_CAPTCHA and ERROR_FILE_NOT_FOUND in the Event Scripter.

Code Example:
Code:
var links = getAllDownloadLinks();
for (i = 0; i < links.length; i++) {
        var link = links[i];
        alert(link.getEta() + " 1:" + link.getStatus() + " 2:" + link.getSkippedReason() + " 3:" + link.getFinalLinkStatus());
}
__________________
Join 9kw.eu Captcha Service now and let your JD continue downloads while you sleep.

Last edited by thecoder2012; 14.06.2019 at 01:23.
Reply With Quote
  #776  
Old 11.06.2019, 16:43
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,286
Default

@thecoder2012: those LinkStatus are only used for signals between Controller-Plugin.
getStatus returns String that is internally created for human readonly
getSkippedReason returns final SkippedReason
getFinalLinkStatus returns final FinalLinkState
temp/conditional skip reasons are only *reachable* via getStatus and ONLY when controller assigned the status to the file.

What are you trying to find out? Best would be to contact me via support@jdownloader.org so we can do tech chit/chat
__________________
JD-Dev & Server-Admin
Reply With Quote
  #777  
Old 12.06.2019, 22:03
D.IKE.E D.IKE.E is offline
JD Alpha
 
Join Date: Jun 2013
Posts: 24
Question File on HDD <> Linkgrabber comparision

Does anybody know a way to compare links in linkgrabber with files on my hard drive to avoid downloading files I already have (which were not downloaded through JD)? Since linkgrabber only fetches file sizes it's the only - but perhaps good enough - comparable file attribute. The results of such a search/comparison can also be manually checked about if file names are similar. The idea grew from the usage of the tool AllDup (alldup.de/alldup/en_alldup_screenshots.php)
Reply With Quote
  #778  
Old 13.06.2019, 19:06
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

Quote:
Originally Posted by D.IKE.E View Post
... avoid downloading files I already have ...
You can use a script like this to check/disable the link if it already exists on disk. That script only checks for duplicate file name, but a file size comparison can also be added to it.
Reply With Quote
  #779  
Old 14.06.2019, 01:25
thecoder2012's Avatar
thecoder2012 thecoder2012 is offline
Official 9kw.eu Support
 
Join Date: Feb 2013
Location: Internet
Posts: 1,324
Default

Quote:
Originally Posted by Jiaz View Post
What are you trying to find out?
Faster reset/repeat of waiting times than e.g. retry in 15 minutes or 3 hours (uploaded test).

Quote:
Originally Posted by Jiaz View Post
temp/conditional skip reasons are only *reachable* via getStatus and ONLY when controller assigned the status to the file.
Okay and there is no chance if the controller has it not? (SO with temp/conditional skip reasons e.g. IP_BLOCKED, HOSTER_TEMPORARILY_UNAVAILABLE, TEMPORARILY_UNAVAILABLE)

Little better example with uploaded link "uploaded.net/file/xa23c1bz" (start the download, click on stop and try it again, then you have "Download limit has been reached" but NO status or eta in the Event Scripter.

JD Screenshot:


Event Scripter
Code:
var links = getAllDownloadLinks();
for (i = 0; i < links.length; i++) {
    var link = links[i];
    if (link.isEnabled()) {
        alert(link.getHost() + " 0:" + link.getEta() + " 1:" + link.getStatus() + " 2:" + link.getSkippedReason() + " 3:" + link.getFinalLinkStatus());
    }
}
Screenshot:


But I see the reason in myjd:

Can I grab it (e.g. "Download limit has been reached") with other function/callapi?
__________________
Join 9kw.eu Captcha Service now and let your JD continue downloads while you sleep.

Last edited by thecoder2012; 14.06.2019 at 13:09.
Reply With Quote
  #780  
Old 14.06.2019, 13:09
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,286
Default

should be fixed with next core update
__________________
JD-Dev & Server-Admin
Reply With Quote
  #781  
Old 14.06.2019, 18:23
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,286
Default

Also added new ConditionalSkipReasonSandbox via link.getConditionalSkipReason()
__________________
JD-Dev & Server-Admin
Reply With Quote
  #782  
Old 14.06.2019, 21:19
thecoder2012's Avatar
thecoder2012 thecoder2012 is offline
Official 9kw.eu Support
 
Join Date: Feb 2013
Location: Internet
Posts: 1,324
Default

Quote:
Originally Posted by Jiaz View Post
Also added new ConditionalSkipReasonSandbox via link.getConditionalSkipReason()
Thanks but I see in my new tests with previous uploaded link not really (more) temp reasons (e.g. 2-3h, download limit has been reached) ?

Example:
Code:
var mytest = true;
var newm = "";
var links = getAllDownloadLinks();
for (i = 0; i < links.length; i++) {
    var link = links[i];
    if (link.isEnabled()) {
        var reason = link.getConditionalSkipReason();
        newm = (link.getHost() + " 0:" + link.getEta() + " 1:" + link.getStatus() + " 2:" + link.getSkippedReason() + " 3:" + link.getFinalLinkStatus())+"\n";        
        newm += "getWaitingSkipReason: "+reason.getWaitingSkipReason() + "\n";

        if (reason.isConditionReached() || mytest) {
            newm += (reason.getClassName() + "," + reason.getMessage() + "\n"); //WaitWhileWaitingSkipReasonIsSet, null
        }
        if (reason.isTimeOutCondition() || mytest) {
            newm += (reason.getTimeOutTimeStamp() + "," + reason.getTimeOutLeft()+"\n"); //-1,-1
        }
        if (reason.isDownloadLinkCondition() || mytest) {
            newm += (reason.getDownloadLinkCondition() +"\n");
        }
        alert(newm);
        break;
    }
}
Is my code wrong or not possible with "download limit has been reached" in this case?

Screenshot:

__________________
Join 9kw.eu Captcha Service now and let your JD continue downloads while you sleep.

Last edited by thecoder2012; 14.06.2019 at 21:22.
Reply With Quote
  #783  
Old 17.06.2019, 10:41
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,286
Default

Sorry, will check again and fix it. It must work but I don't know yet why it fails. Thanks for providing example script
__________________
JD-Dev & Server-Admin
Reply With Quote
  #784  
Old 17.06.2019, 16:57
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,286
Default

@thecoder2012: fixed with next core update
__________________
JD-Dev & Server-Admin
Reply With Quote
  #785  
Old 17.06.2019, 18:05
D.IKE.E D.IKE.E is offline
JD Alpha
 
Join Date: Jun 2013
Posts: 24
Default

Quote:
Originally Posted by mgpai View Post
You can use a script like **External links are only visible to Support Staff**... to check/disable the link if it already exists on disk. That script only checks for duplicate file name, but a file size comparison can also be added to it.
So is it done by changing link.getName to link.getSize or what is the variable? I don't understand sh't in coding.
Shall we continue writing in that specific topic (a mod should change it's title btw. to something that makes sense) or stay here?
Reply With Quote
  #786  
Old 17.06.2019, 18:26
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,286
Default

@D.IKE.E you might wanna contact him via private message or chat with him in live chat or share e-mail (via private message)
__________________
JD-Dev & Server-Admin
Reply With Quote
  #787  
Old 17.06.2019, 19:01
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

Quote:
Originally Posted by D.IKE.E View Post
So is it done by changing link.getName to link.getSize or what is the variable?
Code:
// Disable download link, if file exists on disk
// Trigger Required: "A Download Started".

var linkName = link.getName();
var folders = ["c:/downloads/1/", "c:/downloads/2/", "c:/downloads/3/"]; // <- Check if file exists in these folders

folders.forEach(function(folder) {
    if (!link.isEnabled()) return;
    var file = getPath(folder + linkName);
    if (!file.exists()) return;
    if (link.getBytesTotal() == file.getSize()) link.setEnabled(false);
})
Reply With Quote
  #788  
Old 19.06.2019, 02:21
SMS SMS is offline
Mega Loader
 
Join Date: Jun 2019
Posts: 64
Default

How can I do the following: If the file *720.mp4 is offline (HTTP status 404), replace 720 by 480 in the URL. Thanks!
Reply With Quote
  #789  
Old 19.06.2019, 07:26
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

Quote:
Originally Posted by SMS View Post
If the file *720.mp4 is offline (HTTP status 404), replace 720 by 480 in the URL.
Can add a new url, based on the current one, if it is offline. Cannot modify/remove it using script.

Code:
// Add alternate url, if current url is offline
// Trigger : Packagizer Hook

if (state == "BEFORE") {
    var url = link.getURL();
    if (url && link.getLinkState() == "OFFLINE" && (/.+720.mp4$/).test(url)) {
        callAPI("linkgrabberv2", "addLinks", {
            "links": url.replace(/(.+)720.mp4/, "$1480.mp4")
        });
    }
}
Reply With Quote
  #790  
Old 19.06.2019, 16:50
SMS SMS is offline
Mega Loader
 
Join Date: Jun 2019
Posts: 64
Default

The previous post isn't working. The link is offline, so the linkgrabber doesn't add it to the download list, so Packagizer Hook is not called.
Reply With Quote
  #791  
Old 19.06.2019, 17:25
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

Quote:
Originally Posted by SMS View Post
The previous post isn't working. The link is offline, so the linkgrabber doesn't add it to the download list, so Packagizer Hook is not called.
Filtered links cannot be accessed (AFAIK) by eventscripter via packagizer hook or any other trigger. For the script to work (access the link and read status/url), you will need to disable/modify any linkgrabber rules, which filter such links.
Reply With Quote
  #792  
Old 19.06.2019, 17:29
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,286
Default

@SMS: we can help best if you could provide real working example links
__________________
JD-Dev & Server-Admin
Reply With Quote
  #793  
Old 20.06.2019, 00:58
SMS SMS is offline
Mega Loader
 
Join Date: Jun 2019
Posts: 64
Default

It works now, thanks!
Unimportant stuff:
Spoiler:
Quote:
Originally Posted by mgpai View Post
Filtered links cannot be accessed (AFAIK) by eventscripter via packagizer hook or any other trigger. For the script to work (access the link and read status/url), you will need to disable/modify any linkgrabber rules, which filter such links.
Linkgrabber Filter already was disabled. LinkCrawler Rules didn't contain anything about filtering offline files, but I disabled all of them as well, just in case. Still, offline files don't appear in the Linkgrabber. What else might be preventing them from appearing in the Linkgrabber?

Edit: It's working today. Maybe due to a restart.
Or because I played around with "Advanced Settings" -> "Linkgrabber Settings: Handle Offline On Confirm Latest Selection". But after playing around with it, I set it back to what it was, and this setting seems to be about the Linkgrabber->Downloadlist transition anyway, not related to the Clipboard->Linkgrabber transition. What does "Confirm Latest Selection" actually mean?

Quote:
Originally Posted by Jiaz View Post
@SMS: we can help best if you could provide real working example links
Right now this is about any files with HTTP status 404. They don't didn't appear in my Linkgrabber.

Last edited by SMS; 20.06.2019 at 20:27.
Reply With Quote
  #794  
Old 21.06.2019, 01:20
thecoder2012's Avatar
thecoder2012 thecoder2012 is offline
Official 9kw.eu Support
 
Join Date: Feb 2013
Location: Internet
Posts: 1,324
Post

Code:
// Export download URLs (original by mgpai)
// Trigger : "DownloadList Contextmenu Button Pressed"

if (name == "Export URLs") {
    var links = dlSelection.getDownloadLinks();
    var urls = [];

    for (i = 0; i < links.length; i++) {
        var link = links[i];
        var fileName = link.getName();
        //var downloadURL = link.getContentURL();//original
        var downloadURL = link.getContentURL() + "," + link.getContainerURL() + "," + link.getOriginURL() + "," + link.getUrl();
        urls.push(downloadURL + "," + fileName);
    }
    alert(urls.join("\r\n"));
}
It works with directlinks (zippyshare, filecrypt) but NOT with container like filecrypt (cnl/dlc container with zippyshare links). I got only "null" or "filecrypt.cc" but nothing else (e.g. zippyshare links).

Directlink:
**External links are only visible to Support Staff****External links are only visible to Support Staff** (www44.zippyshare.com/v/PAJnvyv2/file.html)

Filecrypt test with cnl/dlc container (without captcha):
**External links are only visible to Support Staff****External links are only visible to Support Staff** (filecrypt.cc/Container/BF0DB46AB8.html)

Zippyshare directlink:


Linkgrabber with filecryptlink as directlink and without CNL/DLC:


Filecrypt CNL/DLC (with my browser):


I can grab it with trigger "A new link has been added" (with cnl/dlc) with all tries:
Code:
// See new links
// Trigger: A new link has been added
var myPLink = link;
alert(myPLink.getURL() + "\n");

But I hate workarounds. The option "Synchronous execution of script" is better off with alert function.

Bug? Security reasons?

My old workaround for filecrypt and cnl:
Spoiler:
Code:
//Filecrypt CNL-Test in JS
//disablePermissionChecks();
//setNotifyOnException(false);
require("https" + "://gist.githubusercontent.com/gabrysiak/3dedf160fd2ee719c2b6/raw/1052dfbc0989b8e444df6098ce253d42fa1e6bb7");//base64 en- and decode in js

var myBr = getBrowser();
var html = myBr.getPage("**External links are only visible to Support Staff**);//testlink with CNL and without captcha
var res = html.match(/CNLPOP\('([^']+)', '([^']+)', '([^']+)'/i);
var jk = res[2];
var crypted = res[3];
var crypted_nobase64 = base64_decode(crypted);

var jk_decoded = "";
for (var i = 0; i < jk.length; i += 2) {
    var tmp = jk.substr(i, 2);
    jk_decoded += String.fromCharCode(parseInt(tmp, 16));
}

function bin2string(array) {
    var result = "";
    for (var i = 0; i < array.length; ++i) {
        result += (String.fromCharCode(array[i]));
    }
    return result;
}

//source github.com/kraynel/js-rijndael
//mcrypt/cbc/rijndael-128
var mcrypt = mcrypt ? mcrypt : new function() {
    var ciphers = {
        "rijndael-128": [16, 32]
    }

    var blockCipherCalls = {};
    blockCipherCalls['rijndael-128'] = function(cipher, block, key, encrypt) {
        if (encrypt)
            Rijndael.Encrypt(block, key);
        else
            Rijndael.Decrypt(block, key);
        return block;
    };

    var pub = {};

    pub.Encrypt = function(message, IV, key, cipher, mode) {
        return pub.Crypt(true, message, IV, key, cipher, mode);
    };

    pub.Decrypt = function(ctext, IV, key, cipher, mode) {
        return pub.Crypt(false, ctext, IV, key, cipher, mode);
    };

    pub.Crypt = function(encrypt, text, IV, key, cipher, mode) {
        if (key) cKey = key;
        else key = cKey;
        if (cipher) cCipher = cipher;
        else cipher = cCipher;
        if (mode) cMode = mode;
        else mode = cMode;
        if (!text)
            return true;
        if (blockCipherCalls[cipher].init)
            blockCipherCalls[cipher].init(cipher, key, encrypt);
        var blockS = ciphers[cipher][0];
        var chunkS = blockS;
        var iv = new Array(blockS);
        switch (mode) {
            case 'cfb':
                chunkS = 1;
            case 'cbc':
            case 'ncfb':
            case 'nofb':
            case 'ctr':
                if (!IV)
                    throw "mcrypt.Crypt: IV Required for mode " + mode;
                if (IV.length != blockS)
                    throw "mcrypt.Crypt: IV must be " + blockS + " characters long for " + cipher;
                for (var i = blockS - 1; i >= 0; i--)
                    iv[i] = IV.charCodeAt(i);
                break;
            case 'ecb':
                break;
            default:
                throw "mcrypt.Crypt: Unsupported mode of opperation" + cMode;
        }
        var chunks = Math.ceil(text.length / chunkS);
        var orig = text.length;
        text += Array(chunks * chunkS - orig + 1).join(String.fromCharCode(0));
        var out = '';
        switch (mode) {
            case 'ecb':
                for (var i = 0; i < chunks; i++) {
                    for (var j = 0; j < chunkS; j++)
                        iv[j] = text.charCodeAt((i * chunkS) + j);
                    blockCipherCalls[cipher](cipher, iv, cKey, encrypt);
                    for (var j = 0; j < chunkS; j++)
                        out += String.fromCharCode(iv[j]);
                }
                break;
            case 'cbc':
                if (encrypt) {
                    for (var i = 0; i < chunks; i++) {
                        for (var j = 0; j < chunkS; j++)
                            iv[j] = text.charCodeAt((i * chunkS) + j) ^ iv[j];
                        blockCipherCalls[cipher](cipher, iv, cKey, true);
                        for (var j = 0; j < chunkS; j++)
                            out += String.fromCharCode(iv[j]);
                    }
                } else {
                    for (var i = 0; i < chunks; i++) {
                        var temp = iv;
                        iv = new Array(chunkS);
                        for (var j = 0; j < chunkS; j++)
                            iv[j] = text.charCodeAt((i * chunkS) + j);
                        var decr = iv.slice(0);
                        blockCipherCalls[cipher](cipher, decr, cKey, false);
                        for (var j = 0; j < chunkS; j++)
                            out += String.fromCharCode(temp[j] ^ decr[j]);
                    }
                }
                break;
            case 'cfb':
                for (var i = 0; i < chunks; i++) {
                    var temp = iv.slice(0);
                    blockCipherCalls[cipher](cipher, temp, cKey, true);
                    temp = temp[0] ^ text.charCodeAt(i);
                    iv.push(encrypt ? temp : text.charCodeAt(i));
                    iv.shift();
                    out += String.fromCharCode(temp);
                }
                out = out.substr(0, orig);
                break;
            case 'ncfb':
                for (var i = 0; i < chunks; i++) {
                    blockCipherCalls[cipher](cipher, iv, cKey, true);
                    for (var j = 0; j < chunkS; j++) {
                        var temp = text.charCodeAt((i * chunkS) + j);
                        iv[j] = temp ^ iv[j];
                        out += String.fromCharCode(iv[j]);
                        if (!encrypt)
                            iv[j] = temp;
                    }
                }
                out = out.substr(0, orig);
                break;
            case 'nofb':
                for (var i = 0; i < chunks; i++) {
                    blockCipherCalls[cipher](cipher, iv, cKey, true);
                    for (var j = 0; j < chunkS; j++)
                        out += String.fromCharCode(text.charCodeAt((i * chunkS) + j) ^ iv[j]);
                }
                out = out.substr(0, orig);
                break;
            case 'ctr':
                for (var i = 0; i < chunks; i++) {
                    temp = iv.slice(0);
                    blockCipherCalls[cipher](cipher, temp, cKey, true);
                    for (var j = 0; j < chunkS; j++)
                        out += String.fromCharCode(text.charCodeAt((i * chunkS) + j) ^ temp[j]);
                    var carry = 1;
                    var index = chunkS;
                    do {
                        index--;
                        iv[index] += 1;
                        carry = iv[index] >> 8;
                        iv[index] &= 255;
                    } while (carry)
                }
                out = out.substr(0, orig);
                break;
        }
        if (blockCipherCalls[cipher].deinit)
            blockCipherCalls[cipher].deinit(cipher, key, encrypt);
        return out;
    };

    pub.get_block_size = function(cipher, mode) {
        if (!cipher) cipher = cCipher;
        if (!ciphers[cipher])
            return false;
        return ciphers[cipher][0];
    }

    pub.get_cipher_name = function(cipher) {
        if (!cipher) cipher = cCipher;
        if (!ciphers[cipher])
            return false;
        return cipher;
    }

    pub.get_iv_size = function(cipher, mode) {
        if (!cipher) cipher = cCipher;
        if (!ciphers[cipher])
            return false;
        return ciphers[cipher][0];
    }

    pub.get_key_size = function(cipher, mode) {
        if (!cipher) cipher = cCipher;
        if (!ciphers[cipher])
            return false;
        return ciphers[cipher][1];
    }

    pub.list_algorithms = function() {
        var ret = [];
        for (var i in ciphers)
            ret.push(i);
        return ret;
    }

    pub.list_modes = function() {
        return ['ecb', 'cbc', 'cfb', 'ncfb', 'nofb', 'ctr'];
    }

    var cMode = 'cbc';
    var cCipher = 'rijndael-128';
    var cKey = '12345678911234567892123456789312';

    return pub;
};

var Rijndael = Rijndael ? Rijndael : new function() {
    var pub = {};

    pub.Encrypt = function(block, key) {
        crypt(block, key, true);
    }
    pub.Decrypt = function(block, key) {
        crypt(block, key, false);
    }

    var sizes = [16, 24, 32];

    var rounds = [
        [10, 12, 14], //	16
        [12, 12, 14], //	24
        [14, 14, 14]
    ]; //	32
    var expandedKeys = {};

    var ExpandKey = function(key) {
        if (!expandedKeys[key]) {
            var kl = key.length,
                ks, Rcon = 1;
            ks = 15 << 5;
            keyA = new Array(ks);
            for (var i = 0; i < kl; i++)
                keyA[i] = key.charCodeAt(i);
            for (var i = kl; i < ks; i += 4) {
                var temp = keyA.slice(i - 4, i);
                if (i % kl == 0) {
                    temp = [Sbox[temp[1]] ^ Rcon, Sbox[temp[2]],
                        Sbox[temp[3]], Sbox[temp[0]]
                    ];
                    if ((Rcon <<= 1) >= 256)
                        Rcon ^= 0x11b;
                } else if ((kl > 24) && (i % kl == 16))
                    temp = [Sbox[temp[0]], Sbox[temp[1]],
                        Sbox[temp[2]], Sbox[temp[3]]
                    ];
                for (var j = 0; j < 4; j++)
                    keyA[i + j] = keyA[i + j - kl] ^ temp[j];
            }
            expandedKeys[key] = keyA;
        }
        return expandedKeys[key];
    }

    var crypt = function(block, key, encrypt) {
        var bB = block.length;
        var kB = key.length;
        var bBi = 0;
        var kBi = 0;
        switch (bB) {
            case 32:
                bBi++;
            case 24:
                bBi++;
            case 16:
                break;
            default:
                throw 'rijndael: Unsupported block size: ' + block.length;
        }
        switch (kB) {
            case 32:
                kBi++;
            case 24:
                kBi++;
            case 16:
                break;
            default:
                throw 'rijndael: Unsupported key size: ' + key.length;
        }
        var r = rounds[bBi][kBi];
        key = ExpandKey(key);
        var end = r * bB;
        if (encrypt) {
            AddRoundKey(block, key.slice(0, bB));
            var SRT = ShiftRowTab[bBi];
            for (var i = bB; i < end; i += bB) {
                SubBytes(block, Sbox);
                ShiftRows(block, SRT);
                MixColumns(block);
                AddRoundKey(block, key.slice(i, i + bB));
            }
            SubBytes(block, Sbox);
            ShiftRows(block, SRT);
            AddRoundKey(block, key.slice(i, i + bB));
        } else {
            AddRoundKey(block, key.slice(end, end + bB));
            var SRT = ShiftRowTab_Inv[bBi];
            ShiftRows(block, SRT);
            SubBytes(block, Sbox_Inv);
            for (var i = end - bB; i >= bB; i -= bB) {
                AddRoundKey(block, key.slice(i, i + bB));
                MixColumns_Inv(block);
                ShiftRows(block, SRT);
                SubBytes(block, Sbox_Inv);
            }
            AddRoundKey(block, key.slice(0, bB));
        }
    }

    var Sbox = new Array(99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171,
        118, 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192, 183, 253,
        147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154,
        7, 18, 128, 226, 235, 39, 178, 117, 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227,
        47, 132, 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207, 208, 239, 170,
        251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168, 81, 163, 64, 143, 146, 157, 56, 245,
        188, 182, 218, 33, 16, 255, 243, 210, 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61,
        100, 93, 25, 115, 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, 224,
        50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121, 231, 200, 55, 109, 141, 213,
        78, 169, 108, 86, 244, 234, 101, 122, 174, 8, 186, 120, 37, 46, 28, 166, 180, 198, 232, 221,
        116, 31, 75, 189, 139, 138, 112, 62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29,
        158, 225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223, 140, 161,
        137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22);
    //row	0	1	2	3		block Bytes
    var rowshifts = [
        [0, 1, 2, 3], //16
        [0, 1, 2, 3], //24
        [0, 1, 3, 4]
    ]; //32

    var ShiftRowTab = Array(3);
    for (var i = 0; i < 3; i++) {
        ShiftRowTab[i] = Array(sizes[i]);
        for (var j = sizes[i]; j >= 0; j--)
            ShiftRowTab[i][j] = (j + (rowshifts[i][j & 3] << 2)) % sizes[i];
    }
    var Sbox_Inv = new Array(256);
    for (var i = 0; i < 256; i++)
        Sbox_Inv[Sbox[i]] = i;
    var ShiftRowTab_Inv = Array(3);
    for (var i = 0; i < 3; i++) {
        ShiftRowTab_Inv[i] = Array(sizes[i]);
        for (var j = sizes[i]; j >= 0; j--)
            ShiftRowTab_Inv[i][ShiftRowTab[i][j]] = j;
    }
    var xtime = new Array(256);
    for (var i = 0; i < 128; i++) {
        xtime[i] = i << 1;
        xtime[128 + i] = (i << 1) ^ 0x1b;
    }

    var SubBytes = function(state, sbox) {
        for (var i = state.length - 1; i >= 0; i--)
            state[i] = sbox[state[i]];
    }

    var AddRoundKey = function(state, rkey) {
        for (var i = state.length - 1; i >= 0; i--)
            state[i] ^= rkey[i];
    }

    var ShiftRows = function(state, shifttab) {
        var h = state.slice(0);
        for (var i = state.length - 1; i >= 0; i--)
            state[i] = h[shifttab[i]];
    }

    var MixColumns = function(state) {
        for (var i = state.length - 4; i >= 0; i -= 4) {
            var s0 = state[i + 0],
                s1 = state[i + 1];
            var s2 = state[i + 2],
                s3 = state[i + 3];
            var h = s0 ^ s1 ^ s2 ^ s3;
            state[i + 0] ^= h ^ xtime[s0 ^ s1];
            state[i + 1] ^= h ^ xtime[s1 ^ s2];
            state[i + 2] ^= h ^ xtime[s2 ^ s3];
            state[i + 3] ^= h ^ xtime[s3 ^ s0];
        }
    }

    var MixColumns_Inv = function(state) {
        for (var i = state.length - 4; i >= 0; i -= 4) {
            var s0 = state[i + 0],
                s1 = state[i + 1];
            var s2 = state[i + 2],
                s3 = state[i + 3];
            var h = s0 ^ s1 ^ s2 ^ s3;
            var xh = xtime[h];
            var h1 = xtime[xtime[xh ^ s0 ^ s2]] ^ h;
            var h2 = xtime[xtime[xh ^ s1 ^ s3]] ^ h;
            state[i + 0] ^= h1 ^ xtime[s0 ^ s1];
            state[i + 1] ^= h2 ^ xtime[s1 ^ s2];
            state[i + 2] ^= h1 ^ xtime[s2 ^ s3];
            state[i + 3] ^= h2 ^ xtime[s3 ^ s0];
        }
    }
    return pub;
};

alert(mcrypt.Decrypt(crypted_nobase64, jk_decoded, jk_decoded, 'rijndael-128', 'cbc').replace(/\x00+$/g, '') + "\n\n");
__________________
Join 9kw.eu Captcha Service now and let your JD continue downloads while you sleep.

Last edited by thecoder2012; 26.06.2019 at 11:29.
Reply With Quote
  #795  
Old 21.06.2019, 10:50
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,286
Default

Quote:
Originally Posted by thecoder2012 View Post
Bug? Security reasons?
We don't want to provide access to the internal url as this can be abused or the internal url is something purely internal but I've added getPluginURL method with next core update
__________________
JD-Dev & Server-Admin
Reply With Quote
  #796  
Old 23.06.2019, 20:23
the Dark
Guest
 
Posts: n/a
Default

Hi guys,

I'm looking for a script to load files automatically by watchfolder every 10,15 or 20 days.
e.g.
*.dlc in /bla/bla/DLC //<--- path watchfolder
5 // time in days
/as/example/deletefilesfolder //<--- path to there only watchfolder files get downloaded (manually downloaded files should stay in another path)

if the files got downloaded I want to delete them after about 5 minutes to keep the drive clean (needs to be a seperate folder)

as I have nothing to do with coding and found no solution I'm sure you can help me!

thanks in advance
Reply With Quote
  #797  
Old 24.06.2019, 13:48
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

Quote:
Originally Posted by the Dark View Post
I'm looking for a script to load files automatically by watchfolder every 10,15 or 20 days.
Code:
Settings > Advanced Settings > FolderWatch.checkinterval

1 Day = 86400000 milliseconds
To check every 5 days, set it to 432000000 (86400000 * 5)

Quote:
Originally Posted by the Dark View Post
/as/example/deletefilesfolder //<--- path to there only watchfolder files get downloaded (manually downloaded files should stay in another path)
Create Packagizer rule:
Code:
If sourceurl(s) contains : file:/*.dlc
then set... Download Directory: /as/example/deletefilesfolder

Quote:
Originally Posted by the Dark View Post
if the files got downloaded I want to delete them after about 5 minutes to keep the drive clean (needs to be a seperate folder)
Not very clear what you mean. What to you want to delete? The DLC or the downloaded file?
Reply With Quote
  #798  
Old 24.06.2019, 14:14
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,286
Default

You can specify download folder in folderwatch crawljob directly
__________________
JD-Dev & Server-Admin
Reply With Quote
  #799  
Old 24.06.2019, 14:24
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,533
Default

Quote:
Originally Posted by Jiaz View Post
You can specify download folder in folderwatch crawljob directly
Quote:
Originally Posted by the Dark View Post
*.dlc in /bla/bla/DLC //<--- path watchfolder
Packagzier rule suggested based on example.
Reply With Quote
  #800  
Old 24.06.2019, 21:57
the Dark
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by mgpai View Post
Not very clear what you mean. What to you want to delete? The DLC or the downloaded file?
I want to delete all downloaded files every 5 minutes to keep the hard drive clean (hard drive space is limited)

Quote:
Originally Posted by mgpai View Post
Settings > Advanced Settings > FolderWatch.checkinterval
Is there a way to put it into download directly not in linkcrawler/-list ?

Quote:
Originally Posted by mgpai View Post
1 Day = 86400000 milliseconds
To check every 5 days, set it to 432000000 (86400000 * 5)
Will this work even if jDownloader crashes or is it better to set every 15th and 30th? possible?

Last edited by the Dark; 24.06.2019 at 23:27.
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 18:08.
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.