#1761
|
|||
|
|||
![]()
If two file has same name, download the one with more size (i.e filter the small file link). You can read more details from here, https://board.jdownloader.org/showthread.php?t=87803
So, preferably adding a LinkGrabber rule would be much better but since the dev refused, I'd apprecite if anyone would write me a website independent EventScript, Thanks! |
#1762
|
||||
|
||||
![]()
You've requested an advanced feature which apart from you, probably only a hand full of users would use...
You are free to implement it on your own as we're open source or just create yourself an EventScripter script as explained before. -psp-
__________________
JD Supporter, Plugin Dev. & Community Manager Erste Schritte & Tutorials || JDownloader 2 Setup Download ----------------------------------- On Vacation / Im Urlaub Start: 2023-12-09 End: TBA |
#1763
|
|||
|
|||
![]()
@mgpai:
Quote:
the "files" that I would like to open are generally "php" that JD identifies on some sites when I try to select the link of a given file (but the speech also works for some "txt" files that I had found); These files, if opened online (in the browser) have a sort of redirection function that avoids seeing the link to the real file that interests me , BUT if I save these files (eg AAA.php) on hd and open it in notepad, inside it I can find the link to the real file I was looking for, and I can give it to jd x download. [ p.s = x such sites have no plugins (they don't care about anyone but me), and I didn't ask for help on linkcrawler rules because I saw that the hosts on which files are loaded change from file to file. For a while I solved by opening the saved php on hd to copy the "real" links. ... now I was looking for a process to speed things up] If you need an example link you can use that of any video on youtube : if I "copy" a link to a youtube video file (for example), between the verie captures there is also a "* .txt." If you try to open the txt in the browser you are redirected to the video page without "reading" the content of the txt, but if you save the txt on hd and you can read it by viewing the content / text. Last edited by BJN01; 05.07.2021 at 17:57. |
#1764
|
|||
|
|||
![]() Quote:
Code:
/* Preview files Trigger: Linkgrabber contextmenu button pressed */ if (name == "Preview files") { var types = ["php", "txt"]; lgSelection.links.forEach(function(link) { var type = getPath(link.name).extension; if (types.indexOf(type) > -1) { link.setProperty("tmp", true); callAPI("linkgrabberv2", "moveToDownloadlist", [link.UUID], []); } if (!isDownloadControllerRunning()) { startDownloads(); } }) } Code:
/* Preview file Trigger: A download stopped */ if ( link.finished && link.getProperty("tmp") ) { var editor = "notepad.exe"; var file = getPath(link.downloadPath); callSync(editor, file); callAPI("linkgrabberv2", "addLinks", { links: link.contentURL }) file.delete(); link.remove(); } |
#1765
|
|||
|
|||
![]()
@mgpai:
Many thanks ! , as always the scripts are great. by copying a part of it and integrating it with packaging rules and an au3 to send commands to the notepad I was able to automate the capture of the right links. (to many it may seem nonsense but for me it is already a great success ![]() if it could be useful to others I indicate what I did: 1)set of packaging rules with which: - I uniquely identify the php file I need based on name and site - I rename the php I am interested in with a specific name, [DwLinkphp.tmp] (I also change the extension) - set a particular directory for download ( ../tmp ) - validate : automatic confirmation, automatic start download , start automatic forced dl . [1 rule for every site where I have php] 2)with the script I open the file just downloaded in notepad, through the au3 I send the commands "Ctrl A + Ctrl C + Alt F + E" to notepad to copy everything and close it. now JD finds the right "links" for me, and they appear in the linkgrabber window. and finally, I delete the temporary file. script Code:
/* Auto Open file DwLinkphp.tmp in text editor Trigger : A download stopped DwLinkphp.tmp ----> ex file **.php renamed via packaging rules */ disablePermissionChecks(); /*disable permission checks*/ if (link.finished) { var file = getPath(link.downloadPath); if (file.name == "DwLinkphp.tmp") { var editor = "notepad.exe"; callAsync(null, editor, file); } } sleep(250); var autoitDir = 'C:\\####\\######\\AutoIt3' //''C:\\Program Files (x86)\\AutoIt3'; var autoitExe = 'AutoIt3.exe'; var autoitPath = getPath(autoitDir + "\\" + autoitExe); var CtrlACtrlCAlltFExTxT = (JD_HOME + "/_bin/CtrlACtrlCAlltFExTxT.au3"); callAsync(null, autoitPath, CtrlACtrlCAlltFExTxT); sleep(500); var tmpFile = getPath(JD_HOME + "/tmp/DwLinkphp.tmp"); if (tmpFile.exists()) tmpFile.delete(); Quote:
there will certainly be parts that can be improved, in case suggestions are accepted (but at least it works for what I need ![]() Last edited by BJN01; 06.07.2021 at 03:20. |
#1766
|
|||
|
|||
![]() Quote:
Code:
/* Add file content Trigger : A download stopped */ if ( link.finished && link.name == "DwLinkphp.tmp" ) { var file = getPath(link.downloadPath); var content = readFile(file); callAPI("linkgrabberv2", "addLinks", { links: content }); file.delete(); } |
#1767
|
|||
|
|||
![]()
thanks for the tip, as always much appreciated.
it is undoubtedly a + simple solution of the <notepad + au3> that I used. I'm going to put it to use right away. Thanks |
#1768
|
|||
|
|||
![]()
The linked post does not contain any additional information. Please provide example links. You can also PM them.
|
#1769
|
|||
|
|||
![]()
good evening, I'm doing some "experiments" and I would like to ask:
a) commands (in event scripts) that generate / recall the html code are: << var myString = getPage(myString/*URL*/);>> Code:
var myUrl = "https://jdownloader.org/download/index"; //example var myHtml = br.getPage(myUrl); alert (myHtml); Code:
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"); b) is there a command (internal to JD) that, starting from the url, returns me the equivalent of the mhtml / mht? c) there are many chrome apps on the net that save the page as mhtml (but I don't think there is anything like this in JD) ; if it was not possible directly through internal commands, could you write a script that does this by relying on some external executable or similar? [on the net there are programming codes and strings about the genre but I don't even know where to start reading them] if I have to install some program or the like, I have no problems ... but I can't go by trial and error ... the idea was: - I copy a link in jd - jd sees that it belongs to a given host - jd "save" or "command something" and get a <Temp.mhtm> in a path set in the script (eg. <(JD_HOME + "/tmp/")>) there's a way ? is there some code to use and how? |
#1770
|
||||
|
||||
![]() Quote:
Quote:
Quote:
Quote:
Depending on what you want to save, you can use directhttp :// (remove the space before : when using in JD) at the beginning of the url or .jdeatme at the end of the url to force JD to save it to the disk, instead of parsing it. Can also use linkcrawler rule to do the same. |
#1771
|
|||
|
|||
![]()
the "<getPage + writeFile > to save to disk" , it's interesting, I made some attempts but it only saves the data as plain html, it doesn't "capture" what I want [unfortunately].
"directhttp :" ?? Code:
var myUrl = directhttp :"h#tps://jdownloader.org/download/index"; //example var myHtml = br.getPage(myUrl); alert (myHtml); I will also try these commands but I guess they only save the "simple" page. Quote:
at the moment, one of those that saves the mht file correctly is this: "Save As MHT" in chrome web store : h##ps://chrome.google.com/webstore/detail/save-as-mht/hfmodljjaibbdndlikgagimhhodmobkc/related?hl=it and , but above all on the creator page there are the various files with the codes / strings / commands - json , .js and the like. site h##ps://github.com/vsDizzy/SaveAsMHT i am not capable but couldn't you modify something in the .js /.json to call them and use them with the script? [it's possible to run an external .js /.json?] Last edited by BJN01; 14.07.2021 at 03:18. |
#1772
|
|||
|
|||
![]() Quote:
Quote:
To run from script, you will need a program which can generate mht directly, without using browser. |
#1773
|
|||
|
|||
![]()
Thanks for the reply.
changing the argument, I have a variable which should be an array but behaves as a single value. if I did not understand in the web page they process it with a command in a .js type << picArry = $("#arraydata").text().split(","), >> ... I have made many attempts with split and replace but I cannot write the command correctly. simplifying I think the command should say: var AA1 = "(blabla,url1,url2,url3,url4)" var AAA --> AA1 + consider as text + split at "," or , replace ("," , " ,") alert (AAA + "\r\n") ----> blabla , url1 , url2 , url3 , url4 , I can also write the variable to a txt and read the text from there, but I don't understand how it does the "replace ("," , ", ") " must there be a way? |
#1774
|
|||
|
|||
![]() Quote:
Example: Code:
alert("ABABABA".split("B")); // [ "A", "A", "A", "A" ] Code:
var AA1 = "(blabla,url1,url2,url3,url4)"; var AAA = AA1.split(","); // [ "(blabla", "url1", "url2", "url3", "url4)" ]; var AAA = AA1.replace(",", ","); // (blabla,url1,url2,url3,url4) Just remove unwanted characters, split and join the array. Code:
var AAA = AA1.replace(/[()]/g, "").split(",").join("\r\n"); |
#1775
|
|||
|
|||
![]()
I really like this solution but, when I try to make it process the variable I want, I have an error message with both (split / replace)
<< cannot find funxtion split (or replace) in object ##follows all the contents of the string ##>> should i add a split / replce function somewhere ?? or do I have to "say" somewhere that <this variable is an Array> ?? if I try something like: Code:
var MArImg = "(blabla,url1,url2,url3,url4)"; // for test var MArrayS = MArImg.split(","); var MArrayR = MArImg.replace(",", " _ "); alert("test split" + "\r\n" + (MArrayS + "\r\n")); alert("test replace" + "\r\n" + (MArrayS + "\r\n")); Code:
test replace ( or test split) (blabla,url1,url2,url3,url4) Last edited by BJN01; 16.07.2021 at 12:22. |
#1776
|
|||
|
|||
![]()
You have used MArrayS in both alert messages. Same output can be achieved using replace, but you will have do a 'global' replace.
Code:
var MArrayS = MArImg.split(",").join("\r\n"); var MArrayR = MArImg.replace(/,/g, "\r\n"); Both will give the same output: Code:
(blabla url1 url2 url3 url4) |
#1777
|
|||
|
|||
![]()
Hi , some quick question (I think):
1) starting from the "link" is there a way to get the name of the site? if link < ht#ps://siteA.blabla/page-oneOf300/nothingNew/Spoiler101.3 > there is a expression / ReGex to get just: << siteA.blabla >> ?? the link I extract it from: Code:
if (link.isFinished()) { var StartLink = link.getContainerURL(); [or that operation must by be done by something external?] 2) is it possible to write a script that checks if a link is present in a txt (and if there is "disable" it)? [or must the "comparison" be done by something external?] |
#1778
|
|||
|
|||
![]() Code:
var hostname = link.getContainerURL().match(/:\/\/([^/]+)/)[1]; Quote:
Code:
var myFile = Readfile("path/to/file"); var url = link.contentURL(); if (myFile.indexOf(url) > -1) { link.setEnabled(false); } |
#1779
|
||||
|
||||
![]()
@mgpai:
@BJN01: containerURL might be undefined/null, you should add some checks for it ![]()
__________________
JD-Dev & Server-Admin |
#1780
|
||||
|
||||
![]() Quote:
![]()
__________________
JD-Dev & Server-Admin |
![]() |
Thread Tools | |
Display Modes | |
|
|