JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #621  
Old 06.03.2019, 16:12
qayaq qayaq is offline
Baby Loader
 
Join Date: Mar 2019
Posts: 5
Default

Hi MGPAI

Do you take requests?

I need a script that can do pre filtering for instagram by checking file on disk with download list and disable/remove those links that are already on disk and not check with actual download attempt.

Thanks in advance for your answer!
Reply With Quote
  #622  
Old 07.03.2019, 15:50
Bach Bach is offline
Junior Loader
 
Join Date: Jul 2017
Posts: 12
Default how to embed scripts

Hi
I tried to integrate the scripts from thecoder2012, but did not work. Can someone give me a guide on how to properly integrate scripts.

Many Thanks
Reply With Quote
  #623  
Old 07.03.2019, 18:23
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 65,398
Default

What problems do you have with the script? any errors? what exactly do you need help with?
__________________
JD-Dev & Server-Admin
Reply With Quote
  #624  
Old 07.03.2019, 21:11
Bach Bach is offline
Junior Loader
 
Join Date: Jul 2017
Posts: 12
Default

Quote:
Originally Posted by mgpai View Post
Export download URLs (Linkgrabber List)
  • Default folder: "<jdownloader>\auto\history" (e.g "c:\jdownloader\auto\export")
  • Default file name: "<timestamp> - LG Selection.txt" (e.g. "Nov 25 2016 17.26.44 - LG Selection.txt")
Code:
// Export download URLs
// Trigger : "Linkgrabber Contextmenu Button Pressed"

if (name == "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 + " - LG Selection.txt"; // <- Filename for exporting the URLs
    var links = lgSelection.getLinks();
    var urls = [];

    for (i = 0; i < links.length; i++) {
        var link = links[i];
        var fileName = link.getName();
        var downloadURL = link.getContentURL();
        urls.push(downloadURL + "," + fileName);
    }

    if (!getPath(exportFolder).exists()) getPath(exportFolder).mkdirs();
    writeFile(exportFolder + exportFile, urls.join("\r\n"), true);
}

Export Download URLs (Download List)
  • Default folder: "<jdownloader>\auto\history" (e.g "c:\jdownloader\auto\export")
  • Default file name: "<timestamp> - DL Selection.txt" (e.g. "Nov 25 2016 17.26.44 - DL Selection.txt")
Code:
// Export download URLs
// Trigger : "DownloadList Contextmenu Button Pressed"

if (name == "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();
        urls.push(downloadURL + "," + fileName);
    }

    if (!getPath(exportFolder).exists()) getPath(exportFolder).mkdirs();
    writeFile(exportFolder + exportFile, urls.join("\r\n"), true);
}

Hi mgpai

What and how do I have to enter exactly at name == Export Urls.
Reply With Quote
  #625  
Old 07.03.2019, 21:19
Bach Bach is offline
Junior Loader
 
Join Date: Jul 2017
Posts: 12
Default

Quote:
Originally Posted by Jiaz View Post
What problems do you have with the script? any errors? what exactly do you need help with?
The script shows no errors, but does not stop the download as soon as there is no more credit at 9kw.
Reply With Quote
  #626  
Old 07.03.2019, 23:30
Bach Bach is offline
Junior Loader
 
Join Date: Jul 2017
Posts: 12
Default

Quote:
Originally Posted by mgpai View Post
Code:
// Unskip 'account missing' links at user specified interval
// Trigger Required : "Interval"
// Set interval to 3600000 (60 minutes)

var links = getAllDownloadLinks();

for (i = 0; i < links.length; i++) {
    var link = links[i];
    if (link.isSkipped() && link.getSkippedReason() == "NO_ACCOUNT") {
        link.setSkipped(false);
    }
}
Hi

Would it be possible to use this script also for 'skipped - captcha input' required, if so how do I have to change the script.
Reply With Quote
  #627  
Old 08.03.2019, 12:45
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 611
Default

Quote:
Originally Posted by qayaq View Post
... script ... for instagram ... disable/remove ... links that are already on disk ...
Code:
// Disable (instagram) links if file exists on disk
// Trigger: Remote API Event Fired

if (event.id == "ADD_PACKAGE") {
    var data = JSON.parse(event.data);
    var package = getDownloadPackageByUUID(data.uuid);
    package.getDownloadLinks().forEach(function(link) {
        if (link.getHost() != "instagram.com") return;
        if (!getPath(link.getDownloadPath()).exists()) return;
        link.setEnabled(false);
    })
}
Reply With Quote
  #628  
Old 08.03.2019, 12:58
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 611
Default

Quote:
Originally Posted by Bach View Post
What and how do I have to enter exactly at name == Export Urls.
  1. Customize context menu (Use the button in script editor top panel or right click on the respective context meuns.)
  2. Create new "Eventscripter Trigger" button
  3. Rename it to "Export URLs" (without quotes, case-sensitvie)
  4. Change Icon (Optional)

Quote:
Originally Posted by Bach View Post
The script shows no errors, but does not stop the download as soon as there is no more credit at 9kw.
Try Changing:
Code:
setDownloadsPaused(true);
to
Code:
stopDownloads();

Quote:
Originally Posted by Bach View Post
Would it be possible to use this script also for 'skipped - captcha input' required ...
Replace (quote included):
Code:
"NO_ACCOUNT"
with (quote included):
Code:
"CAPTCHA"
Reply With Quote
  #629  
Old 08.03.2019, 13:08
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 611
Default

@bach: Looking at the timestamps of your posts, it seems like they are only visible to me/public only after they are approved by mods. Could be the same reason I missed one of them last time around. You can contact me in JD Chat if you find any of your posts missing here.
Reply With Quote
  #630  
Old 08.03.2019, 14:12
Bach Bach is offline
Junior Loader
 
Join Date: Jul 2017
Posts: 12
Default

Quote:
Originally Posted by thecoder2012 View Post
Simple example for high queue:
Code:
// Queue check for 9kw.eu
// Trigger Required: Interval

var newInterval = 10000;
if(interval == newInterval){
    check9kw_queue();
}else{
    interval = newInterval;
}

function check9kw_queue (){
	var settings_9kw = "org.jdownloader.captcha.v2.solver.solver9kw.Captcha9kwSettings";
	var https = callAPI("config", "get", settings_9kw, null, "https");
	var servercheck_page = '://www.9kw.eu/grafik/servercheck.json';
	var servercheck;
	if (https == 1) {
	    servercheck = getPage("https" + servercheck_page);
	} else {
	    servercheck = getPage("http" + servercheck_page);
	}

	if (servercheck.match(/^\{/)) {
	    var queue = JSON.parse(servercheck).queue;

	    if (parseInt(queue) > 100){
		//callAPI("downloadsV2", "setStopMark", linkUUID, -1);//Set stop mark on link
		//callAPI("downloadsV2", "setStopMark", -1, packageUUID);//Set stop mark on package
	        setDownloadsPaused(true);
	        //alert("High queue. " + "(" + queue + ")");
	    }else{
		//callAPI("downloadsV2", "removeStopMark");//Remove stop mark
	        setDownloadsPaused(false);
	    }
	}
}
And one example for credits:
Code:
// Check for enough credits (captcha service 9kw.eu)
// Trigger Required: Interval

var newInterval = 30000;
if(interval == newInterval){
    check9kw_credits();
}else{
    interval = newInterval;
}

function check9kw_credits (){
	var settings_9kw = "org.jdownloader.captcha.v2.solver.solver9kw.Captcha9kwSettings";
	var apikey = callAPI("config", "get", settings_9kw, null, "ApiKey");
	var prio = callAPI("config", "get", settings_9kw, null, "prio");
	var confirm = callAPI("config", "get", settings_9kw, null, "confirm");
	var https = callAPI("config", "get", settings_9kw, null, "https");
	var credits_page = '://www.9kw.eu/index.cgi?action=usercaptchaguthaben&apikey=' + apikey;
	var credits;
	if (https == 1) {
	    credits = getPage("https" + credits_page);
	} else {
	    credits = getPage("http" + credits_page);
	}

	if (credits.match(/^\d+$/)) {
	    var min_credits = 30;
	    if (confirm) {
	        min_credits += 6;
	    }
	    if (prio) {
	        min_credits += parseInt(prio);
	    }
	    if (parseInt(credits) < min_credits) {
	        setDownloadsPaused(true);
	        //alert("Not enough credits. " + "(" + credits + ")");
	    }else{
	        setDownloadsPaused(false);
	    }
	}
}

Hi mgpai

I need your help for the queue script again.
The script shows errors in the 23 line.
Syntax Error: Unterminated objekt literal

Error Report

net.sourceforge.htmlunit.corejs.javascript.EcmaError: SyntaxError: Unterminated object literal (#23)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3629)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3613)
at net.sourceforge.htmlunit.corejs.javascript.NativeJSON.parse(NativeJSON.java:125)
at net.sourceforge.htmlunit.corejs.javascript.NativeJSON.execIdCall(NativeJSON.java:97)
at net.sourceforge.htmlunit.corejs.javascript.IdFunctionObject.call(IdFunctionObject.java:89)
at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1531)
at script.check9kw_queue(:23)
at script(:6)
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(JSHtmlUnitP ermissionRestricter.java:119)
at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3057)
at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.exec(InterpretedFunction.java:115)
at net.sourceforge.htmlunit.corejs.javascript.Context.evaluateString(Context.java:1212)
at org.jdownloader.extensions.eventscripter.ScriptThread.evalUNtrusted(ScriptThread.java:254)
at org.jdownloader.extensions.eventscripter.ScriptThread.executeScipt(ScriptThread.java:148)
at org.jdownloader.extensions.eventscripter.ScriptThread.run(ScriptThread.java:128)
Reply With Quote
  #631  
Old 08.03.2019, 14:30
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 611
Default

Quote:
Originally Posted by Bach View Post
... The script shows errors in the 23 line ...
Which script?

I have tested the first one, and it worked fine. I don't have a 9kw account, so I cannot check the second one, but that also appears to be fine. Look for any typos. If you post the script here (from your JD Installation) we can check it.
Reply With Quote
  #632  
Old 08.03.2019, 15:11
Bach Bach is offline
Junior Loader
 
Join Date: Jul 2017
Posts: 12
Default

Quote:
Originally Posted by mgpai View Post
Which script?

I have tested the first one, and it worked fine. I don't have a 9kw account, so I cannot check the second one, but that also appears to be fine. Look for any typos. If you post the script here (from your JD Installation) we can check it.

This is the script that works for me and it always displays the error and disables the script.

// Queue check for 9kw.eu
// Trigger Required: Interval

var newInterval = 10000;
if (interval == newInterval) {
check9kw_queue();
} else {
interval = newInterval;
}

function check9kw_queue() {
var settings_9kw = "org.jdownloader.captcha.v2.solver.solver9kw.Captcha9kwSettings";
var https = callAPI("config", "get", settings_9kw, null, "https");
var servercheck_page = '://www.9kw.eu/grafik/servercheck.json';
var servercheck;
if (https == 1) {
servercheck = getPage("https" + servercheck_page);
} else {
servercheck = getPage("http" + servercheck_page);
}

if (servercheck.match(/^\{/)) {
var queue = JSON.parse(servercheck).queue;

if (parseInt(queue) > 100) {
//callAPI("downloadsV2", "setStopMark", linkUUID, -1);//Set stop mark on link
//callAPI("downloadsV2", "setStopMark", -1, packageUUID);//Set stop mark on package
setDownloadsPaused(true);
//alert("High queue. " + "(" + queue + ")");
} else {
//callAPI("downloadsV2", "removeStopMark");//Remove stop mark
setDownloadsPaused(false);
}
}
}
Reply With Quote
  #633  
Old 08.03.2019, 15:27
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 611
Default

Quote:
Originally Posted by Bach View Post
This is the script that works for me and it always displays the error and disables the script.
Seeing as you have not modified it, this too is working fine for me. Can you contact me in JD Chat? I can help you troubleshoot it.
Reply With Quote
  #634  
Old 09.03.2019, 17:43
Bach Bach is offline
Junior Loader
 
Join Date: Jul 2017
Posts: 12
Default

Hi

These scripts work 'Check for enough credits (captcha service 9kw.eu)' and 'Unskip 'account missing' links at user specified interval (for captchas)'.

The problem, if these scripts are activated, no more captchas over 9kw will be solved.

Where could the mistake be?
Reply With Quote
  #635  
Old 09.03.2019, 18:37
qayaq qayaq is offline
Baby Loader
 
Join Date: Mar 2019
Posts: 5
Default

Quote:
Originally Posted by mgpai View Post
Code:
// Disable (instagram) links if file exists on disk
// Trigger: Remote API Event Fired

if (event.id == "ADD_PACKAGE") {
    var data = JSON.parse(event.data);
    var package = getDownloadPackageByUUID(data.uuid);
    package.getDownloadLinks().forEach(function(link) {
        if (link.getHost() != "instagram.com") return;
        if (!getPath(link.getDownloadPath()).exists()) return;
        link.setEnabled(false);
    })
}
Thank you!
Reply With Quote
  #636  
Old 12.03.2019, 10:48
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 611
Default

Quote:
Originally Posted by Bach View Post
... if these scripts are activated, no more captchas over 9kw will be solved ...
Please find me in JD Chat when you are free.
Reply With Quote
  #637  
Old 12.03.2019, 23:46
bobolecoco bobolecoco is offline
JD Alpha
 
Join Date: Aug 2015
Location: France
Posts: 24
Default Settings

Hi ! Is there a way to change settings (for example, checking or unchecking the "mininmize to tray" option) ?
I didn't found it in the help...
Thanks !

Last edited by bobolecoco; 13.03.2019 at 13:19.
Reply With Quote
  #638  
Old 13.03.2019, 14:11
RPNet-user RPNet-user is offline
JD Fan
 
Join Date: Apr 2017
Posts: 78
Default

I do not see any such button in either linkgrabber or downloads for the two event triggers regardless that the eventscripter trigger menuitem is set to visible for both sections:

Linkgrabber Contextmenu Button Pressed
DownloadList Contextmenu Button Pressed
Reply With Quote
  #639  
Old 13.03.2019, 18:54
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 65,398
Default

@PRNet: did you customize the context menu to include those buttons?
__________________
JD-Dev & Server-Admin
Reply With Quote
  #640  
Old 13.03.2019, 18:54
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 65,398
Default

Quote:
Originally Posted by bobolecoco View Post
Hi ! Is there a way to change settings (for example, checking or unchecking the "mininmize to tray" option) ?
I didn't found it in the help...
Thanks !
You can access the advanced settings via eventscripter as well.
What exactly do you want to achieve?
__________________
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 09:53.
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 - 2019, Jelsoft Enterprises Ltd.