27.07.2019

Jdownloader 2 Serienjunkies Captcha Erkennung

MyJDownloader allows you to remote control your JDownloader from everywhere. Use the web interface, your phone or tablet with Android, iOS or Windows 10 or the extensions for Firefox, Chrome or Opera. Start, stop and pause downloads.

  1. Jdownloader 2 Serienjunkies Captcha Erkennung Free

JDownloader 2 captcha umgehen (serienjunkies) Tutorials. Will mir eine Serie downloaden von Dokujunkies bzw serienjunkies. JD opens my browser to display captchas. Posted by Jay Downloader, Last modified by Jiaz on 28 April 2017 11:42 AM. The captcha will then be shown in JDownloader standard captcha dialog. Browser Loop can be avoided with setting up 'google.com (recapthca)' account in Settings Account Manager. This account provides the required information.

Permalink

Join GitHub today

Jdownloader 2 serienjunkies captcha erkennung 1

GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.

Sign up
Find file Copy path
Cannot retrieve contributors at this time
// jDownloader - Downloadmanager
// Copyright (C) 2008 JD-Team support@jdownloader.org
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
packagejd.plugins.decrypter;
importjava.io.File;
importjava.io.IOException;
importjava.util.ArrayList;
importjava.util.Arrays;
importjava.util.concurrent.atomic.AtomicInteger;
importjava.util.concurrent.atomic.AtomicLong;
importjd.PluginWrapper;
importjd.controlling.ProgressController;
importjd.controlling.reconnect.Reconnecter;
importjd.gui.UserIO;
importjd.http.Browser;
importjd.http.URLConnectionAdapter;
importjd.nutils.JDHash;
importjd.parser.Regex;
importjd.parser.html.Form;
importjd.plugins.CryptedLink;
importjd.plugins.DecrypterPlugin;
importjd.plugins.DownloadLink;
importjd.plugins.PluginForDecrypt;
importjd.utils.EditDistance;
importjd.utils.locale.JDL;
@DecrypterPlugin(revision='$Revision$', interfaceVersion=2, names= { 'serienjunkies.org', 'dokujunkies.org' }, urls= { 'http://[w.]*?serienjunkies.org/([a-z]{1,2}[_-][a-f0-9]{16}.* go-[a-f0-9]{128}/)', 'http://[w.]*?dokujunkies.org/[w-/]+.*.html' }, flags= { 0, 0 })
publicclassSrnnksextendsPluginForDecrypt {
classDecryptRunnableimplementsRunnable {
privatefinalString action;
privatefinalBrowser br;
privatefinalArrayList<DownloadLink> results;
publicDecryptRunnable(finalStringaction, finalBrowserbr, finalArrayList<DownloadLink>results) {
this.action = action;
this.br = br;
this.results = results;
}
publicvoidrun() {
// sj heuristic detection. this makes the jobber useless... but we have to use the 300 ms to work around sj's firewall
try {
Thread.sleep(FW_WAIT);
try {
if (isAbort()) {
return;
}
} catch (finalThrowable e) {
/* not available in old 09581 stable */
}
this.br.getPage(this.action);
if (this.br.getRedirectLocation() !=null) {
this.results.add(Srnnks.this.createDownloadlink(this.br.getRedirectLocation()));
} else {
// not sure if there are still pages that use this old system
finalString link =this.br.getRegex('SRC='(http://download.serienjunkies.org.*?)'').getMatch(0);
if (link !=null) {
Thread.sleep(FW_WAIT);
try {
if (isAbort()) {
return;
}
} catch (finalThrowable e) {
/* not available in old 09581 stable */
}
this.br.getPage(link);
finalString loc =this.br.getRedirectLocation();
if (loc !=null) {
this.results.add(Srnnks.this.createDownloadlink(loc));
return;
} else {
thrownewException('no Redirect found');
}
} else {
thrownewException('no Frame found');
}
}
} catch (finalThrowable e) {
e.printStackTrace();
}
}
}
privatefinalArrayList<String> passwords =newArrayList<String>(Arrays.asList(newString[] { 'serienjunkies.dl.am', 'serienjunkies.org', 'dokujunkies.org' }));
privatestaticAtomicLongLATEST_BLOCK_DETECT=newAtomicLong(0);
privatestaticAtomicLongLATEST_RECONNECT=newAtomicLong(0);
privatestaticObjectGLOBAL_LOCK=newObject();
// seems like sj does block ips if requestlimit is not ok
privatefinallongFW_WAIT=300;
privatestaticObjectLOCK=newObject();
privatestaticAtomicIntegerRUNNING=newAtomicInteger(0);
// Always use real-expire-seconds minus 2
privateintCAPTCHA_EXPIRE_SECONDS=58;
privateintCAPTCHA_MAXRETRIES=8;
privatesynchronizedstaticbooleanlimitsReached(finalBrowserbr) throwsIOException {
int ret =-100;
longOldBlock=Srnnks.LATEST_BLOCK_DETECT.get();
longOldReconnect=Srnnks.LATEST_RECONNECT.get();
if (br null) {
ret =UserIO.RETURN_OK;
} else {
if (br.containsHTML('Error 503')) {
UserIO.getInstance().requestMessageDialog(JDL.L('plugins.decrypter.srnks.overloaded', 'Serienjunkies ist überlastet. Bitte versuche es später erneut.'));
returntrue;
}
if (br.containsHTML('Du hast zu oft das Captcha falsch')) {
Srnnks.LATEST_BLOCK_DETECT.set(System.currentTimeMillis());
if (System.currentTimeMillis() -OldBlock<60000) {
returntrue;
}
if (System.currentTimeMillis() -OldReconnect<15000) {
// redo the request
br.loadConnection(br.openRequestConnection(null));
returnfalse;
}
ret =UserIO.getInstance().requestConfirmDialog(0, 'Captchalimit', JDL.L('plugins.decrypter.srnks.CaptchaLimitReached', 'Sie haben zu oft das Captcha falsch eingegeben sie müssen entweder warten oder einen Reconnect durchführen'), null, 'Reconnect', JDL.L('plugins.decrypter.srnks.canceldecrypt', 'Decryptvorgang abbrechen'));
}
if (br.containsHTML('Download-Limit')) {
Srnnks.LATEST_BLOCK_DETECT.set(System.currentTimeMillis());
if (System.currentTimeMillis() -OldBlock<60000) {
returntrue;
}
if (System.currentTimeMillis() -OldReconnect<15000) {
// redo the request
br.loadConnection(br.openRequestConnection(null));
returnfalse;
}
ret =UserIO.getInstance().requestConfirmDialog(0, 'Downloadlimit', JDL.L('plugins.decrypter.srnks.DownloadLimitReached', 'Das Downloadlimit wurde erreicht sie müssen entweder warten oder einen Reconnect durchführen'), null, 'Reconnect', JDL.L('plugins.decrypter.srnks.canceldecrypt', 'Decryptvorgang abbrechen'));
}
}
if (ret !=-100) {
if (UserIO.isOK(ret)) {
if (Reconnecter.waitForNewIP(15000, false)) {
Srnnks.LATEST_RECONNECT.set(System.currentTimeMillis());
// redo the request
br.loadConnection(br.openRequestConnection(null));
returnfalse;
}
}
returntrue;
}
returnfalse;
}
privateString crawlStatus;
publicSrnnks(finalPluginWrapperwrapper) {
super(wrapper);
}
@Override
protectedDownloadLinkcreateDownloadlink(finalStringlink) {
finalDownloadLink dlink =super.createDownloadlink(link);
dlink.setSourcePluginPasswordList(passwords);
try {
this.distribute(dlink);
} catch (Throwable t) {
}
return dlink;
}
publicStringgetCrawlerStatusString() {
return crawlStatus;
}
@Override
publicArrayList<DownloadLink>decryptIt(finalCryptedLinkparameter, finalProgressControllerprogress) throwsException {
// crude importation method from doju -> serien
if (parameter.getCryptedUrl().contains('dokujunkies.org')) {
ArrayList<DownloadLink> decryptedLinks =newArrayList<DownloadLink>();
String parm = parameter.toString();
br.setFollowRedirects(false);
br.setCookiesExclusive(true);
br.getPage(parm);
if (br.containsHTML('<h2>Error 404 - Page not found!</h2>')) {
logger.warning('Invalid URL: '+ parameter);
return decryptedLinks;
}
String grab = br.getRegex('<p><strong>[w-.]+</strong><br />(.*?)<div class='post_details'>').getMatch(0);
String[] links =newRegex(grab, 'href='(http://[w.]*?serienjunkies.org/.*?)' target').getColumn(0);
if (links !=null&& links.length !=0) {
for (String link : links) {
decryptedLinks.add(createDownloadlink(link));
}
}
return decryptedLinks;
} elseif (parameter.getCryptedUrl().contains('serienjunkies.org')) {
if (parameter.getCryptedUrl().matches('.+/go-[a-f0-9]{128}/')) {
ArrayList<DownloadLink> decryptedLinks =newArrayList<DownloadLink>();
// redirect support if the user adds copies these temp hash
br.setFollowRedirects(false);
br.getPage(parameter.getCryptedUrl());
String link = br.getRedirectLocation();
if (link !=null) {
decryptedLinks.add(createDownloadlink(link));
return decryptedLinks;
} else {
logger.warning('Failed to find temp redirect link location!');
}
} else {
try {
// Browser.setRequestIntervalLimitGlobal('serienjunkies.org', 400);
// Browser.setRequestIntervalLimitGlobal('download.serienjunkies.org', 400);
finalArrayList<DownloadLink> ret =newArrayList<DownloadLink>();
Form[] forms;
// progress.setStatusText('Lade Downloadseite');
for (int i =0; i <CAPTCHA_MAXRETRIES; i++) {
progress.setRange(100);
try {
if (isAbort()) {
returnnewArrayList<DownloadLink>(ret);
}
} catch (finalThrowable e) {
/* not available in old 09581 stable */
}
try {
RUNNING.incrementAndGet();
synchronized (LOCK) {
synchronized (Srnnks.GLOBAL_LOCK) {
Thread.sleep(FW_WAIT);
try {
if (isAbort()) {
returnnewArrayList<DownloadLink>(ret);
}
} catch (finalThrowable e) {
/* not available in old 09581 stable */
}
this.br.getPage(parameter.getCryptedUrl());
}
if (Srnnks.limitsReached(this.br)) {
returnnewArrayList<DownloadLink>(ret);
}
if (this.br.containsHTML('<FRAME SRC')) {
// progress.setStatusText('Lade Downloadseitenframe');
synchronized (Srnnks.GLOBAL_LOCK) {
Thread.sleep(FW_WAIT);
try {
if (isAbort()) {
returnnewArrayList<DownloadLink>(ret);
}
} catch (finalThrowable e) {
/* not available in old 09581 stable */
}
this.br.getPage(this.br.getRegex('<FRAME SRC='(.*?)'').getMatch(0));
}
}
if (Srnnks.limitsReached(this.br)) {
returnnewArrayList<DownloadLink>(ret);
}
progress.increase(5);
// linkendung kommt auch im action der form vor
finalString sublink = parameter.getCryptedUrl().substring(parameter.getCryptedUrl().indexOf('org/') +3);
// try captcha max 5 times
progress.setRange(100);
progress.setStatus(5);
// suche wahrscheinlichste form
// progress.setStatusText('Suche Captcha Form');
Form form =null;
forms =this.br.getForms();
int bestdist =Integer.MAX_VALUE;
if (forms !=null) {
for (finalForm form1 : forms) {
if (form1.getAction() null) {
continue;
}
finalint dist =EditDistance.damerauLevenshteinDistance(sublink, form1.getAction());
if (dist < bestdist) {
form = form1;
bestdist = dist;
}
}
}
if (form !=null&& form.getRegex('img.*?src='([^']*?secure)').matches()) {
/*
* this form contains captcha image, so it must be valid
*/
} elseif (bestdist >100) {
form =null;
}
if (form null) {
thrownewException('Serienjunkies Captcha Form konnte nicht gefunden werden!');
}
progress.increase(5);
// das bild in der Form ist das captcha
String captchaLink =newRegex(form.getHtmlCode(), '<IMG SRC='(.*?)'').getMatch(0);
// if (captchaLink null) { throw new Exception('Serienjunkies Captcha konnte nicht gefunden werden!'); }
if (captchaLink !=null) {
System.out.println('CAPTCHA!!!');
// only each 5 link needs captchas
if (!captchaLink.toLowerCase().startsWith('http://')) {
String base =newRegex(br.getURL(), '(http.*?.org)').getMatch(0);
if (base !=null) {
captchaLink = base + captchaLink;
} else {
captchaLink ='http://download.serienjunkies.org'+ captchaLink;
}
}
crawlStatus = br.getRegex('<TITLE>.* - (.*?)</TITLE>').getMatch(0);
if (crawlStatus null) {
crawlStatus ='';
}
crawlStatus +='('+RUNNING.intValue() +' pending)';
finalFile captcha =this.getLocalCaptchaFile('.png');
String code =null;
long timeBefore =0;
try {
// captcha laden
synchronized (Srnnks.GLOBAL_LOCK) {
Thread.sleep(FW_WAIT);
try {
if (isAbort()) {
returnnewArrayList<DownloadLink>(ret);
}
} catch (finalThrowable e) {
/* not available in old 09581 stable */
}
finalURLConnectionAdapter urlc =this.br.cloneBrowser().openGetConnection(captchaLink);
Browser.download(captcha, urlc);
}
if ('7ebca510a6a18c1e8f6e8d98c3118874'.equals(JDHash.getMD5(captcha))) {
// dummy captcha without content.. wait before reloading
logger.warning('Dummy Captcha. wait 3 seconds');
Thread.sleep(3000);
try {
if (isAbort()) {
returnnewArrayList<DownloadLink>(ret);
}
} catch (finalThrowable e) {
/* not available in old 09581 stable */
}
continue;
}
// wenn es ein Einzellink ist soll die Captchaerkennung benutzt werden
timeBefore =System.currentTimeMillis();
if (captchaLink.contains('.gif')) {
code =this.getCaptchaCode('einzellinks.serienjunkies.org', captcha, parameter);
} else {
code =this.getCaptchaCode(captcha, parameter);
}
} finally {
captcha.delete();
}
if (code null) {
return ret;
}
if (code.length() !=3) {
progress.setStatus(30);
Thread.sleep(1100);
continue;
}
if (captchaIsExpired(timeBefore)) {
progress.setStatus(30);
Thread.sleep(1100);
continue;
}
progress.increase(5);
form.getInputFieldByType('text').setValue(code);
// System.out.println(code);
synchronized (Srnnks.GLOBAL_LOCK) {
Thread.sleep(FW_WAIT);
this.br.submitForm(form);
}
} else {
System.out.println('CAPTCHA SKIP!!!');
}
}
} finally {
System.out.println(RUNNING.decrementAndGet());
}
if (Srnnks.limitsReached(this.br)) {
returnnewArrayList<DownloadLink>(ret);
}
if (this.br.getRedirectLocation() !=null) {
ret.add(this.createDownloadlink(this.br.getRedirectLocation()));
progress.doFinalize();
returnnewArrayList<DownloadLink>(ret);
} else {
progress.setStatus(0);
forms =this.br.getForms();
// suche die downloadlinks
finalArrayList<String> actions =newArrayList<String>();
for (finalForm frm : forms) {
if (frm.getAction().contains('download.serienjunkies.org') &&!frm.getAction().contains('firstload') &&!frm.getAction().equals('http://mirror.serienjunkies.org')) {
actions.add(frm.getAction());
}
}
// es wurden keine Links gefunden also wurde das Captcha falsch eingegeben
if (actions.size() 0) {
progress.setStatus(10);
// progress.setStatusText('Captcha code falsch');
try {
invalidateLastChallengeResponse();
} catch (finalThrowable e) {
}
continue;
} else {
try {
validateLastChallengeResponse();
} catch (finalThrowable e) {
}
}
// we need the 300 ms gap between two requests..
progress.setRange(10+ actions.size());
progress.setStatus(10);
synchronized (Srnnks.GLOBAL_LOCK) {
for (int d =0; d < actions.size(); d++) {
try {
if (isAbort()) {
returnnewArrayList<DownloadLink>(ret);
}
} catch (finalThrowable e) {
/* not available in old 09581 stable */
}
this.newDecryptRunnable(actions.get(d), this.br.cloneBrowser(), ret).run();
progress.increase(1);
}
}
// wenn keine links drinnen sind ist bestimmt was mit dem captcha schief gegangen einfach nochmal versuchen
if (ret.size() !=0) {
return ret;
}
}
}
returnnewArrayList<DownloadLink>(ret);
} catch (finalException e) {
throw e;
} finally {
progress.doFinalize();
}
}
}
returnnewArrayList<DownloadLink>();
}
privatebooleancaptchaIsExpired(finallongtimeBefore) {
finallong timeDifference =System.currentTimeMillis() - timeBefore;
if (timeDifference > (CAPTCHA_EXPIRE_SECONDS*1000l)) {
returntrue;
} else {
returnfalse;
}
}
/* NO OVERRIDE!! */
publicbooleanhasCaptcha(CryptedLinklink, jd.plugins.Accountacc) {
returntrue;
}
}
  • Copy lines
  • Copy permalink
Permalink

Join GitHub today

Serienjunkies

Jdownloader 2 Serienjunkies Captcha Erkennung Free

GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.

Sign up
Find file Copy path
Cannot retrieve contributors at this time
Jdownloader
// jDownloader - Downloadmanager
// Copyright (C) 2008 JD-Team support@jdownloader.org
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
packagejd.plugins.decrypter;
importjava.io.File;
importjava.io.IOException;
importjava.util.ArrayList;
importjava.util.concurrent.atomic.AtomicInteger;
importjd.PluginWrapper;
importjd.controlling.JDLogger;
importjd.controlling.ProgressController;
importjd.controlling.reconnect.Reconnecter;
importjd.gui.UserIO;
importjd.http.Browser;
importjd.http.URLConnectionAdapter;
importjd.nutils.JDHash;
importjd.nutils.jobber.JDRunnable;
importjd.parser.Regex;
importjd.parser.html.Form;
importjd.plugins.CryptedLink;
importjd.plugins.DecrypterPlugin;
importjd.plugins.DownloadLink;
importjd.plugins.PluginForDecrypt;
importjd.utils.EditDistance;
@DecrypterPlugin(revision='$Revision$', interfaceVersion=2, names= { 'serienjunkies.org', 'dokujunkies.org' }, urls= { 'http://[w.]*?serienjunkies.org/.*?/(df st so hf fs mu rc rs nl u[tl] ff fc wu)[_-].*', 'http://[w.]*?dokujunkies.org/[w-/]+.*.html' }, flags= { 0 })
publicclassSrnnksextendsPluginForDecrypt {
classDecryptRunnableimplementsJDRunnable {
privatefinalString action;
privatefinalBrowser br;
privatefinalArrayList<DownloadLink> results;
publicDecryptRunnable(finalStringaction, finalBrowserbr, finalArrayList<DownloadLink>results) {
this.action = action;
this.br = br;
this.results = results;
}
publicvoidgo() throwsException {
// sj heuristic detection.
// this makes the jobber useless... but we have to use the 300 ms to
// work around sj's firewall
Thread.sleep(Srnnks.FW_WAIT);
this.br.getPage(this.action);
if (this.br.getRedirectLocation() !=null) {
this.results.add(Srnnks.this.createDownloadlink(this.br.getRedirectLocation()));
} else {
// not sure if there are stil pages that use this old system
finalString link =this.br.getRegex('SRC='(http://download.serienjunkies.org.*?)'').getMatch(0);
if (link !=null) {
Thread.sleep(Srnnks.FW_WAIT);
this.br.getPage(link);
finalString loc =this.br.getRedirectLocation();
if (loc !=null) {
this.results.add(Srnnks.this.createDownloadlink(loc));
return;
} else {
thrownewException('no Redirect found');
}
} else {
thrownewException('no Frame found');
}
}
}
}
privatefinalstaticString[] passwords = { 'serienjunkies.dl.am', 'serienjunkies.org', 'dokujunkies.org' };
privatestaticlongLATEST_BLOCK_DETECT=0;
privatestaticlongLATEST_RECONNECT=0;
privatestaticObjectGLOBAL_LOCK=newObject();
// seems like sj does block ips if requestlimit is not ok
privatestaticfinallongFW_WAIT=300;
privatestaticfinalObjectLOCK=newObject();
privatestaticAtomicIntegerRUNNING=newAtomicInteger(0);
privatesynchronizedstaticbooleanlimitsReached(finalBrowserbr) throwsIOException {
int ret =-100;
if (br null) {
ret =UserIO.RETURN_OK;
} else {
if (br.containsHTML('Error 503')) {
UserIO.getInstance().requestMessageDialog('Serienjunkies ist überlastet. Bitte versuch es später nocheinmal!');
returntrue;
}
if (br.containsHTML('Du hast zu oft das Captcha falsch')) {
if (System.currentTimeMillis() -Srnnks.LATEST_BLOCK_DETECT<60000) { returntrue; }
if (System.currentTimeMillis() -Srnnks.LATEST_RECONNECT<15000) {
// redo the request
br.loadConnection(br.openRequestConnection(br.getRequest().cloneRequest()));
returnfalse;
}
ret =UserIO.getInstance().requestConfirmDialog(0, 'Captchalimit', 'Sie haben zu oft das Captcha falsch eingegeben sie müssen entweder warten oder einen Reconnect durchführen', null, 'Reconnect', 'Decrypten abbrechen');
}
if (br.containsHTML('Download-Limit')) {
if (System.currentTimeMillis() -Srnnks.LATEST_BLOCK_DETECT<60000) { returntrue; }
if (System.currentTimeMillis() -Srnnks.LATEST_RECONNECT<15000) {
// redo the request
br.loadConnection(br.openRequestConnection(br.getRequest().cloneRequest()));
returnfalse;
}
ret =UserIO.getInstance().requestConfirmDialog(0, 'Downloadlimit', 'Das Downloadlimit wurde erreicht sie müssen entweder warten oder einen Reconnect durchführen', null, 'Reconnect', 'Decrypten abbrechen');
}
}
if (ret !=-100) {
if (UserIO.isOK(ret)) {
try {
jd.controlling.reconnect.ipcheck.IPController.getInstance().invalidate();
} catch (Throwable e) {
/* not in 9580 stable */
}
if (Reconnecter.waitForNewIP(15000, false)) {
// redo the request
br.loadConnection(br.openRequestConnection(br.getRequest().cloneRequest()));
Srnnks.LATEST_RECONNECT=System.currentTimeMillis();
returnfalse;
}
} else {
Srnnks.LATEST_BLOCK_DETECT=System.currentTimeMillis();
}
returntrue;
}
returnfalse;
}
privateString crawlStatus;
privatestaticbooleanCAPTCHA=false;
publicSrnnks(finalPluginWrapperwrapper) {
super(wrapper);
}
@Override
protectedDownloadLinkcreateDownloadlink(finalStringlink) {
finalDownloadLink dlink =super.createDownloadlink(link);
dlink.addSourcePluginPasswords(Srnnks.passwords);
try {
this.distribute(dlink);
} catch (Throwable t) {
}
return dlink;
}
publicStringgetCrawlerStatusString() {
return crawlStatus;
}
@Override
publicArrayList<DownloadLink>decryptIt(finalCryptedLinkparameter, finalProgressControllerprogress) throwsException {
finalArrayList<DownloadLink>SjDj=newArrayList<DownloadLink>();
// crude importation method from doju -> serien
if (parameter.getCryptedUrl().contains('dokujunkies.org')) {
ArrayList<DownloadLink> decryptedLinks =newArrayList<DownloadLink>();
String parm = parameter.toString();
br.setFollowRedirects(false);
br.setCookiesExclusive(true);
br.getPage(parm);
if (br.containsHTML('<h2>Error 404 - Page not found!</h2>')) {
logger.warning('Invalid URL: '+ parameter);
return decryptedLinks;
}
String grab = br.getRegex('<p><strong>[w-.]+</strong><br />(.*?)<div class='post_details'>').getMatch(0);
String[] links =newRegex(grab, 'href='(http://[w.]*?serienjunkies.org/.*?)' target').getColumn(0);
if (links !=null&& links.length !=0) {
for (String link : links)
decryptedLinks.add(createDownloadlink(link));
}
return decryptedLinks;
} elseif (parameter.getCryptedUrl().contains('serienjunkies.org')) {
try {
// Browser.setRequestIntervalLimitGlobal('serienjunkies.org',
// 400);
// Browser.setRequestIntervalLimitGlobal('download.serienjunkies.org',
// 400);
finalArrayList<DownloadLink> ret =newArrayList<DownloadLink>();
Form[] forms;
// progress.setStatusText('Lade Downloadseite');
for (int i =0; i <5; i++) {
progress.setRange(100);
try {
RUNNING.incrementAndGet();
synchronized (LOCK) {
System.out.println(parameter.getCryptedUrl());
synchronized (Srnnks.GLOBAL_LOCK) {
Thread.sleep(Srnnks.FW_WAIT);
this.br.getPage(parameter.getCryptedUrl());
}
if (Srnnks.limitsReached(this.br)) { returnnewArrayList<DownloadLink>(ret); }
if (this.br.containsHTML('<FRAME SRC')) {
// progress.setStatusText('Lade Downloadseitenframe');
synchronized (Srnnks.GLOBAL_LOCK) {
Thread.sleep(Srnnks.FW_WAIT);
this.br.getPage(this.br.getRegex('<FRAME SRC='(.*?)'').getMatch(0));
}
}
if (Srnnks.limitsReached(this.br)) { returnnewArrayList<DownloadLink>(ret); }
progress.increase(5);
// linkendung kommt auch im action der form vor
finalString sublink = parameter.getCryptedUrl().substring(parameter.getCryptedUrl().indexOf('org/') +3);
// try captcha max 5 times
progress.setRange(100);
progress.setStatus(5);
// suche wahrscheinlichste form
// progress.setStatusText('Suche Captcha Form');
Form form =null;
forms =this.br.getForms();
int bestdist =Integer.MAX_VALUE;
for (finalForm form1 : forms) {
finalint dist =EditDistance.damerauLevenshteinDistance(sublink, form1.getAction());
if (dist < bestdist) {
form = form1;
bestdist = dist;
}
}
if (form.getRegex('img.*?src='([^']*?secure)').matches()) {
/*
* this form contains captcha image, so it must
* be valid
*/
} elseif (bestdist >100) {
form =null;
}
if (form null) { thrownewException('Serienjunkies Captcha Form konnte nicht gefunden werden!'); }
progress.increase(5);
// das bild in der Form ist das captcha
String captchaLink =newRegex(form.getHtmlCode(), '<IMG SRC='(.*?)'').getMatch(0);
// if (captchaLink null) { throw new
// Exception('Serienjunkies Captcha konnte nicht gefunden werden!');
// }
if (captchaLink !=null) {
System.out.println('CAPTCHA!!!');
// only each 5 link needs captchas
if (!captchaLink.toLowerCase().startsWith('http://')) {
captchaLink ='http://'+this.br.getHost() + captchaLink;
}
crawlStatus = br.getRegex('<TITLE>.* - (.*?)</TITLE>').getMatch(0);
if (crawlStatus null) crawlStatus ='';
crawlStatus +='('+RUNNING.intValue() +' pending)';
finalFile captcha =this.getLocalCaptchaFile('.png');
// captcha laden
synchronized (Srnnks.GLOBAL_LOCK) {
Thread.sleep(Srnnks.FW_WAIT);
finalURLConnectionAdapter urlc =this.br.cloneBrowser().openGetConnection(captchaLink);
Browser.download(captcha, urlc);
}
if ('7ebca510a6a18c1e8f6e8d98c3118874'.equals(JDHash.getMD5(captcha))) {
// dummy captcha without content.. wait
// before
// reloading
JDLogger.getLogger().warning('Dummy Captcha. wait 3 seconds');
Thread.sleep(3000);
continue;
}
String code;
// wenn es ein Einzellink ist soll die
// Captchaerkennung
// benutzt
// werden
if (captchaLink.contains('.gif')) {
code =this.getCaptchaCode('einzellinks.serienjunkies.org', captcha, parameter);
} else {
code =this.getCaptchaCode(captcha, parameter);
}
if (code null) { return ret; }
if (code.length() !=3) {
progress.setStatus(30);
Thread.sleep(1100);
continue;
}
progress.increase(5);
form.getInputFieldByType('text').setValue(code);
// System.out.println(code);
synchronized (Srnnks.GLOBAL_LOCK) {
Thread.sleep(Srnnks.FW_WAIT);
this.br.submitForm(form);
}
} else {
System.out.println('CAPTCHA SKIP!!!');
}
}
} finally {
System.out.println(RUNNING.decrementAndGet());
}
if (Srnnks.limitsReached(this.br)) { returnnewArrayList<DownloadLink>(ret); }
if (this.br.getRedirectLocation() !=null) {
ret.add(this.createDownloadlink(this.br.getRedirectLocation()));
progress.doFinalize();
returnnewArrayList<DownloadLink>(ret);
} else {
progress.setStatus(0);
forms =this.br.getForms();
// suche die downloadlinks
finalArrayList<String> actions =newArrayList<String>();
for (finalForm frm : forms) {
if (frm.getAction().contains('download.serienjunkies.org') &&!frm.getAction().contains('firstload') &&!frm.getAction().equals('http://mirror.serienjunkies.org')) {
actions.add(frm.getAction());
}
}
// es wurden keine Links gefunden also wurde das Captcha
// falsch eingegeben
if (actions.size() 0) {
progress.setStatus(10);
// progress.setStatusText('Captcha code falsch');
continue;
}
// we need the 300 ms gap between two requests..
progress.setRange(10+ actions.size());
progress.setStatus(10);
synchronized (Srnnks.GLOBAL_LOCK) {
for (int d =0; d < actions.size(); d++) {
this.newDecryptRunnable(actions.get(d), this.br.cloneBrowser(), ret).go();
progress.increase(1);
}
}
progress.doFinalize();
// wenn keine links drinnen sind ist bestimmt was mit
// dem
// captcha
// schief gegangen einfach nochmal versuchen
if (ret.size() !=0) { return ret; }
}
}
returnnewArrayList<DownloadLink>(ret);
} catch (finalException e) {
throw e;
}
}
returnnewArrayList<DownloadLink>(SjDj);
}
}
  • Copy lines
  • Copy permalink