JDownloader Community - Appwork GmbH
 

Reply
 
Thread Tools Display Modes
  #1  
Old 18.08.2018, 20:35
Iskelderon's Avatar
Iskelderon Iskelderon is offline
JD Adviser
 
Join Date: Aug 2018
Location: Europe
Posts: 111
Default Tutorials for writing new plugins

Hi

I wanted to try my hand at contributing plugins, but since I'm just getting started and any recommendations for tutorials on how to write would be priceless. My first attempt failed rather miserably, as I couldn't even ensure that my class was used, much less dumping debug information, configuring the Eclipse project (not just the JAR file) for debugging/inspection at breakpoints or even the location of where a Eclipse-compiled instances log data shows up.

Current skeleton for reference:
Code:
package jd.plugins.decrypter;

import java.util.ArrayList;

import org.appwork.utils.logging2.LogSource;
import org.jdownloader.logging.LogController;

import jd.PluginWrapper;
import jd.controlling.ProgressController;
import jd.plugins.CryptedLink;
import jd.plugins.DecrypterPlugin;
import jd.plugins.DownloadLink;
import jd.plugins.PluginForDecrypt;

@DecrypterPlugin(revision = "$Revision: 35010 $", interfaceVersion = 3, names = { "domain.here" }, urls = { "**External links are only visible to Support Staff** })

public class classNameHere extends PluginForDecrypt {
    
    protected final LogSource logger = LogController.CL();

    public classNameHere(PluginWrapper wrapper) {
        super(wrapper);
    }

    @Override
    public ArrayList<DownloadLink> decryptIt(CryptedLink param, ProgressController progress) throws Exception {
        ArrayList<DownloadLink> decryptedLinks = new ArrayList<DownloadLink>();
        final String parameter = param.toString().replace("http:", "https:");
        final String page = br.getPage(parameter);

        logger.info("--------------------------------------------------------------");
        logger.info("parameter --------------------------------------------------------------");
        logger.info(parameter);
        logger.info("--------------------------------------------------------------");
        logger.info("page --------------------------------------------------------------");
        logger.info(page);
        logger.info("--------------------------------------------------------------");
        logger.info("--------------------------------------------------------------");

        return decryptedLinks;
    }

}
Thanks in advance for any help so I can get started contributing plugins for various streaming sites!

Last edited by raztoki; 19.08.2018 at 03:10.
Reply With Quote
  #2  
Old 19.08.2018, 03:17
raztoki's Avatar
raztoki raztoki is offline
English Supporter
 
Join Date: Apr 2010
Location: Australia
Posts: 16,569
Default

Hi thanks for this post, Ive tied it up as it wasn't accurate, the regex escaping was doubled or tripled in places. I recommend using working examples as the best solution to understand how things work. As in find a site that you use (simpler website the better) that is supported by JDownloader, add a breakpoint within your desired method on the first line, switch to debug mode in your favourite IDE, and follow the steps the plugin takes to get the outcome required. There are hundreds of working examples and I found this as the best way to learn as a new comer to the project.

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

Don't fight the system, use it to your advantage. :]

Last edited by raztoki; 19.08.2018 at 03:19.
Reply With Quote
  #3  
Old 19.08.2018, 04:54
Iskelderon's Avatar
Iskelderon Iskelderon is offline
JD Adviser
 
Join Date: Aug 2018
Location: Europe
Posts: 111
Default

Quote:
Originally Posted by raztoki View Post
Hi thanks for this post, Ive tied it up as it wasn't accurate, the regex escaping was doubled or tripled in places.
Thanks, unfortunately the RegEx was replaced by
Code:
{ "**External links are only visible to Supporters** }
I copied the example from another plugin and it seemed to pass an online check (I'm still new to the way Java escapes these expression strings), so I wasn't sure where the problem was.

Quote:
Originally Posted by raztoki View Post
I recommend using working examples as the best solution to understand how things work. As in find a site that you use (simpler website the better) that is supported by JDownloader, add a breakpoint within your desired method on the first line, switch to debug mode in your favourite IDE, and follow the steps the plugin takes to get the outcome required. There are hundreds of working examples and I found this as the best way to learn as a new comer to the project.

raztoki
Thanks, I tried that, but this test class probably wasn't touched, the breakpoint I had set was ignored as well.
Do I need to configure more (as in the wiki entry for the JAR file) or is the Eclipse setup article enough to get the debugger and breakpoints working?
Reply With Quote
  #4  
Old 19.08.2018, 05:23
Iskelderon's Avatar
Iskelderon Iskelderon is offline
JD Adviser
 
Join Date: Aug 2018
Location: Europe
Posts: 111
Default

Thanks, found the new regular expression in the forum's diff feature and edited the domain name, but launching the project in debug mode with a breakpoint on the "final String page = br.getPage(parameter);" line still doesn't lead to any reaction. JD reacts the same way as before, as if the class wasn't there.
Reply With Quote
  #5  
Old 19.08.2018, 06:15
tony2long's Avatar
tony2long tony2long is offline
English Supporter
 
Join Date: Jun 2009
Posts: 6,308
Default

Not quite understand your posts, did you copy a plugin, change and save it, run debug, copy a link and JD didn't take it?
__________________
FAQ: How to upload a Log
Reply With Quote
  #6  
Old 20.08.2018, 13:06
Iskelderon's Avatar
Iskelderon Iskelderon is offline
JD Adviser
 
Join Date: Aug 2018
Location: Europe
Posts: 111
Default

I think I'm getting the hang of this, but not quite, as shown by the problems in https://board.jdownloader.org/showthread.php?t=78461
Reply With Quote
  #7  
Old 20.08.2018, 15:13
tony2long's Avatar
tony2long tony2long is offline
English Supporter
 
Join Date: Jun 2009
Posts: 6,308
Default

You take a difficult example for learning (encoded/hidden), but basically you need to create hoster plugin for animo-pace-stream.io first, because final link (video.xx.fbcdn.net) seems session bound.
__________________
FAQ: How to upload a Log
Reply With Quote
  #8  
Old 20.08.2018, 19:40
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 66,134
Default

You should first setup your IDE (eg. eclipse) and get JDownloader running within IDE.
Then you can modify/create new plugin classes eg in jd.plugins.decrypter for decrypter/crawler and jd.plugins.hoster for hoster/download. There are many many example links.
For breakpoints to work, it's important to start with 'Debug' and not 'Run' from within your IDE (eg eclipse).

There is a 3rd party *little help/how to*, see https://support.jdownloader.org/Know...lopment-german
Some parts are in german but you can use google translate. It states some most used/important methods and explains the basics with Browser and Regex classes.

I suggest we do a teamviewer session and we'll help you setup your IDE and get your first (dummy) plugin working and show you the basics of debugging.
__________________
JD-Dev & Server-Admin

Last edited by Jiaz; 20.08.2018 at 19:42.
Reply With Quote
  #9  
Old 20.08.2018, 19:44
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 66,134
Default

Quote:
Originally Posted by Iskelderon View Post
Do I need to configure more (as in the wiki entry for the JAR file) or is the Eclipse setup article enough to get the debugger and breakpoints working?
Once you can run JDownloader from within eclipse, you can also debug it. But it's important to run JDownloader via 'Debug' button in eclipse
__________________
JD-Dev & Server-Admin
Reply With Quote
  #10  
Old 20.08.2018, 19:45
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 66,134
Default

Quote:
Originally Posted by Iskelderon View Post
Thanks, found the new regular expression in the forum's diff feature and edited the domain name, but launching the project in debug mode with a breakpoint on the "final String page = br.getPage(parameter);" line still doesn't lead to any reaction. JD reacts the same way as before, as if the class wasn't there.
It's important that the class is on correct package
either jd.plugins.hoster or jd.plugins.decrypter

Also make sure that the pattern is correct, else your plugin won't pick up the link
__________________
JD-Dev & Server-Admin
Reply With Quote
  #11  
Old 20.08.2018, 20:06
Iskelderon's Avatar
Iskelderon Iskelderon is offline
JD Adviser
 
Join Date: Aug 2018
Location: Europe
Posts: 111
Default

Quote:
Originally Posted by Jiaz View Post
Once you can run JDownloader from within eclipse, you can also debug it. But it's important to run JDownloader via 'Debug' button in eclipse
Thanks, the wiki article on debugging the JAR file is what threw me off. Both your help and the resources you mentioned are what brought me even this far.

Quote:
Originally Posted by Jiaz View Post
It's important that the class is on correct package
either jd.plugins.hoster or jd.plugins.decrypter

Also make sure that the pattern is correct, else your plugin won't pick up the link
Thanks, my problem was that Eclipse automatically escapes patterns a second time if you paste them inside double quotes. Adding the quotes afterwards works as a workaround. Found that out thanks to raztoki's comment and his edit to the original code snippet.

I think I'm now at a stable point in the other thread, but I still have to decrypt the actual video URLs.
The site in question does an IFrame embed of another site and the HTML on that site contains the obfuscated links to the hosters. Can I write another decrypter for that second site that will be triggered by the embed links on this first site?

Last edited by Iskelderon; 20.08.2018 at 20:13.
Reply With Quote
  #12  
Old 20.08.2018, 20:08
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 66,134
Default

You can disable that auto escaping I've got it disabled because for patterns it's more annoying than helping
__________________
JD-Dev & Server-Admin
Reply With Quote
  #13  
Old 20.08.2018, 20:09
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 66,134
Default

You can also contact us via support@jdownloader.org or in live chat (irc, freenode, #jdteam)
We can also offer help via Teamviewer. You can contact us Mo-Fr from 9-17 o'clock, GMT+2(Germany)
__________________
JD-Dev & Server-Admin
Reply With Quote
  #14  
Old 20.08.2018, 20:17
Iskelderon's Avatar
Iskelderon Iskelderon is offline
JD Adviser
 
Join Date: Aug 2018
Location: Europe
Posts: 111
Default

Thanks, I tried the IRC channel, but probably was too late on Friday (hence the struggling progress in these two threads). The general jDownloader channel doesn't allow posting since newcomers are muted. I've already registered my nick, but that itself doesn't seem to be enough. I'll add the team channel in another tab.
Reply With Quote
  #15  
Old 20.08.2018, 20:23
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 66,134
Default

You have to register and identify your account. freenode introduced that because of high spam
__________________
JD-Dev & Server-Admin
Reply With Quote
  #16  
Old 20.08.2018, 20:44
Iskelderon's Avatar
Iskelderon Iskelderon is offline
JD Adviser
 
Join Date: Aug 2018
Location: Europe
Posts: 111
Default

Thanks, I've already registered and verified the nick. It seems to work in the team channel, but the general JD channel probably requires explicit voice permission.
Reply With Quote
  #17  
Old 21.08.2018, 11:08
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 66,134
Default

We've fixed the main channel. But for specific development questions, better join #jdteam
__________________
JD-Dev & Server-Admin
Reply With Quote
  #18  
Old 06.12.2019, 06:45
tony2long's Avatar
tony2long tony2long is offline
English Supporter
 
Join Date: Jun 2009
Posts: 6,308
Default How to pass information from a decrypter to another decrypter plugin?

How to pass information from a decrypter to another decrypter plugin?
Sometimes we need to pass filename to another decrypter plugin.
Error:
The method getStringProperty(String, null) is undefined for the type CryptedLink
__________________
FAQ: How to upload a Log
Reply With Quote
  #19  
Old 07.12.2019, 03:37
raztoki's Avatar
raztoki raztoki is offline
English Supporter
 
Join Date: Apr 2010
Location: Australia
Posts: 16,569
Default

CrawledLink source = getCurrentLink();
if (source != null) { source.get...
__________________
raztoki @ jDownloader reporter/developer
http://svn.jdownloader.org/users/170

Don't fight the system, use it to your advantage. :]
Reply With Quote
  #20  
Old 07.12.2019, 09:50
tony2long's Avatar
tony2long tony2long is offline
English Supporter
 
Join Date: Jun 2009
Posts: 6,308
Default

Thanks, raztoki, but it still get error:
The method getStringProperty(String, null) is undefined for the type CrawledLink
The method getFinalFileName() is undefined for the type CrawledLink
__________________
FAQ: How to upload a Log
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 11:01.
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.