Is it possible to write a script that automatically downloads new photos from an instagram profile as soon as they are posted?
IG does not provide RSS feeds. You will have to use third-party services to generate custom RSS/XML feeds and add them at regular intervals to linkgrabber using a script.
Alternatively, you can also use a script to add native IG urls to the linkgrabber at regular intervals. By default this will fetch all the content from the given url. There is a plugin option where you can specify the 'x' latest items to be fetched. This however does not seem to be currently working as expected.
If you want to avoid adding duplicate urls to linkgrabber, you will have to leave the old urls in the download list or linkgrabber list. If the links are present in linkgrabber, JD will skip them. Links present in the download list will be added to the list and marked (BG color will be red) as duplicate. You can create a linkgrabber filter rule to also skip links which are present in the download list.
Code:
// Add urls to linkgrabber at user-defined intervals
// Trigger: Interval (Recommended 3600000 ms or more)
var urls = [];
urls[urls.length] = "**External links are only visible to Support Staff**;
urls[urls.length] = "**External links are only visible to Support Staff**;
urls[urls.length] = "**External links are only visible to Support Staff**;
urls[urls.length] = "**External links are only visible to Support Staff**;
urls[urls.length] = "**External links are only visible to Support Staff**;
callAPI("linkgrabberv2", "addLinks", {
"links": urls.join(" ")
});
I've been fiddling around with the event scripter but can't figure this out:
I am hoping to write a script that takes all my pending downloads/links in my downloads tab and organises them into packages by hoster/domain (rapidgator, keep2share, depositfiles, etc). For instance if I had 5 downloads for rapidgator and 6 for depositfiles then ran the script, I would have 2 packages ("rapidgator" and "depositfiles") each containing the 5 and 6 downloads, repectively.
... script that takes all my pending downloads/links in my downloads tab and organises them into packages by hoster/domain ...
Code:
// From selected links, move only the pending download links to packages by Host
// Trigger: Downloadlist Contextmenu Button Pressed
// Customize Downloadlist Context menu > Add new "Eventscripter Trigger" button > Rename it to "Move to Packages by Host" > Change Icon (Optional)
if (name == "Move to Packages by Host") {
var links = [];
var downloadPath = null; // <- Set download folder (if not specified, default folder will be used)
dlSelection.getLinks().forEach(function(link) {
if (!link.getBytesLoaded() && !link.isRunning()) {
var host = link.getDownloadHost().replace(/(.+)\..+/, "$1");
if (!links[host]) links[host] = [];
links[host].push(link.getUUID());
}
})
for (x in links) callAPI("downloadsV2", "movetoNewPackage", links[x], null, x, downloadPath);
}
i need help with some scripting for this;
first script for event scripter :
i need script for request of reconnect after one download is finished - i use step by step link download
I have trouble, sometimes hosts block my IP for to many GB download in short time frame, can you create script which adds a delay 60 seconds or more after one download file is finished, before next file will start to be downloaded?
I would like to know if it is possible to reset and activate links automatically using EventScripter?
Why I ask, my Raspi runs JD2 in headless mode.
Lately, my multihoster debriditalia often gives me the message that needs to be wait and then often "temporarily unavailable".
If I reset the link a few times (each time after the message came), it will start (sometimes). If i reset it not manually, JD2 ignores this link then always.
A second thing is that I can only load the whole link, so the resume doesn't work, so started and interrupted downloads have also to be reset manually.
I would like to run this as the first script.
The second thing is that I always deactivate all links and then activate the next one as soon as the previous one is finished.
So a package has 10 links, link 2 will be activated when link 1 is finished, etc. until all are finished.
I do this because I only have a bandwidth of 1Mbit and can only run one link over it anyway, and secondly, I noticed that JD2 tries to start all links one after the other (as soon as the previous one doesn't work) and then I have a lot of "link calls" which all count on the contigent and from each package only single files were mostly partially loaded.
Is that also possible?
Good idea But I don't have time to do this, so anyone is welcome to create such a post and keep it updated. I will make it sticky then.
@mgpai
@fred_gaou
Help is welcome
Some asked for it, here it is:biggrin: Not sure it's a good idea to stick it as is! at least it helped me to learn a bit of event scripting, next step will be to make my first one... been busy:P
note
Spoiler:
It might be a good idea to have a lib of primitive functions, simple tasks, that can be then used in any script, which is kind of the goal of this list/thread. The scripts here are sort of snippets but for specific cases, it is good for learning but then you have to dig in each and every one to find what you need.
mgpai, thecoder2012 can you hear me? (any other users too!) any amount of scripts you've been keeping up your sleeve you could put out of your hat?;)
[not sure if it is a good news or bad news]
_____________________________________
the bad news is forum url t=70525&postcount=NN doesn't work, too late to see that, so I can't create direct links...
Spoiler:
the web master will have to use his mysterious wizardry to map the page/post numbers from only thread/postcount number to rebuild a board's url that send us to the post inside the page...
Meanwhile, post numbers are those seen when not logged in (20/page), so the page number is ceil(NN/20):huh: , it is the first column in the list, but it can differ from the one you see depending on the forum options in your profile.
When I remembered some scripts were close, I tried to regroup them but that's far from being finalized or relevant, class list and sorting are dubious:blink: but well, it's a start...
[have fun]
_________
Any way, their is little chance I will keep it up to date, at least regularly, plus the layout is not automated!, but once board links are rebuild it should be more easily usable.
More importantly if any of you have links to scripts in other threads of the forum, we could all share the same 'textup' file for example, anyone can edit it and add a contribution, there will just need to be someone to post it in the forum from time to time :
Quote:
hxxps://textup.fr/385640HK (raw version)
hxxps://textup.fr/385738jj (layout)
pwd are jd
Captcha seems case sensitive and by clicking 'reposter' (duplicate) you make sure to back it up in case of trouble.
check 'scripts' is installed and activated:
in settings tab, down the left panel there is a plugin section, click on scripts,
'intall now' if not and restart and/or check 'scripts' is ticked
Add script to event scripter:
click on script in left panel,
then 'add' in the bottom of right panel
then 'edit' (third column in the script list),
write/paste your script and save
note1: synchroneous execution is to force waiting for the end of the script before JD keeps on running
note2: for windows users, you can use simple / inside paths or escape backslash \\ (escape spec char too)
note3: list of available api methods is in the show/hide help top button
In event scripter list, click trigger event (2nd column) in the line of your script and select the corresponding triggering event that fits your script
Tick/activate the script (1st column)
Associate action button to the script, for example, here, to linkgrabber contextual menu :
Go to Linkgrabber Tab > Context Menu > Open Menu Manager
Add Action > EventScripter Trigger
In the right-side panel change the name from "EventScripter Trigger" to the exact name of the button used in the script (name == "action name/text to display").
Save
now you can test your event (there is also an option for it on top of the event scripter editor)
if it is triggered by some action (ex:right click)
or it will run automaticaly depending on the kind of triggering event.
Save file to disk and import it. (Settings > Linkgrabber Filter > Filter Tab > Import)
Linkgrabber Filter [.views]
Save file to disk and import it. (Settings > Linkgrabber Filter > Views Tab > Import)
Packagizer [.packagizer]
Save file to disk and import it. (Settings > Packagizer > Import)
(some are already set when installing JD, ex:disable *.rev and *.par archives)
_______________________
additional doc
mgpai github repo hxxps://github.com/mgpai/resources/tree/master/jdownloader
(event scripter file names referred to helped users, titles have been used in the following list)
**External links are only visible to Support Staff**jdownloader API spec
_______________________
global API help we find in script editor
(shows in one line, not as in the preview )
Spoiler:
PHP Code:
/* =============== Global API =============== *//* ========= Methods =========*/alert(myObject[]);/*Show a Message Box*//* Example: */alert(JD_HOME);var myObject = callAPI(myString, myString, myObject[]);/*Call the MyJDownloader API*//* Example: */callAPI("downloadsV2", "queryLinks", { "name": true})callAsync(myFunction, myString[]);/*Call a local Process asynchronous*//* Example: */callAsync(function(exitCode,stdOut,errOut){ alert("Closed Notepad");},"notepad.exe",JD_HOME+"\\license.txt");var myString = callSync(myString[]);/*Call a local Process. Blocks Until the process returns*//* Example: */var pingResultString = callSync("ping","jdownloader.org");var myBoolean = deleteFile(myString/*path*/, myBoolean/*recursive*/);/*Delete a file or a directory*//* Example: */var myBooleanResult=deleteFile(JD_HOME+"/mydirectory/",false);disablePermissionChecks();/*disable permission checks*/var myBoolean = doReconnect();/*Perform a reconnect and wait for it*//* Example: */var success= doReconnect();enablePermissionChecks();/*enable permission checks*/var myString = experimental_proxybanlist();/*(experimental) Get proxy banlist*//* Example: */experimental_proxybanlist();var myString = experimental_proxylist();/*(experimental) Get proxy list*//* Example: */experimental_proxylist();var myCrawledLink[] = getAllCrawledLinks();/*Get a list of all crawledlinks*/var myCrawledPackage[] = getAllCrawledPackages();/*Get a list of all crawledpackages*/var myDownloadLink[] = getAllDownloadLinks();/*Get a list of all downloadlinks*/var myFilePackage[] = getAllFilePackages();/*Get a list of all packages*/var myLong = getAverageSpeed();/*Get current average Download Speed in bytes/second*/var myBrowser = getBrowser();/*Get an Environment Object*/var myString = getChecksum(myString, myString);/*Create a Checksum for a file. Types: e.g. CRC32, md5, SHA-1, SHA-256*/var myCrawledLink = getCrawledLinkByUUID(myLong/*uuid*/);/*Get a CrawledLink Link by it's uuid*/var myCrawledPackage = getCrawledPackageByUUID(myLong/*uuid*/);/*Get a CrawledLink Package by it's uuid*/var myDownloadLink = getDownloadLinkByUUID(myLong/*uuid*/);/*Get a DownloadList Link by it's uuid*/var myFilePackage = getDownloadPackageByUUID(myLong/*uuid*/);/*Get a DownloadList Package by it's uuid*/var myString = getEnv(myString/*environment variable*/);/*Gets the value of the specified environment variable*/var myEnvironment = getEnvironment();/*Get an Environment Object*/var myString = getPage(myString/*URL*/);/*Loads a website (Method: GET) and returns the source code*//* Example: */var myhtmlSourceString=getPage("http://jdownloader.org");var myFilePath = getPath(myString/*Path to a file or folder*/);/*Get a FilePath Object*/var myObject = getProperty(myString/*"key"*/, myBoolean/*global(boolean)*/);/*Get a Property. Set global to true if you want to access a global property*//* Example: */var value=getProperty("myobject", false);var myDownloadLink[] = getRunningDownloadLinks();/*Get a list of all running downloadlinks*/var myFilePackage[] = getRunningDownloadPackages();/*Get a list of all running packages*/var myLong = getTotalSpeed();/*Get current total Download Speed in bytes/second*/var myBoolean = isDownloadControllerIdle();/*Check if Download Controller is in IDLE State*/var myBoolean = isDownloadControllerPaused();/*Check if Download Controller is in PAUSE State*/var myBoolean = isDownloadControllerRunning();/*Check if Download Controller is in RUNNING State*/var myBoolean = isDownloadControllerStopping();/*Check if Download Controller is in STOPPING State (Still running, but stop has been pressed)*/var myBoolean = isSynchronous();/*is current script run in synchronous mode?*/log(myObject[]);/*Log to stderr and to JDownloader Log Files*/openURL(myString/*URL*/);/*Open a website or path in your default browser/file explorer*//* Example: */openURL("http://jdownloader.org");playWavAudio(myString/*myFilePathOrUrl*/);/*Play a Wav Audio file*//* Example: */playWavAudio(JD_HOME+"/themes/standard/org/jdownloader/sounds/captcha.wav");var myString = postPage(myString/*URL*/, myString/*PostData*/);/*Loads a website (METHOD: POST) and returns the source code*//* Example: */var myhtmlSourceString=postPage("http://support.jdownloader.org/index.php","searchquery=captcha");var myString = readFile(myString/*filepath*/);/*Read a text file*//* Example: */var myString=readFile(JD_HOME+"/license.txt");refreshAccounts(myBoolean/*true|false (Wait for account checks)*/, myBoolean/*true|false (Force Check)*/);/*Refresh all premium accounts*//* Example: */refreshAccounts(true,true);var myBoolean = removeCrawledLinkByUUID(myString);/*Remove a crawledlink by uuid*/var myBoolean = removeCrawledPackageByUUID(myString);/*Remove a crawledpackage by uuid*/var myBoolean = removeDownloadLinkByUUID(myString);/*Remove a downloadlink by uuid*/var myBoolean = removeFilePackageByUUID(myString);/*Remove a package by uuid*/requestReconnect();/*Request a reconnect*//* Example: */requestReconnect();require(myString/*myFilePathOrUrl*/);/*Loads a Javascript file or url. ATTENTION. The loaded script can access the API as well.*//* Example: */require("**External links are only visible to Support Staff**);setAdvancedAlert(myBoolean);/*enable/disable alert with textbox and copy&paste*/setDisableOnException(myBoolean);/*enable/disable script on exceptions*/setDownloadsPaused(myBoolean);/*Pause/Unpause Downloads*/setNotifyOnException(myBoolean);/*enable/disable notification on exceptions*/var myObject = setProperty(myString/*"key"*/, myObject/*anyValue*/, myBoolean/*global(boolean)*/);/*Set a Property. This property will be available until JD-exit or a script overwrites it. if global is true, the property will be available for al scripts*//* Example: */var oldValue=setProperty("myobject", { "name": true}, false);setSpeedlimit(myInt/*speedlimit in bytes/second*/);/*Set the Speedlimit in bytes/second. Values<=0 -> Disable Limiter*/sleep(myInt/*milliseconds*/);/*Perform a sleep and wait for x milliseconds*//* Example: */sleep(1000);startDownloads();/*Start Downloads*/stopDownloads();/*Stop Downloads*/writeFile(myString/*filepath*/, myString/*myText*/, myBoolean/*append*/);/*Write a text file*//* Example: */writeFile(JD_HOME+"/log.txt",JSON.stringify(this)+"\r\n",true);/* ========= Properties =========*///JDownloader Installation Directory;var myString = JD_HOME;/* =============== Classes =============== *//* === Archive === *//* ========= Methods =========*/var myBoolean = myArchive.equals(myObject);var myString = myArchive.getArchiveType();var myDownloadLink[] = myArchive.getDownloadLinks();var myString = myArchive.getExtractToFolder();var myFilePath[] = myArchive.getExtractedFilePaths();var myString[] = myArchive.getExtractedFiles();var myString = myArchive.getExtractionLog();var myString = myArchive.getFolder();var myObject = myArchive.getInfo();var myString = myArchive.getName();var myList = myArchive.getPasswords();var myString = myArchive.getUsedPassword();var myInt = myArchive.hashCode();var myBoolean = myArchive.isPasswordProtected();myArchive.setPasswords(myList);/* === Browser === *//* ========= Methods =========*/var myBrowser = myBrowser.cloneBrowser();var myBoolean = myBrowser.equals(myObject);var myInt = myBrowser.getConnectTimeout();var myLong = myBrowser.getContentLength();var myString = myBrowser.getContentType();var myString = myBrowser.getCookie(myString, myString);var myBoolean = myBrowser.getDefaultSSLTrustALL();myBrowser.getDownload(myString, myString);var myString = myBrowser.getHTML();var myInt = myBrowser.getLoadLimit();var myString = myBrowser.getPage(myString);var myInt = myBrowser.getReadTimeout();var myString = myBrowser.getRedirectLocation();var myString = myBrowser.getRequestMethod();var myLong = myBrowser.getRequestTime();var myInt = myBrowser.getResponseCode();var myString = myBrowser.getResponseHeader(myString);var myString = myBrowser.getURL();var myInt = myBrowser.hashCode();var myBoolean = myBrowser.isFollowingRedirects();var myBoolean = myBrowser.isSSLTrustALL();var myString = myBrowser.postPage(myString, myString);myBrowser.setConnectTimeout(myInt);myBrowser.setCookie(myString, myString, myString);myBrowser.setDefaultSSLTrustALL(myBoolean);myBrowser.setFollowRedirects(myBoolean);myBrowser.setHeader(myString, myString);myBrowser.setLoadLimit(myInt);var myBoolean = myBrowser.setProxy(myString);myBrowser.setReadTimeout(myInt);/* === ConditionalSkipReason === *//* ========= Methods =========*/var myString = myConditionalSkipReason.getClassName();var myDownloadLink = myConditionalSkipReason.getDownloadLinkCondition();var myString = myConditionalSkipReason.getMessage();var myLong = myConditionalSkipReason.getTimeOutLeft();var myLong = myConditionalSkipReason.getTimeOutTimeStamp();var myString = myConditionalSkipReason.getWaitingSkipReason();var myBoolean = myConditionalSkipReason.isConditionReached();var myBoolean = myConditionalSkipReason.isDownloadLinkCondition();var myBoolean = myConditionalSkipReason.isTimeOutCondition();/* === CrawledLink === *//* The context linkgrabber list link*//* ========= Methods =========*/var myBoolean = myCrawledLink.equals(myObject);var myLong = myCrawledLink.getAddedDate();var myArchive = myCrawledLink.getArchive();var myString = myCrawledLink.getAvailableState();var myLong = myCrawledLink.getBytesTotal();var myString = myCrawledLink.getComment();var myString = myCrawledLink.getContainerURL();var myString = myCrawledLink.getContentURL();var myDownloadLink = myCrawledLink.getDownloadLink();var myString = myCrawledLink.getDownloadPath();var myString = myCrawledLink.getHost();var myLinkInfo = myCrawledLink.getLinkInfo();var myString = myCrawledLink.getName();var myString = myCrawledLink.getOriginURL();var myCrawledPackage = myCrawledLink.getPackage();var myString = myCrawledLink.getPriority();var myMap = myCrawledLink.getProperties();var myObject = myCrawledLink.getProperty(myString);var myString = myCrawledLink.getReferrerURL();var myObject = myCrawledLink.getSessionProperty(myString);var myCrawlerJob = myCrawledLink.getSourceJob();var myString = myCrawledLink.getUUID();var myString = myCrawledLink.getUrl();var myInt = myCrawledLink.hashCode();var myBoolean = myCrawledLink.isEnabled();var myBoolean = myCrawledLink.remove();myCrawledLink.setComment(myString);myCrawledLink.setEnabled(myBoolean);myCrawledLink.setName(myString/*new Name*/);/*Sets a new filename*/myCrawledLink.setPriority(myString);myCrawledLink.setProperty(myString, myObject);myCrawledLink.setSessionProperty(myString, myObject);var myString = myCrawledLink.toString();/* === CrawledPackage === *//* The context linkgabber list package*//* ========= Methods =========*/var myBoolean = myCrawledPackage.equals(myObject);var myLong = myCrawledPackage.getAddedDate();var myArchive[] = myCrawledPackage.getArchives();var myLong = myCrawledPackage.getBytesTotal();var myString = myCrawledPackage.getComment();var myString = myCrawledPackage.getDownloadFolder();var myCrawledLink[] = myCrawledPackage.getDownloadLinks();var myString = myCrawledPackage.getName();var myString = myCrawledPackage.getPriority();var myString = myCrawledPackage.getUUID();var myInt = myCrawledPackage.hashCode();var myBoolean = myCrawledPackage.remove();myCrawledPackage.setComment(myString);myCrawledPackage.setDownloadFolder(myString);myCrawledPackage.setName(myString);myCrawledPackage.setPriority(myString);var myString = myCrawledPackage.toString();/* === CrawlerJob === *//* ========= Methods =========*/var myBoolean = myCrawlerJob.equals(myObject);var myList = myCrawlerJob.getArchivPasswords();var myString = myCrawlerJob.getOrigin();var myString = myCrawlerJob.getPassword();var myString = myCrawlerJob.getSourceUrl();var myString = myCrawlerJob.getText();var myString = myCrawlerJob.getUUID();var myInt = myCrawlerJob.hashCode();var myBoolean = myCrawlerJob.isAssignJobID();var myBoolean = myCrawlerJob.isDeepAnalysisEnabled();myCrawlerJob.setAssignJobID(myBoolean);myCrawlerJob.setDeepAnalysisEnabled(myBoolean);myCrawlerJob.setPassword(myString);myCrawlerJob.setText(myString);/* === DownloadLink === *//* The context download list link*//* ========= Methods =========*/myDownloadLink.abort();var myBoolean = myDownloadLink.equals(myObject);var myLong = myDownloadLink.getAddedDate();var myArchive = myDownloadLink.getArchive();var myLong = myDownloadLink.getBytesLoaded();var myLong = myDownloadLink.getBytesTotal();var myString = myDownloadLink.getComment();var myConditionalSkipReason = myDownloadLink.getConditionalSkipReason();var myString = myDownloadLink.getContainerURL();var myString = myDownloadLink.getContentURL();var myLong = myDownloadLink.getDownloadDuration();var myString = myDownloadLink.getDownloadHost();var myString = myDownloadLink.getDownloadPath();var myLong = myDownloadLink.getDownloadSessionDuration();var myLong = myDownloadLink.getDownloadTime();var myLong = myDownloadLink.getEta();var myString = myDownloadLink.getExtractionStatus();var myString = myDownloadLink.getFinalLinkStatus();var myLong = myDownloadLink.getFinishedDate();var myString = myDownloadLink.getHost();var myLinkInfo = myDownloadLink.getLinkInfo();var myString = myDownloadLink.getName();var myString = myDownloadLink.getOriginURL();var myFilePackage = myDownloadLink.getPackage();var myString = myDownloadLink.getPluginURL();var myString = myDownloadLink.getPriority();var myMap = myDownloadLink.getProperties();var myObject = myDownloadLink.getProperty(myString);var myString = myDownloadLink.getReferrerURL();var myObject = myDownloadLink.getSessionProperty(myString);var myString = myDownloadLink.getSkippedReason();var myLong = myDownloadLink.getSpeed();var myString = myDownloadLink.getStatus();var myMap = myDownloadLink.getTempProperties();var myObject = myDownloadLink.getTempProperty(myString);var myString = myDownloadLink.getUUID();var myString = myDownloadLink.getUrl();var myInt = myDownloadLink.hashCode();var myBoolean = myDownloadLink.isEnabled();var myBoolean = myDownloadLink.isFinished();var myBoolean = myDownloadLink.isResumeable();var myBoolean = myDownloadLink.isRunning();var myBoolean = myDownloadLink.isSkipped();var myBoolean = myDownloadLink.remove();myDownloadLink.reset();myDownloadLink.resume();myDownloadLink.setComment(myString);myDownloadLink.setEnabled(myBoolean);myDownloadLink.setName(myString/*new Name*/);/*Sets a new filename*/myDownloadLink.setPriority(myString);myDownloadLink.setProperty(myString, myObject);myDownloadLink.setSessionProperty(myString, myObject);myDownloadLink.setSkipped(myBoolean);myDownloadLink.setTempProperty(myString, myObject);var myString = myDownloadLink.toString();/* === Environment === *//* ========= Methods =========*/var myString = myEnvironment.getARCHFamily();var myLong = myEnvironment.getJavaVersion();var myString = myEnvironment.getNewLine();var myString = myEnvironment.getOS();var myString = myEnvironment.getOSFamily();var myString = myEnvironment.getPathSeparator();var myBoolean = myEnvironment.is64BitArch();var myBoolean = myEnvironment.is64BitJava();var myBoolean = myEnvironment.is64BitOS();var myBoolean = myEnvironment.isBSD();var myBoolean = myEnvironment.isHeadless();var myBoolean = myEnvironment.isLinux();var myBoolean = myEnvironment.isMac();var myBoolean = myEnvironment.isWindows();/* === FilePackage === *//* The context download list package*//* ========= Methods =========*/var myBoolean = myFilePackage.equals(myObject);var myLong = myFilePackage.getAddedDate();var myArchive[] = myFilePackage.getArchives();var myLong = myFilePackage.getBytesLoaded();var myLong = myFilePackage.getBytesTotal();var myString = myFilePackage.getComment();var myString = myFilePackage.getDownloadFolder();var myDownloadLink[] = myFilePackage.getDownloadLinks();var myLong = myFilePackage.getFinishedDate();var myString = myFilePackage.getName();var myString = myFilePackage.getPriority();var myMap = myFilePackage.getProperties();var myObject = myFilePackage.getProperty(myString);var myString = myFilePackage.getUUID();var myInt = myFilePackage.hashCode();var myBoolean = myFilePackage.isFinished();var myBoolean = myFilePackage.remove();myFilePackage.setComment(myString);myFilePackage.setDownloadFolder(myString);myFilePackage.setName(myString);myFilePackage.setPriority(myString);myFilePackage.setProperty(myString, myObject);var myString = myFilePackage.toString();/* === FilePath === *//* ========= Methods =========*/var myBoolean = myFilePath.copyTo(myString, myString, myBoolean);var myBoolean = myFilePath.copyTo(myString);var myBoolean = myFilePath.delete();var myBoolean = myFilePath.deleteRecursive();var myBoolean = myFilePath.equals(myObject);var myBoolean = myFilePath.exists();var myString = myFilePath.getAbsolutePath();var myFilePath[] = myFilePath.getChildren();var myLong = myFilePath.getCreatedDate();var myString = myFilePath.getExtension();var myLinkInfo = myFilePath.getLinkInfo();var myLong = myFilePath.getModifiedDate();var myString = myFilePath.getName();var myFilePath = myFilePath.getParent();var myString = myFilePath.getPath();var myLong = myFilePath.getSize();var myInt = myFilePath.hashCode();var myBoolean = myFilePath.isDirectory();var myBoolean = myFilePath.isFile();var myBoolean = myFilePath.mkdirs();var myBoolean = myFilePath.moveTo(myString);var myFilePath = myFilePath.rename(myString);var myFilePath = myFilePath.renameName(myString);var myFilePath = myFilePath.renamePath(myString);var myBoolean = myFilePath.renameTo(myString);var myString = myFilePath.toString();/* === LinkInfo === *//* ========= Methods =========*/var myString = myLinkInfo.getDesc();var myString = myLinkInfo.getGroup();var myInt = myLinkInfo.getPartNum();var myString = myLinkInfo.name();// ========= Properties for the EventTrigger 'A Download started' =========var myFilePackage = package;var myDownloadLink = link;
_______________________
event scripter repo
Spoiler:
tmplnk postcount title;trigger
use third party program p0001 0001 Convert AAC/M4A/OGG files to MP3 (ffmpeg) ;A Download Stopped p0005 0098 start my batch script after JD unrar ;Archive extraction Finished p0006 0106 Add metadata to image file, using external program (exiftool) ;A Download Stopped p0010 0191 Run external program if package contains 'pdf' file ;Package finished p0016 0302 start/stop transmission-gtk p0019 0366 Run external command on extracted files & delete archive links from list (dxzdxz1.js) ;Archive extraction finished p0024 0474 Run external program when all packages finished (44nonymous.js) ;Download Controller Stopped p0025 0490 Convert dts to ac3 and create new video file (ffmpeg) (Tom.js) ;A new file has been created p0028 0550 ? greasemonkey script to send url to JD? Use eventscripter to start python-script with arguments Open container link in browser (guardao.js) ;Downloadlist Contextmenu Button Pressed Open url in browser(guardao_2.js) ; Downloadlist Contextmenu Button Pressed
update p0045 0881 Update JD when idle, automatic update + restart after all active downloads ;Interval p0015 0297 Update JD when idle, automatic update + restart after all active downloads (DaDealer.js) ;Interval p0016 0305 Update JD when idle, automatic update + restart after all active downloads ;Interval p0028 0558 Restart and update, if updates are available ;Before a Reconnect (or after)
log/bkup p0001 0002 Save youtube links and basic information to a html page ;A Download Stopped p0037 0728 Save youtube links and basic information to a html page ;A Download Stopped p0001 0007 Simple history of downloaded links in text format ;A Download Stopped p0001 0010 Simple history of downloaded links in text format ;A Download Stopped p0019 0378 Simple history of downloaded links in text format ;A Download Stopped p0001 0019 Export download URLs (Linkgrabber & Download List) ;DownloadList Contextmenu Button Pressed p0040 0794 Export download URLs, workaround for container p0041 0808 Export downloadlist urls (new getPluginURL api) ;DownloadList Contextmenu Button Pressed p0041 0808 Export LinkGrabber list urls (new getPluginURL api) ;LinkGrabber Contextmenu Button Pressed p0006 0102 Write link comments to 'csv' file ;Package Finished p0006 0115 Write link comments from a package to 'csv' file ;DownloadList Contextmenu Button Pressed p0012 0232 Save Link URLs in a text file ;A Download Stopped p0019 0376 Move all links to download list p0024 0479 Backup link lists at startup ;JDownloader started p0031 0618 Daily Backup (7z) ;JDownloader Started p0048 0958 Get links from finished crawljob ;Remote API Event fired get list of finished package
p0002 0037 Check for new update logs at user defined intervals and open them in notepad ;Interval p0011 0210 Clean up and log finished packages at specified interval ;Interval
operations on links, files & folders p0001 0009 Add single/multiple URL at user defined interval ;Interval p0003 0048 add direct link to linkgrabber p0007 0122 Add link at user defined interval ;Interval p0051 1002 Add urls to linkgrabber at user-defined intervals (skip duplicates) ;Interval
p0002 0039 get packagename of archive ;Archive extraction finished p0003 0050 link name cleaner : auto clean/format filename during the link grabbing process ;Packagizer Hook p0003 0058 Set filename as comment / Set comment as file name ;Packagizer Hook
p0001 0006 Split packages and create sub-folders ;Linkgrabber Contextmenu Button Pressed p0002 0029 Move finished non-archive files, to user defined folder ;A Download Stopped p0006 0104 Delete junk folders ;Archive Extraction Finished p0006 0109 Delete from extracted files, any file/folder which contains user specified keywords ;Archive Extraction Finished p0007 0120 Delete 'jpg' and 'txt' files and remove download folder if empty ;A Download Stopped p0007 0135 ? last extracted archive, remove nested archive? ;Any Extraction Event p0008 0159 Move media files based on duration (ffprobe) ;A Download Stopped p0015 0290 Disable matching files (netgearjd.js) ;Toolbar Button Pressed p0017 0329 Detect duplicate files (netgearjd_2.js) ;Toolbar Button Pressed p0032 0627 Disable (instagram) links if file exists on disk ;Remote API Event Fired p0035 0690 Disable (instagram) links if file exists on disk ; Toolbar Buttton Pressed
p0021 0402 If file exists, stop the download and remove the link, else rename it (patriks3.js) ;A Download Started p0021 0414 Disable download link if file exists in download folder/subfolders (Takhen.js) ;A Download Started Disable the download if the file already exists on the disk with alternate name ;A Download Started Change download folder if a file does not already exist in default folder ;A Download Started If file already exists in other user defined folders disable the download ;A Download Started p0040 0787 Disable download link, if file exists on disk in specified list of folders ;A Download Started p0043 0845 Disable all download link(s) of an archive, if the download folder contains a sub-folder with archive name ; A Download Started p0041 0806 Delete downloaded files from user-specified folder, at user-specified interval ;Interval p0041 0806 Delete downloaded files from user-specified folder, immediately after it's been downloaded ;A Download Stopped p0048 0948 Remove finished links older than 'x' days ;JDownloader Started p0048 0950 Move finished links to user-defined package ;A Download stopped p0048 0954 Build/update downloaded links history and add comment to finished link ;JDownloader Started p0048 0954 Disable links, if they exist in history ;A Download Started p0048 0954 " Move links to to "Already Downloaded" package, if they exist in history" ;Packgizer Hook Anti duplicates history Script (983) p0045 0899 file exist function p0049 0977 generate shortURL p0051 1004 From selected links, move only the pending download links to packages by Host ;Downloadlist Contextmenu Button Pressed Set last download destination as download folder for new links (serrato.js) ;Packagizer Hook
p0023 0451 Skip links from specified host when daily limit is reached (peymanch.js) ;Interval p0026 0519 button to Show/Hide Single Child Packages ;Toolbar Button Pressed p0030 0590 set download folder based on file size(595,596) ;A new link has been added p0039 0764 check file downloaded size and conditional deletion, partial code p0039 0775 check download link status p0030 0592 Move archive files after extraction ; Archive Extraction Finished p0036 0714 Move archive files after extraction to a timestamp based sub-folder ; Archive Extraction Finished p0036 0717 incremente extracted filename if already exist p0037 0721 Move archive files after extraction ;Archive Extraction Finished p0043 0847 Move extracted files to base folder and remove empty sub-folders ;Archive Extraction Finished Flatten Archives (Move extracted files from sub-folders to the main extraction folder) (ehorn.js) ; Archive Extraction Finished p0041 0808 Get Archive Password (Downloads) ;DownloadList Contextmenu Button Pressed
p0001 0018 Replace 128kbit audio with 192kbit audio in 1080p youtube videos ;Package Finished p0031 0612 put youtube videos into packages with channel name with packagizer, pseudo-code p0036 0711 download new vids of youtube's channel everyday / crawl urls at user-specified interval ;Interval p0037 0730 youyube channel name p0040 0782 Add alternate url, if current url is offline ;Packagizer Hook p0043 0843 Use youtube-dl if possible ;New Crawler Job p0045 0884 Youtube Smart Subtitle Selector Script Add Playlist Position to file name (LuckyLuciano.js) ;Downloadlist Contextmenu Button Pressed
operations based on time & speed p0037 0735 set speed limit when a twitch channel is streaming ;Download Controller Started p0020 0398 Pause downloads during extraction (Biohazmatz.js) ;Any Extraction Event p0002 0024 Auto stop/restart downloads if the current average speed is below limit ;Interval p0004 0060 Stop and restart slow links ;Interval p0004 0066 Skip slow links and resume them after wait time ;Interval p0015 0288 Pause and resume downloads if average speed is below target speed (Hartm.js) ;Interval p0015 0300 Stop and restart all downloads if average speed is below target speed (Hartm.js) ;Interval p0043 0857 Restart JD if download speed is 0 and JD is idle ;Interval reset a download if the speed is slower than 2mb/s stop downloads if speed is under 4000kb p0008 0140 Time based download control ;Interval p0019 0376 Format Date p0022 0427 control the time at which a script will run Force Download to start (with PLUGIN_DEFECT) ;Interval
notifications p0002 0022 get notifications on smartphone via pushover ;Package finished p0012 0235 Script for sending email after package finished (sendemail) p0024 0469 Send email notification (NAS) (desperado591.js) ;A Download Stopped p0024 0469 Send email notification (NAS) (desperado591_2.js) ;Archive Extracton Finished p0029 0574 send packagename to batch file ;Package Finished p0029 0577 send notification to service using postpage()
unskip p0005 0083 Unskip 'account missing' links at user specified interval ;Interval p0005 0093 Unskip 'account missing' and 'skipped - captcha input' links at user specified interval ;Interval p0027 0526 Unskip links with unsolved captcha (dpinbsp.js) ;Interval p0050 0985 Unskip and start downloading links with "Invalid download directory" message, if the destination folder is available ;A Download Controller Stopped p0050 0987 Unskip and start downloading links with "Invalid download directory" message, if the destination folder is available ;a Download Controller Stopped
Packagizer rules: p0015 0280 tips: you can copy/paste Settings-Advanced Settings, PackagizerSettings.rulelist, for eventscripter, EventScripter.scripts p0023 0458 change file name p0024 0472 moves the extracted files p0031 0612 put videos into packages with youtube channel name p0040 0797 set dl path for specific file or container
_______________________
last word:
- many things might be wrong, useless, feel free to point out/modify/suggest anything
- np++ can be usefull too highlight keywords if your are looking for something...
- unfortunately there seems to be many good scripts in non international forums but I don't understand anything!
- next step for whom volunteers : do the same for other script types and folderwatch!:dots:
Quote:
raw version : hxxps://textup.fr/385640HK
formatted : hxxps://textup.fr/385738jj
pwd are jd
_______________________
log
27.11.19.21.20.00 added some links;textup updated
Last edited by noone1; 27.11.2019 at 21:24.
Reason: img don't show at all;code block shown in 1 line; both unlike the preview; smileys need spaces to convert but are trimed
- I collected the triggering events too but I wonder if it's so relevant here since many can be transposed/adapted for other events if function exists (ex: use lgselection if linkgrabber contextual menu or dlselection for download list contextual menu - lost hours to find that:outch: )
Which lead me to my first question: every time someone ask for JD's js function, he is said to look in event scripter help but for example, these lgselection and dlselection functions are not referenced in there (only api methods), so where can we find them and the likes? or I didn't check enough
- As a noob and for basic use, I don't understand how to use the doc but I can roughtly understand a script when I see one, except I can't find other functions that could suits my needs; a basic intro/how to for beginners might help.
2nd question then, perhaps it is more on how to use the doc: where/how can we know which functions and which methods are available for a particular triggering event?
... for example, these lgselection and dlselection functions are not referenced in there (only api methods), so where can we find them and the likes? ...
Select the trigger and scroll to the bottom of the help section in the script editor to view the object/properties returned by that trigger. For e.g. when the "Linkgrabber Contextmenu Button Pressed" trigger is selected, it will list/return the following:
Code:
// ========= Properties for the EventTrigger 'Linkgrabber Bottombar Button Pressed' =========
var myLinkgrabberSelection = lgSelection;
var myString = shortCutString;
var myString = name;
var myString = icon;
var myString = menu;
Quote:
Originally Posted by noone1
... I can't find other functions that could suits my needs; a basic intro/how to for beginners might help ...
All available methods are listed in the help section of the script editor. Feel free to post your queries if you are not able to find a suitable method or trigger.
Quote:
Originally Posted by noone1
...where/how can we know which functions and which methods are available for a particular triggering event?
All Global as well as Object methods listed in the help window can be used in any script.
I would like to know if it is possible to reset and activate links automatically using EventScripter?
... my multihoster debriditalia often gives me the message that needs to be wait and then often "temporarily unavailable"...
... If I reset the link a few times (each time after the message came), it will start (sometimes) ...
Links can be reset via script, but it should be possible to identify such links accurately by querying the link properties.
Also, if you provide the logs, Jiaz might be able to look into and check if it is possible to adjust the plugins to fix it, in which case you will not need to use the scripts to reset them.
Quote:
Originally Posted by d1332973
... deactivate all links and then activate the next one as soon as the previous one is finished.
While possible, the download queue will not progress if a link is not "finished" for any reason.
THANK YOU for the enlightenment master:) that helps a lot to start with
I may have few other questions still in relation with sort of tuto/first step for beginners:
edit: points 1,2 &3 solved in one go! I feel I can breath now
very nice tips:
Quote:
Originally Posted by mgpai
@Skeeve:
If you mean console, a ticket (#84516) is pending for that feature. For trouble shooting you can use alert() (can cause JD to hang if the events are triggered in quick sucession) or log to file using the log() method.
You can use external editor to create/view/modify the script. Save it as JS file locally and use the require() method in the JD editor to access/run it. E.g. require("/myFolder/myScript.js");. You can load any local/remote resource using this method.
Spoiler:
+ autocompletion
Quote:
Originally Posted by mgpai
Quote:
Originally Posted by umax
and I do not know whether it's a new feature or a bug
It is a feature of the editorKit (JSyntaxPane) used by JD (updated a few months back). While it is meant to make writing scripts easier, it is doing quite the opposite (at least for me).
Totally agree, way too constraining! plus java is really not comfortable as a gui (at least for me).:P
so, still not possible to disable this autocompletion/highlighting?
+ multimodal editor window
Execution testing is a big pain in the a.. Is it planned in a near future to make the js editor window 'independent'? ('multimodal/unattached') so we can debug scripts in a less painful way without having to exit/re-edit scripts on each and every slightest change... (plus sometimes I would need to minimize the underlying JD window)
+ syntax highlighting
I use custom theme (modified black_eye) for JD and unfortunately it interferes with syntactic colorization in the js editor that make the rendering quite unreadable. Not a big deal since I use np++, but it's a lot of copy/paste!
So, not (yet) possible to modify the highlighting rules independently of the existing LAF settings, or maybe more simply not apply these settings to the js editor pane?
+ make my life easier.
Little confused with all the script types and plugins available, I understand they are all designed for specific use which is thus intended to simplify things but on the other hand it's not very practicable to maintain different scripts in different locations for a same task.
Well, just to know: is there theoretically something js event scripts can't do that link filter or packagizer can?
(I mean with json parsing api and text file i/o it's virtually possible to manage most of the tasks from js only or is it a bad idea)
suggestion for farfaraway feature : kind of firefox's webdev common console;)
- if audio stream=ger and ac3, just copy the stream -c:a "copy"
Stream #0:1(ger): Audio: ac3,
now it converts it again to ac3
if 2 files have been created and first file progressed by ffmpeg, will second file also executed at the same time file by file? sometimes ffmpeg is extremely slow and cpu usage 90%
ok, i guess you should update the script so we have the same version :-)
with the old version it indeed doesnt convert ac3.
Only mods can view/download attachments. Can you please paste the script content directly in the post? Or, you can get in touch with me in JD Chat tomorrow.
How can I rename files? I want to download domain.com/foo/bar.zip as bar_foo.zip rather than as bar.zip. The renaming should happen early. For example as a Packagizer Hook, or within the following call in a script I have:
How can I rename files? I want to download domain.com/foo/bar.zip as bar_foo.zip rather than as bar.zip. The renaming should happen early. For example as a Packagizer Hook, or within the following call in a script I have:
how can I see the output of my script ? In python, you would call print.
Is alert the only way ?
You can also log the output to JD session logs using:
Code:
log(myObject[]);/*Log to stderr and to JDownloader Log Files*/
or, write to a file using:
Code:
writeFile(myString/*filepath*/, myString/*myText*/, myBoolean/*append*/);/*Write a text file*/
/* Example: */writeFile(JD_HOME+"/log.txt",JSON.stringify(this)+"\r\n",true);
You can append the debug string to a variable and view them in a single alert box after all the items in the array are processed.
maybe this one could be more 'visual' while a bit time consuming if you try to display huge object!
Code:
function jdbox(){
/*call jdbox(arg1,arg2,...)
alert(print_r([JSON.parse(JSON.stringify(arguments,null,"\t"))]));
}
edt:oops, forgot the 2nd
Spoiler:
Code:
function print_r(arr, level) {
//stackoverflow.com/a/9613740
//format recursive Array/Hashes/Objects,Strings/Chars/Numbers etc...
var dumped_text = "";
if (!level) level = 0;
var level_padding = "";//The padding given at the beginning of the line.
for (var j = 0; j < level + 1; j++) level_padding += " ";
if (typeof(arr) == 'object') {
for (var item in arr) {
var value = arr[item];
if (typeof(value) == 'object') {
dumped_text += level_padding + item + " ...\n";
dumped_text += print_r(value, level + 1);
} else {
dumped_text += level_padding + item + " => " + value + "\n";
}
}
} else {
dumped_text = "=> " + arr + " <=(" + typeof(arr) + ")";
}
return dumped_text;
}
edt2: logf will redirect to a file or simply combine it with alert. ex:alert("test1"+print_r(myobj)); not perfect but it run through any kind of type and display it...while we are hopping a debugger in JD
Otherwise I've just posted a question on the board with a script that contains 2 usefull functions I use (logf and print_r), may be it can help.
@askin2u
Not much useful stuff is within logs other than maybe start time and finish, probably easier just using event scripter and gather info and create/update db
or do it within the core create stats module/extension
Hi mgpai,
is there a way to retrieve the exit code of a callsync()-function?
Or to specify my question: how do I check whether the called function/script did not encounter any errors? If I got this correct a callsync() returns the first stdout that occours. In my case that doesn't leave a clue whether the call was succesfull.
To give you an idea what I'm trying to accomplish:
I have a headless setup of JDownloader on a remote server and after finishing a download I want that file to be copied to my local server via scp. If that was successfull the remote server should delete the file.
I got the copy-part working but cannot check whether it was successful.
My code:
Code:
//trigger: download stopped
disablePermissionChecks();
if (link.isFinished()) {
var sourceFile = link.getDownloadPath();
var result = callSync("scp", sourceFile, "user@hostname:/path");
if (result == 0) {
deleteFile(sourceFile, false);
log(sourceFile + " should be deleted")
} else {
log("Err: scp-result = " + result);
}
if (package.isFinished()) package.remove();
}
or rather get the echo in a new call like callsync("echo $?")?
The question is what does callSync() return? The first, the last, or the sum of all echos to stdout?
What would be the benefit of using callAsync()? I thought using sync is better as i want to make sure the whole file has been copied.
or rather get the echo in a new call like callsync("echo $?")?
The question is what does callSync() return? The first, the last, or the sum of all echos to stdout?
What would be the benefit of using callAsync()? I thought using sync is better as i want to make sure the whole file has been copied.
callSync() will output stdOut or stdErr. You have to use the echo $? as the second command (using &), which will result in stdOut or stdErr + echo result. It is also possible to get just the exit code by redirecting redirect the stdOut & stdErr to null device.
callAsync() will be more suitable as the exitCode, stdOut or stdErr will be available to the callback function. This will be available after the external command has ended (in this case the file has been copied or failed). You then have to just query those properties before executing your code.
Feel free to find me in JD Chat if you need any help with this.
IG does not provide RSS feeds. You will have to use third-party services to generate custom RSS/XML feeds and add them at regular intervals to linkgrabber using a script.
Alternatively, you can also use a script to add native IG urls to the linkgrabber at regular intervals. By default this will fetch all the content from the given url. There is a plugin option where you can specify the 'x' latest items to be fetched. This however does not seem to be currently working as expected.
If you want to avoid adding duplicate urls to linkgrabber, you will have to leave the old urls in the download list or linkgrabber list. If the links are present in linkgrabber, JD will skip them. Links present in the download list will be added to the list and marked (BG color will be red) as duplicate. You can create a linkgrabber filter rule to also skip links which are present in the download list.
Code:
// Add urls to linkgrabber at user-defined intervals
// Trigger: Interval (Recommended 3600000 ms or more)
var urls = [];
urls[urls.length] = "**External links are only visible to Support Staff**;
urls[urls.length] = "**External links are only visible to Support Staff**;
urls[urls.length] = "**External links are only visible to Support Staff**;
urls[urls.length] = "**External links are only visible to Support Staff**;
urls[urls.length] = "**External links are only visible to Support Staff**;
callAPI("linkgrabberv2", "addLinks", {
"links": urls.join(" ")
});
I managed to add the script and it is working, but it keeps adding duplicate links, so can you please tell me how to create the filter rule to skip duplicate instagram links?
adding a filter wont mean the decryption task will finish though.
creating a crontab like event in theory is good. but realistically when dupes are found decryption task should end.
// Rename files by matching download url pattern
// Trigger: Packagizer Hook
if (state == "BEFORE") {
var patt = /.+\/domain\.com\/(foo)\/(bar)(\.zip)/i;
var name = link.getURL().match(patt);
if (name) link.setName(name[2] + "_" + name[1] + name[3]);
}
Packagizer rules not suitable for this?
Is this what I would need to use in the case of creating a directory and subdirectory based on the pinterest url?
example links are
**External links are only visible to Support Staff****External links are only visible to Support Staff**
**External links are only visible to Support Staff****External links are only visible to Support Staff**
mine was more like this with my basic javascript knowledge so, i didn't know exactly how to apply it to this situation
Code:
testVar = document.URL
testVar = **External links are only visible to Support Staff**
const [first, second] = testVar.split("/").filter(n=>n).slice(-2);
if pinterestURL
if the url is in this format,
main folder is first string
subfolder is second string
...
first = stewipanzon
second = english-bull-terrier
Use the packagizer extension (unless for some reason you need to use a script).
Settings > Packagizier > Add:
Code:
if > Sourceurl(s) > contains : **External links are only visible to Support Staff**then set > Download Directory : <jd:source:1>\<jd:source:2>
Thanks. I thought i needed some kind of regexpr trick at first. I've been searching for those "jd:" parameters but haven't had any luck. I appreciate this a lot. Would it be possible to have it this apply to already downloaded items as well?
Changingg what's already in the linkgrabber "queue just gives invalid download directory" after starting. Changing the already downloaded using that yields:
Code:
java.io.IOException: Could not create E:\Users\NewAdmin\pinterest\<jd:source:1>\<jd:source:2>
at jd.plugins.PluginForHost.renameOrMove(PluginForHost.java:2409)
at jd.plugins.PluginForHost.handle(PluginForHost.java:2400)
at jd.plugins.PluginForHost.move(PluginForHost.java:2358)
at jd.controlling.downloadcontroller.DownloadWatchDog.move(DownloadWatchDog.java:4520)
at jd.controlling.downloadcontroller.DownloadWatchDog$44.execute(DownloadWatchDog.java:4483)
at jd.controlling.downloadcontroller.DownloadWatchDog$30.run(DownloadWatchDog.java:3008)
Would it be possible to have it this apply to already downloaded items as well?
Packagizer rules are processed before the links are added to the linkgrabber. You will have to remove and add them back again. Use the context menu to copy the links to clipboard before removing them from the list.
Is there a way, using some combination of scripts and/or packagizer rules to convert the URL to a full path, e.g. **External links are only visible to Support Staff**... becomes C:\myfolder\foo\bar\file.zip? I almost had it with packagizer rules but it turned all the / into _ which is not what I want.