JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1  
Old 30.07.2016, 10:44
Keryshan Keryshan is offline
Junior Loader
 
Join Date: Jan 2016
Posts: 10
Default Events Scripter: how skip link

In event scripter when is triggered "Packagizer Hook" i use

Code:
var myuri = link.sourceUrls[0];

to get the source url, and I check if it matches some regex.
My goal is remove that link from package if the matches fails.

In example I could pass to JDownloader a link to a page "www.siterandom.com/somepage.html" , so JDownloader parse that page and in package where added this sources:
  • video.mp4
  • video.ogg
  • video.m3u8
  • video.avi

and would like that only "video.mp4" appears in package.

This is a trivial example, since my control script is more complex, but the substance is this.


Thanks.

Last edited by Keryshan; 30.07.2016 at 18:09. Reason: Solved
Reply With Quote
  #2  
Old 30.07.2016, 11:12
raztoki's Avatar
raztoki raztoki is offline
English Supporter
 
Join Date: Apr 2010
Location: Australia
Posts: 17,196
Default

you could do that with linkgrabber filter > filter rule, without the need for event scripter. source domain & filename is not what *.mp4, will result in filtered result.
__________________
raztoki @ jDownloader reporter/developer
http://svn.jdownloader.org/users/170

Don't fight the system, use it to your advantage. :]
Reply With Quote
  #3  
Old 30.07.2016, 12:16
Keryshan Keryshan is offline
Junior Loader
 
Join Date: Jan 2016
Posts: 10
Default

Quote:
Originally Posted by raztoki View Post
you could do that with linkgrabber filter > filter rule, without the need for event scripter. source domain & filename is not what *.mp4, will result in filtered result.
Thanks,
but as said

Quote:
This is a trivial example, since my control script is more complex, but the substance is this.
I know about filters, but for my purpose is bettere use the Events Scripter. If there was a command like "link.delete()" or "link.remove()" it would be perfect!
Reply With Quote
  #4  
Old 30.07.2016, 12:24
raztoki's Avatar
raztoki raztoki is offline
English Supporter
 
Join Date: Apr 2010
Location: Australia
Posts: 17,196
Default

I would have thought that it would have still worked in ok. For example, if they don't show up, can't you auto add links that do via your script controlling? Maybe you want to also download other formats if mp4 isn't there? then script would be the solution.

It was more so just a thought =] I haven't played much with scripting engine so not sure what's available and not (other than what's displayed within help).

best bet is to wait for mgpai to respond, hes usually quick on the ball =]

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

Don't fight the system, use it to your advantage. :]
Reply With Quote
  #5  
Old 30.07.2016, 12:59
mgpai mgpai is offline
Script Master
 
Join Date: Sep 2013
Posts: 939
Default

To my knowledge, currently no methods are available to filter/remove/delete the links with packagizer hook.
Reply With Quote
  #6  
Old 30.07.2016, 14:09
Keryshan Keryshan is offline
Junior Loader
 
Join Date: Jan 2016
Posts: 10
Default

@raztoki
Yes, in substance vie event scripter I wuold perform a filter and eventually generate new links to add to package. That's why filter aren't enouth.
Clearly I can mix the default filter and the Event Scripter, but it would have been nice to have everything in one script!

@mpai
thanks for replying... I am sorry that no such possibility exists :-(

Last edited by Keryshan; 30.07.2016 at 14:11.
Reply With Quote
  #7  
Old 30.07.2016, 16:26
ds1508's Avatar
ds1508 ds1508 is offline
DSL User
 
Join Date: Jul 2016
Location: Germany, NRW
Posts: 38
Default

I don't know what exactly you need, but doesn't this work?
Code:
var myCrawledLink[] = getAllCrawledLinks();/*Get a list of all crawledlinks*/
var myString = myCrawledLink.getUrl();

var myBoolean = myCrawledLink.remove();

         OR

myCrawledLink.setEnabled(myBoolean);
__________________
--
In special cases you may contact me on Discord: http://bit.ly/dsDisco
Reply With Quote
  #8  
Old 30.07.2016, 18:04
Keryshan Keryshan is offline
Junior Loader
 
Join Date: Jan 2016
Posts: 10
Default [solved]

Thanks @ds1508 !

If someone has same problem, here is a snippet of my solution (Event Scripter - "Packagizer Hook"):

Code:
if ( link.sourceUrls[0].match(/https?:\/\/www.siteToCrawl.com/i)) {
	var cr = getAllCrawledLinks()
	if (cr.length) {
		for (var i in cr) {
			var ur = cr[i].getUrl();
			var name = cr[i].getName();
			// I discriminate on file name
			if (!name.match(/\.mp4$/))	cr[i].setEnabled(false);
		}
	}

}

That's all!
Reply With Quote
  #9  
Old 01.08.2016, 15:11
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 67,320
Default

The packagizer can only modify the link, NOT filter/remove it
I will add a "LinkFilter hook" so you can return true/false
__________________
JD-Dev & Server-Admin
Reply With Quote
  #10  
Old 24.06.2017, 14:18
Keryshan Keryshan is offline
Junior Loader
 
Join Date: Jan 2016
Posts: 10
Default

Quote:
Originally Posted by Jiaz View Post
The packagizer can only modify the link, NOT filter/remove it
I will add a "LinkFilter hook" so you can return true/false

Thank you!

I haven't read your reply, but now I can use your LinkFilter: great!!!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 14:58.
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 - 2020, Jelsoft Enterprises Ltd.