JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1  
Old 01.06.2021, 11:42
groinksan groinksan is offline
Wind Gust
 
Join Date: Dec 2018
Posts: 40
Default Rapidgator.net - Event Scripter to extract MD5 checksum

I'm just starting out on using Event Scripter. I've so far successfully modified a script to fit most of my needs:

Code:
// Rapidgator Export download URLs
// Trigger : "DownloadList Contextmenu Button Pressed"

if (name == "Rapidgator Export URLs") {
    var exportFolder = JD_HOME + "/auto/export/"; // <- Folder for exporting the text files
    var now = new Date().toString().substring(4, 24).replace(/:/g, "."); // <- Timestamp used in file name
    var exportFile = now + " - DL Selection.txt"; // <- Filename for exporting the 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();
        var fileUUID = link.getUUID();
        urls.push(fileUUID + "," + downloadURL + "," + fileName);
    }

    if (!getPath(exportFolder).exists()) getPath(exportFolder).mkdirs();
    writeFile(exportFolder + exportFile, urls.join("\r\n"), true);
}
JD is already running the checksum on the file upon completion, and it somehow saves it to the Downloadlist. When I enable the "Checksum" field in the listing, it shows "[MD5] xxxxxxxxx" for all the files related to Rapidgator.

What I'm trying to do now is access the previously saved MD5 checksum in my script, so that I can save it to the text file. I already checked the API listing, but didn't find anything referring to the checksum field. The only thing I've found so far is getChecksum(), but my understanding is that it will re-process the file and generate the checksum, and I don't think I have to do that since the checksum is already stored in the downloadlist.

Last edited by groinksan; 01.06.2021 at 12:01.
Reply With Quote
  #2  
Old 01.06.2021, 12:00
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,508
Default

Code:
link.getProperty("HASHINFO");
Reply With Quote
  #3  
Old 01.06.2021, 12:06
groinksan groinksan is offline
Wind Gust
 
Join Date: Dec 2018
Posts: 40
Default

Worked!!! That was fast! Thanks so much!!!

Code:
// Rapidgator Export download URLs
// Trigger : "DownloadList Contextmenu Button Pressed"

if (name == "Rapidgator Export URLs") {
    var exportFolder = JD_HOME + "/auto/export/"; // <- Folder for exporting the text files
    var now = new Date().toString().substring(4, 24).replace(/:/g, "."); // <- Timestamp used in file name
    var exportFile = now + " - DL Selection.txt"; // <- Filename for exporting the 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();
        var fileUUID = link.getUUID();
        var fileMD5 = link.getProperty("HASHINFO");
        
        urls.push(fileUUID + "," + fileMD5 + "," + downloadURL + "," + fileName);
    }

    if (!getPath(exportFolder).exists()) getPath(exportFolder).mkdirs();
    writeFile(exportFolder + exportFile, urls.join("\r\n"), true);
}
Reply With Quote
  #4  
Old 01.06.2021, 12:20
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,108
Default

Wait for next Core update, then CrawledLink/DownloadLink will have new method getHashInfo returning String representation in form
Type|0,1(Trustworthy flag)|0,1(Forced flag)|HASH
Trustworthy=source of this HASH value
Forced=hash is forced by user/scripts
__________________
JD-Dev & Server-Admin
Reply With Quote
  #5  
Old 01.06.2021, 12:20
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,108
Default

@mgpai: you were faster
__________________
JD-Dev & Server-Admin
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 13:40.
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.