JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #81  
Old 24.04.2017, 17:51
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,232
Default

You could directly query the 9kw api in your script
**External links are only visible to Support Staff**www.9kw.eu/api.html
and parse the server response for the queue size.
I suggest to ask mgpai for help how to make http request and parse answer
__________________
JD-Dev & Server-Admin
Reply With Quote
  #82  
Old 29.04.2017, 21:50
blacksun blacksun is offline
JD Legend
 
Join Date: Mar 2009
Location: Schwaben
Posts: 1,340
Default

@mgpai
I hope you can help me.
if a file is premium-only and you dont have an premium-account, the file is skipped, saying that there is no account.
at the bottom of JD, you get an icon:


if you click on that icon, the skipped status get removed and JD is trying these links again.

my Intension:
doing this automatically all 60 minutes --> remove skipped-status every 60 minutes

- only links with "skipped no account" should be affected, not other links with other status
- there is a difference between reseting a link and removing skipped-status (=click on the icon). is it possible to remove skipped-status only (i prefer) via script?

Thx
__________________
--
Viele Grüße

BlackSun
Reply With Quote
  #83  
Old 30.04.2017, 11:47
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,528
Default

Quote:
Originally Posted by blacksun View Post
... remove skipped-status every 60 minutes
- only links with "skipped no account" should be affected, ...
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);
    }
}
Reply With Quote
  #84  
Old 03.05.2017, 13:39
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,528
Default

Check RSS Feeds
Code:
// Check  RSS feeds
// Trigger Required: "Interval"
// Set interval to 3600000 (1 Hour) or more

var users = []; // <- Specify the youtube user IDs to check, e.g. ["cnn","bbc","nbc"]

if (interval >= 3600000) {
    var links = [];

    for (i = 0; i < users.length; i++) {
        var user = users[i];
        var content = JSON.parse(getPage("**External links are only visible to Support Staff** + user));
        var items = content.items ? content.items : [];

        for (j = 0; j < items.length; j++) {
            var item = items[j];
            links.push(item.link);
        }
    }

    callAPI("linkgrabberv2", "addLinks", {
        "links": links.join(" "),
        "autostart": null // <- Set to 'true' (without quotes) to autostart the downloads
    });
}

Last edited by Jiaz; 03.05.2017 at 15:23.
Reply With Quote
  #85  
Old 04.05.2017, 04:56
emilio530 emilio530 is offline
Storm
 
Join Date: Oct 2011
Location: In the paradise
Posts: 210
Default

Quote:
Originally Posted by Jiaz View Post
You could directly query the 9kw api in your script
**External links are only visible to Support Staff**...
and parse the server response for the queue size.
I suggest to ask mgpai for help how to make http request and parse answer
Quote:
Originally Posted by mgpai View Post
Check RSS Feeds
Excellent!! I'll try that and post here when have the script working.

Thanks! :D
Reply With Quote
  #86  
Old 04.05.2017, 07:50
IceRad12
Guest
 
Posts: n/a
Default

Hi, mgpai. I need a script that allows JDownloader to monitor a Youtube playlist or channel and automatically download new videos. In other words, if a new video is uploaded every day, JDownloader would detect that and download it without further intervention. Thank you for any help.
Reply With Quote
  #87  
Old 05.05.2017, 14:34
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,528
Default

@IceRad12,

You can use the script in Post #84 to monitor the RSS feeds to get recent videos from channels by specifying the usernames of those channels. Check your PM for link to a similar script which can be used for playlists. To automatically download the links after adding them to JD, you have to set 'autostart' to 'true' in the scripts.
Reply With Quote
  #88  
Old 05.05.2017, 16:13
IceRad12
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by mgpai View Post
@IceRad12,

You can use the script in **External links are only visible to Support Staff**... to monitor the RSS feeds to get recent videos from channels by specifying the usernames of those channels. Check your PM for link to a similar script which can be used for playlists. To automatically download the links after adding them to JD, you have to set 'autostart' to 'true' in the scripts.
I think I need some assistance with this. I opened Event Scripter and copied the script exactly as presented. I set the Youtube ID inside the brackets. I set auto start to "true". However, I get a Reference Error when I click "test run". Did I forget to do something else?
Reply With Quote
  #89  
Old 08.05.2017, 11:58
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,232
Default

Please provide a screenshot of the script and error message
__________________
JD-Dev & Server-Admin
Reply With Quote
  #90  
Old 09.05.2017, 06:23
emilio530 emilio530 is offline
Storm
 
Join Date: Oct 2011
Location: In the paradise
Posts: 210
Default

Hi, i got that working reading the stats file from 9kw. But i need to know how to set a stopmark in event scripter. I can't find the method. I checked how is this done via myJD and found a method setStopMark in DowndoadsV2.

How can i access this method from scripter?

Thanks
Reply With Quote
  #91  
Old 09.05.2017, 06:58
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,528
Default

Quote:
Originally Posted by IceRad12 View Post
I think I need some assistance with this...
Solved via Chat.

Quote:
Originally Posted by emilio530 View Post
... i need to know how to set a stopmark in event scripter ...
Set stop mark on link:
Code:
callAPI("downloadsV2", "setStopMark", linkUUID, -1);

Set stop mark on package:
Code:
callAPI("downloadsV2", "setStopMark", -1, packageUUID);

Remove stop mark:
Code:
callAPI("downloadsV2", "removeStopMark");
Reply With Quote
  #92  
Old 09.05.2017, 14:46
emilio530 emilio530 is offline
Storm
 
Join Date: Oct 2011
Location: In the paradise
Posts: 210
Default

Thanks mgpai!!
Reply With Quote
  #93  
Old 09.05.2017, 16:00
thecoder2012's Avatar
thecoder2012 thecoder2012 is offline
Official 9kw.eu Support
 
Join Date: Feb 2013
Location: Internet
Posts: 1,325
Default

Quote:
Originally Posted by emilio530 View Post
I would like to know if i can invoke some function that can help me get that info in a script so i can set a stopmark when the 9kw captcha queue is too high.
Quote:
Originally Posted by Jiaz View Post
You could directly query the 9kw api in your script and parse the server response for the queue size.
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;

    for (var i = 0; i < 3; i++) {
        if (https == 1) {
            servercheck = getPage("https" + servercheck_page);
        } else {
            servercheck = getPage("http" + servercheck_page);
        }

        if (IsValidJSONString(servercheck)) {
            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);
            }
            break;
        }
    }
}

function IsValidJSONString(str) {
    if (typeof str !== "string") {
        return false;
    }
    try {
        JSON.parse(str);
    } catch (e) {
        return false;
    }
    return true;
}

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);
	    }
	}
}

Another example for 'account missing' and 'skipped - captcha input':
Code:
// Unskip 'account missing' and 'skipped - captcha input' links at user specified interval
// Trigger Required : "Interval"
// Set interval to 3600000 (60 minutes)

var newInterval = 3600000;
if (interval == newInterval) {
    check_skipped();
} else {
    interval = newInterval;
}

function check_skipped() {
    var links = getAllDownloadLinks();

    for (i = 0; i < links.length; i++) {
        var link = links[i];
        if (link.isSkipped()) {
            if (link.getSkippedReason() == "CAPTCHA" || link.getSkippedReason() == "NO_ACCOUNT") {
                link.setSkipped(false);
            }
        }
    }
}
__________________
Join 9kw.eu Captcha Service now and let your JD continue downloads while you sleep.

Last edited by thecoder2012; 27.05.2019 at 06:59.
Reply With Quote
  #94  
Old 09.05.2017, 16:37
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,232
Default

@thecoder2012: very NICE!
Just for your information, you could add your own remoteapi commands from your solver to api , for example callAPI("9kw", "getCredits"); contact us if you need help with this
__________________
JD-Dev & Server-Admin
Reply With Quote
  #95  
Old 10.05.2017, 01:26
raztoki's Avatar
raztoki raztoki is offline
English Supporter
 
Join Date: Apr 2010
Location: Australia
Posts: 17,659
Default

fyi, problem with using pause mode is sets download speed limit also. So stop marks are probably better if you don't want this to happen, on the assumption that it's the same function in GUI as API call.

raztoki
__________________
raztoki @ jDownloader reporter/developer
http://svn.jdownloader.org/users/170

Don't fight the system, use it to your advantage. :]
Reply With Quote
  #96  
Old 11.05.2017, 15:35
emilio530 emilio530 is offline
Storm
 
Join Date: Oct 2011
Location: In the paradise
Posts: 210
Default

Many thanks thecoder2012!! I'm testing the script i wrote for this problem and will share it as i have it working.

:thumbup:
Reply With Quote
  #97  
Old 18.05.2017, 17:37
Fireman449
Guest
 
Posts: n/a
Question Start a Batch Script if JD finish unrar

Hey MPGAI,

I have a little problem but nothing big for you

Backround:
I wrote a Batch script which automatically deletes "Proof" and "Sample" (Files and Folder) cause I dont need them. I also tried to set exclusions in the unrar extension of JD but nevertheless the files would be unpacked.

What I need:
The Batch Script is finish and works fine but I have no Idea how I could start the Batch Script after Unrar.
I allready tried to abuse the predefined "Play Sound after Unrar Script" from the Event Scripter but I dont get it right

So can you please help me to start my batch script after JD unrar the downloaded movie packages?
Reply With Quote
  #98  
Old 18.05.2017, 18:46
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,528
Default

Quote:
Originally Posted by Fireman449 View Post
... start my batch script after JD unrar ...
Can use either of the following, with trigger "Archive extraction Finished".

Synchronous:
Code:
callSync("cmd","/c","c:/myFolder/myBatch.bat");

Asynchronous:
Code:
callAsync(function(){},"cmd","/c","c:/myFolder/myBatch.bat");
Reply With Quote
  #99  
Old 19.05.2017, 13:03
0r3n
Guest
 
Posts: n/a
Default

Hi,

I'm looking for a way to save all comments from the comment column into a package to a txt file.

could you please kindly help with a script for this? :-)
Reply With Quote
  #100  
Old 19.05.2017, 16:07
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 1,528
Default

@0r3n,

There are two types of comments in JD. 'link' and 'package' comments.

Quote:
Originally Posted by 0r3n View Post
... save all comments from the comment column into a package ...
Do you mean save comments from all individual links of a package ...

Quote:
... to a txt file ...
... to a single txt file?
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:17.
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.