#1
|
||||
|
||||
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; } } Last edited by raztoki; 19.08.2018 at 03:10. |
#2
|
||||
|
||||
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. |
#3
|
||||
|
||||
Quote:
Code:
{ "**External links are only visible to Supporters** } Quote:
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? |
#4
|
||||
|
||||
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.
|
#5
|
||||
|
||||
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 |
#6
|
||||
|
||||
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
|
#7
|
||||
|
||||
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 |
#8
|
||||
|
||||
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. |
#9
|
||||
|
||||
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 |
#10
|
||||
|
||||
Quote:
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 |
#11
|
||||
|
||||
Quote:
Quote:
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. |
#12
|
||||
|
||||
You can disable that auto escaping I've got it disabled because for patterns it's more annoying than helping
__________________
JD-Dev & Server-Admin |
#13
|
||||
|
||||
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 |
#14
|
||||
|
||||
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.
|
#15
|
||||
|
||||
You have to register and identify your account. freenode introduced that because of high spam
__________________
JD-Dev & Server-Admin |
#16
|
||||
|
||||
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.
|
#17
|
||||
|
||||
We've fixed the main channel. But for specific development questions, better join #jdteam
__________________
JD-Dev & Server-Admin |
Thread Tools | |
Display Modes | |
|
|