JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1801  
Old 03.08.2021, 21:16
BJN01 BJN01 is offline
JD Adviser
 
Join Date: Jan 2020
Posts: 104
Default

done, but it doesn't work, it doesn't do anything.

to get something I have to insert the replace + below, after "if" , where I left the <//.....> in the code posted ...
and I have the feeling that in that position you modify all the links, not just the ones that interest me.

could I have misinterpreted the chain between "if ..." and {}?
I always have problems with (and {...




@Jiaz :it would be nice, but I'm not knowledgeable on the subject
Reply With Quote
  #1802  
Old 03.08.2021, 21:24
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,317
Default

Quote:
Originally Posted by BJN01 View Post
done, but it doesn't work, it doesn't do anything.
You are querying crawled packages instead of crawled links (I didn't notice it earlier).

Edit: Guess you want to modify the package name after all. You will have to query the download host, but replace 'link.package.name'. Please note, the package may contain links from multiple hosts, in which case it could be overwritten for each matching host.

Last edited by mgpai; 03.08.2021 at 21:47.
Reply With Quote
  #1803  
Old 04.08.2021, 13:45
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,317
Default

Code:
/*
    View extracted files
    Trigger : Downloadlist contextmenu button pressed
    Customize context menu > Add a new "Eventscripter Trigger" button > Rename it to "View extracted files"
*/

if (name == "View extracted files") {
    try {
        var output = getPath(JD_HOME + "/tmp/archive_info.htm");
        var archive = dlSelection.contextLink.archive;
        var files = archive.info.extractionInfo.files
        var htm = "<table border=\"1\" align=center cellspacing=0 cellpadding=5]><th>" + archive.name + "</th>";

        files.forEach(function(file) {
            htm += "<tr><td>" + file + "</td></tr>";
        })
        
        output.delete();
        writeFile(output, htm, true);
        openURL("file://" + output);
    } catch (e) {};
}

Last edited by mgpai; 04.08.2021 at 16:51. Reason: Added button name check
Reply With Quote
  #1804  
Old 04.08.2021, 14:02
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 72,232
Default

@mgpai: please note that this only works for extraction within the running session. After restart, those details are not available anymore
__________________
JD-Dev & Server-Admin
Reply With Quote
  #1805  
Old 04.08.2021, 14:09
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,317
Default

Quote:
Originally Posted by Jiaz View Post
@mgpai: please note that this only works for extraction within the running session. After restart, those details are not available anymore
It was/is working after a restart. Had also tested it before posting the script. Related files still seem to be present in the cfg/archives folder after a restart. Can you please check and confirm?
Reply With Quote
  #1806  
Old 04.08.2021, 14:14
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 72,232
Default

@mgpai: you are absolute right!
__________________
JD-Dev & Server-Admin
Reply With Quote
  #1807  
Old 04.08.2021, 15:36
BJN01 BJN01 is offline
JD Adviser
 
Join Date: Jan 2020
Posts: 104
Default

I did some testing and I guess the problem arises from the fact that I can't recover the host name. (through alert I always see "undefined" ...) ...

----------
getDownloadHost , or getContainerURL , or downloadHost
---------- > "undefined"

I can't find the host of the link that generated the package.

Summing up :

I go to the web page that interests me, copy the "initial link" I am looking for
---> jd works, finds the files and packages them (OK).

now ,
when the package is finished my script <should> check if the <"initial link"> that generated the package is == to a given host, [or what if the packet "arrives" from a given host? ] (p.s= the files contained in the package are all from the same host)
if so make some changes to the package name.


.... but at the moment I get "undefined" ... so how do I locate this damn Hostname of the package / starting link (I'm in the CrawledLink / linkgabber window) ???
Reply With Quote
  #1808  
Old 04.08.2021, 16:06
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,317
Default

Quote:
Originally Posted by BJN01 View Post
... I can't recover the host name.
Code:
getAllCrawledPackages().forEach(function(package) {
    var hosts = [];

    package.getDownloadLinks().forEach(function(link) {
        var host = link.downloadHost;

        if (hosts.indexOf(host) == -1) {
            hosts.push(host);
        }
    })

    if (hosts.length == 1) {
        host = hosts[0];

        if (host == "myhost.com") {
            package.name = package.name.replace("old_string", "new_string");
        }
    }
})
Reply With Quote
  #1809  
Old 05.08.2021, 11:45
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,317
Default

Code:
/*
    Remove orphaned archive settings files from "cfg/archives" folder
    Trigger : Toolbar button pressed
    Customize toolbar > Add a new "Eventscripter Trigger" button > Rename it to "Remove archive settings files"
*/

if (name == "Remove archive settings files") {
    var ids = [];

    getAllFilePackages().forEach(function(package) {
        package.archives.forEach(function(archive) {
            ids.push(archive.settingsID);
        })
    })

    getPath(JD_HOME + "/cfg/archives").children.forEach(function(filePath) {
        try {
            var id = filePath.toString().match(/v2_(.+)\.json/)[1];

            if (ids.indexOf(id) == -1) {
                filePath.delete();
            }
        } catch (e) {};
    })
}
Reply With Quote
  #1810  
Old 06.08.2021, 00:30
BJN01 BJN01 is offline
JD Adviser
 
Join Date: Jan 2020
Posts: 104
Default

@mgpai = thanks, it works perfectly.
Reply With Quote
  #1811  
Old 06.08.2021, 10:37
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 72,232
Default

Big THANKS to mgpai for his great help/support and his time!
__________________
JD-Dev & Server-Admin
Reply With Quote
  #1812  
Old 13.08.2021, 09:24
ThatGuy ThatGuy is offline
Modem User
 
Join Date: Feb 2021
Posts: 4
Default

Quote:
Originally Posted by mgpai View Post
Code:
/*
    Move extracted files
    Trigger : Archive extraction finished
*/    

archive.extractedFilePaths.forEach(function(filePath) {
    filePath.moveTo(archive.folder);
    filePath.parent.delete();
})
Thanks! This is very close to what I want. The only thing that isn't working is that now the files go to the same folder that the archive is set to download to, however I want it to go into a folder named after the archive. I've tried to work around this by combining it with the subfolder tickbox in the browser, and then it works perfectly. The only issue then is that it creates folders to contain non-archive files too, like a single video. I'm very close, I think I just need to add another line into your code to create a subfolder within (archive.folder), but I'm not sure how to do that.

Thanks again for the help so far!
Reply With Quote
  #1813  
Old 13.08.2021, 10:22
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,317
Default

Quote:
Originally Posted by ThatGuy View Post
... I want it to go into a folder named after the archive.
Code:
/*
    Move extracted files
    Trigger : Archive extraction finished
*/    

archive.extractedFilePaths.forEach(function(filePath) {
    filePath.moveTo(archive.folder + "/" + archive.name);
    filePath.parent.delete();
})
Reply With Quote
  #1814  
Old 14.08.2021, 06:43
Dockel Dockel is offline
JD VIP
 
Join Date: Feb 2020
Posts: 328
Default

Is there a script enabling to download files from zippy and uloz?
__________________
Aktuelles Windows
Reply With Quote
  #1815  
Old 14.08.2021, 07:54
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,317
Default

Quote:
Originally Posted by Dockel View Post
Is there a script enabling to download files from zippy and uloz?
If you mean bypass geo-block, I believe there is already a script elsewhere in the forum which uses proxies to do just that.
Reply With Quote
  #1816  
Old 14.08.2021, 08:11
Dockel Dockel is offline
JD VIP
 
Join Date: Feb 2020
Posts: 328
Default

Yes, exactly, that is what I meant. So it is not in this thread here, I assume...cannot find one else...keywords to look for are geo blocking script / script geo-block / zippy blocking...or any else?
__________________
Aktuelles Windows
Reply With Quote
  #1817  
Old 18.08.2021, 17:16
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 72,232
Default

@Dockel: You will have to use working proxies/VPN to bypass the geo restriction by zippy/uloz.
__________________
JD-Dev & Server-Admin
Reply With Quote
  #1818  
Old 18.08.2021, 18:28
Dockel Dockel is offline
JD VIP
 
Join Date: Feb 2020
Posts: 328
Default

OK, it does not appear to be that easy to do it.
__________________
Aktuelles Windows
Reply With Quote
  #1819  
Old 19.08.2021, 07:19
iLITT iLITT is offline
I will play nice!
 
Join Date: Aug 2021
Posts: 4
Default

Hello! Can someone please make a script as follows...? In case when the download stops on dropped network connection, script makes program to unlimitedly auto force-start retry every 5 seconds untill connection is restored and downlod is finished. Please do not ask why the script is needed as there is not usual network connditions where I am located. Thanks!
Reply With Quote
  #1820  
Old 19.08.2021, 11:58
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 72,232
Default

@Dockel: I would just setup working proxy in Settings->Connections that work fine with those hosters. No script required.
__________________
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 14:29.
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 - 2021, Jelsoft Enterprises Ltd.