Skip to content

Commit cc2a25f

Browse files
author
updating-bot
committed
mirroring bot - 2025/10/15
1 parent 0ff62fc commit cc2a25f

File tree

10 files changed

+381
-144
lines changed

10 files changed

+381
-144
lines changed

svn_browser/src/jd/http/Browser.java

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2851,6 +2851,44 @@ public Boolean prepareBlockDetection(Browser browser, Request request) {
28512851
return null;
28522852
}
28532853
},
2854+
INCAPSULA_IMPERVA_COM {
2855+
@Override
2856+
public String getLabel() {
2857+
return "Incapsula/imperva.com";
2858+
}
2859+
2860+
@Override
2861+
public BlockedTypeInterface isBlocked(Browser browser, Request request) {
2862+
final HTTPConnection con;
2863+
if (request == null || !request.isLoaded() || (con = request.getHttpConnection()) == null) {
2864+
return null;
2865+
} else {
2866+
if (con.getResponseCode() == 200 && request.getResponseHeader("X-Iinfo") != null && browser.containsHTML("src=\"/_Incapsula_Resource")) {
2867+
for(final Cookie cookie:browser.getCookies(browser.getHost()).getCookies()) {
2868+
if(StringUtils.startsWithCaseInsensitive(cookie.getKey(), "visid_incap_")) {
2869+
return this;
2870+
}
2871+
}
2872+
}
2873+
}
2874+
return null;
2875+
}
2876+
2877+
@Override
2878+
public BlockLevelType getBlockLevelType() {
2879+
return BlockLevelType.SITE;
2880+
}
2881+
2882+
@Override
2883+
public BlockSourceType getBlockSourceType() {
2884+
return BlockSourceType.SERVICE;
2885+
}
2886+
2887+
@Override
2888+
public Boolean prepareBlockDetection(Browser browser, Request request) {
2889+
return null;
2890+
}
2891+
},
28542892
DNSPROXY_ORG {
28552893
@Override
28562894
public String getLabel() {

svn_trunk/src/jd/controlling/linkchecker/LinkChecker.java

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@
1414
import java.util.concurrent.atomic.AtomicInteger;
1515
import java.util.concurrent.atomic.AtomicLong;
1616

17+
import org.appwork.storage.config.JsonConfig;
18+
import org.appwork.utils.logging2.LogSource;
19+
import org.jdownloader.controlling.UniqueAlltimeID;
20+
import org.jdownloader.logging.LogController;
21+
import org.jdownloader.plugins.FinalLinkState;
22+
import org.jdownloader.plugins.controller.PluginClassLoader;
23+
import org.jdownloader.plugins.controller.PluginClassLoader.PluginClassLoaderChild;
24+
1725
import jd.controlling.linkcrawler.CheckableLink;
1826
import jd.controlling.linkcrawler.CrawledLink;
1927
import jd.controlling.linkcrawler.CrawledPackage;
@@ -27,14 +35,6 @@
2735
import jd.plugins.PluginException;
2836
import jd.plugins.PluginForHost;
2937

30-
import org.appwork.storage.config.JsonConfig;
31-
import org.appwork.utils.logging2.LogSource;
32-
import org.jdownloader.controlling.UniqueAlltimeID;
33-
import org.jdownloader.logging.LogController;
34-
import org.jdownloader.plugins.FinalLinkState;
35-
import org.jdownloader.plugins.controller.PluginClassLoader;
36-
import org.jdownloader.plugins.controller.PluginClassLoader.PluginClassLoaderChild;
37-
3838
public class LinkChecker<E extends CheckableLink> {
3939
protected static class InternCheckableLink {
4040
protected final CheckableLink link;
@@ -102,7 +102,8 @@ public final LinkChecker<? extends CheckableLink> getLinkChecker() {
102102
private final AtomicLong linksRequested = new AtomicLong(0);
103103
private final boolean forceRecheck;
104104
private LinkCheckerHandler<E> handler = null;
105-
private final static int ROUNDSIZE = 80;
105+
/* Defines max batch size of links to check. */
106+
private final static int ROUNDSIZE = 100;
106107
private final static LinkCheckerEventSender EVENTSENDER = new LinkCheckerEventSender();
107108
protected final AtomicLong checkerGeneration = new AtomicLong(0);
108109
protected final AtomicBoolean runningState = new AtomicBoolean(false);
@@ -158,28 +159,31 @@ public void stopChecking() {
158159

159160
@SuppressWarnings("unchecked")
160161
protected void linkChecked(InternCheckableLink link) {
161-
if (link != null && !link.isChecked()) {
162-
final boolean stopEvent;
163-
if (link.check() && linksRequested.decrementAndGet() == 0) {
164-
synchronized (CHECKER) {
165-
if (linksRequested.get() == 0 && runningState.compareAndSet(true, false)) {
166-
stopEvent = true;
167-
if (CHECKER.get() > 0) {
168-
CHECKER.decrementAndGet();
169-
}
170-
} else {
171-
stopEvent = false;
162+
if (link == null) {
163+
return;
164+
} else if (link.isChecked()) {
165+
return;
166+
}
167+
final boolean stopEvent;
168+
if (link.check() && linksRequested.decrementAndGet() == 0) {
169+
synchronized (CHECKER) {
170+
if (linksRequested.get() == 0 && runningState.compareAndSet(true, false)) {
171+
stopEvent = true;
172+
if (CHECKER.get() > 0) {
173+
CHECKER.decrementAndGet();
172174
}
173-
}
174-
if (stopEvent) {
175-
EVENTSENDER.fireEvent(new LinkCheckerEvent(this, LinkCheckerEvent.Type.STOPPED));
175+
} else {
176+
stopEvent = false;
176177
}
177178
}
178-
final LinkCheckerHandler<E> h = handler;
179-
if (h != null && link.linkCheckAllowed()) {
180-
h.linkCheckDone((E) link.getCheckableLink());
179+
if (stopEvent) {
180+
EVENTSENDER.fireEvent(new LinkCheckerEvent(this, LinkCheckerEvent.Type.STOPPED));
181181
}
182182
}
183+
final LinkCheckerHandler<E> h = handler;
184+
if (h != null && link.linkCheckAllowed()) {
185+
h.linkCheckDone((E) link.getCheckableLink());
186+
}
183187
}
184188

185189
public void check(E... links) {
@@ -311,7 +315,7 @@ public void run() {
311315
while (it.hasNext()) {
312316
checkableLinks.add(it.next());
313317
it.remove();
314-
if (checkableLinks.size() > ROUNDSIZE) {
318+
if (checkableLinks.size() == ROUNDSIZE) {
315319
break;
316320
}
317321
}
@@ -325,7 +329,7 @@ public void run() {
325329
if (it.hasNext()) {
326330
again = size;
327331
checkableLinks.add(it.next());
328-
if (checkableLinks.size() > ROUNDSIZE) {
332+
if (checkableLinks.size() == ROUNDSIZE) {
329333
break;
330334
}
331335
it.remove();

svn_trunk/src/jd/plugins/decrypter/CadoozVoucherCrawler.java

Lines changed: 56 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import jd.plugins.PluginForDecrypt;
3333
import jd.plugins.hoster.DirectHTTP;
3434

35-
@DecrypterPlugin(revision = "$Revision: 50867 $", interfaceVersion = 3, names = {}, urls = {})
35+
@DecrypterPlugin(revision = "$Revision: 51668 $", interfaceVersion = 3, names = {}, urls = {})
3636
public class CadoozVoucherCrawler extends PluginForDecrypt {
3737
public CadoozVoucherCrawler(PluginWrapper wrapper) {
3838
super(wrapper);
@@ -79,51 +79,71 @@ public ArrayList<DownloadLink> decryptIt(final CryptedLink param, ProgressContro
7979
br.getPage(contenturl);
8080
if (br.getHttpConnection().getResponseCode() == 404) {
8181
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
82-
} else if (br.getRequest().getHtmlCode().length() < 200) {
83-
/*
84-
* E.g. plain text error
85-
* "Die übergebene Ecard ist im System nicht bekannt. Bitte prüfen Sie die übergebene URL auf Vollständigkeit. Eventuell ist der Link durch einen Zeilenumbruch unbrauchbar geworden."
82+
} else if (br.getRequest().getHtmlCode().length() < 300) {
83+
/**
84+
* E.g. plain text error "Die übergebene Ecard ist im System nicht bekannt. Bitte prüfen Sie die übergebene URL auf
85+
* Vollständigkeit. Eventuell ist der Link durch einen Zeilenumbruch unbrauchbar geworden." <br>
86+
* e.g. >Leider kam es zu einem Problem beim Versuch ihren PDF Gutschein anzuzeigen. Bitte versuchen sie es später erneut. Falls
87+
* das Problem weiter besteht, wenden sie sich bitte an den cadooz Kundendienst.
8688
*/
8789
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
8890
}
8991
final String[] htmls = br.getRegex("<div class=\"ecard[^\"]+\">(.*?)--></div>").getColumn(0);
90-
if (htmls == null || htmls.length == 0) {
91-
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
92-
}
9392
final ArrayList<DownloadLink> ret = new ArrayList<DownloadLink>();
9493
String lastShopName = null;
95-
int index = 0;
96-
for (final String html : htmls) {
97-
final String shopName = new Regex(html, "class=\"ecard-header-title\"[^>]*>([^<]+)</h3>").getMatch(0);
98-
final String downloadlink = new Regex(html, "\"(https?://[^\"]+)\"[^<]+title=\"Hier PDF anzeigen").getMatch(0);
99-
final String value = new Regex(html, ">\\s*Wert:\\s*</span>\\s*(\\d+,\\d{2})").getMatch(0);
100-
String valueMinimal = null;
101-
if (value != null) {
102-
valueMinimal = value.replace(",00", "");
103-
}
104-
final String validUntilDate = new Regex(html, " Gültig bis:\\s*</span>\\s*(\\d{4}\\.\\d{2}\\.\\d{2})").getMatch(0);
105-
final DownloadLink link = this.createDownloadlink(DirectHTTP.createURLForThisPlugin(downloadlink));
106-
String filename = shopName + "_" + valueMinimal;
107-
if (htmls.length > 1) {
108-
/* Add position to filename to ensure unique filenames if we got more than 1 item. */
109-
filename += "_" + (index + 1);
94+
if (htmls != null && htmls.length > 0) {
95+
int index = 0;
96+
int skipped_un_downloadable_items = 0;
97+
for (final String html : htmls) {
98+
final String shopName = new Regex(html, "class=\"ecard-header-title\"[^>]*>([^<]+)</h3>").getMatch(0);
99+
final String download_url = new Regex(html, "\"(https?://[^\"]+)\"[^<]+title=\"Hier PDF anzeigen").getMatch(0);
100+
final String value = new Regex(html, ">\\s*Wert:\\s*</span>\\s*(\\d+,\\d{2})").getMatch(0);
101+
String valueMinimal = null;
102+
if (value != null) {
103+
valueMinimal = value.replace(",00", "");
104+
}
105+
final String validUntilDate = new Regex(html, " Gültig bis:\\s*</span>\\s*(\\d{4}\\.\\d{2}\\.\\d{2})").getMatch(0);
106+
if (download_url == null) {
107+
skipped_un_downloadable_items++;
108+
continue;
109+
}
110+
final DownloadLink link = this.createDownloadlink(DirectHTTP.createURLForThisPlugin(download_url));
111+
String filename = shopName + "_" + valueMinimal;
112+
if (htmls.length > 1) {
113+
/* Add position to filename to ensure unique filenames if we got more than 1 item. */
114+
filename += "_" + (index + 1);
115+
}
116+
filename += ".pdf";
117+
link.setFinalFileName(filename);
118+
/* Ensure that name does not change when item is reset by user. */
119+
link.setProperty(DirectHTTP.FIXNAME, filename);
120+
/* HEAD request is not possible -> Allow only GET */
121+
link.setProperty(DirectHTTP.PROPERTY_REQUEST_TYPE, "GET");
122+
if (validUntilDate != null) {
123+
link.setComment("Gültig bis: " + validUntilDate);
124+
}
125+
link.setAvailable(true);
126+
ret.add(link);
127+
lastShopName = shopName;
128+
index++;
110129
}
111-
filename += ".pdf";
112-
link.setFinalFileName(filename);
113-
/* Ensure that name does not change when item is reset by user. */
114-
link.setProperty(DirectHTTP.FIXNAME, filename);
115-
/* HEAD request is not possible -> Allow only GET */
116-
link.setProperty(DirectHTTP.PROPERTY_REQUEST_TYPE, "GET");
117-
if (validUntilDate != null) {
118-
link.setComment("Gültig bis: " + validUntilDate);
130+
}
131+
if (ret.isEmpty()) {
132+
if (!br.containsHTML("class=\"ecard-data-code lazy\"")) {
133+
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
119134
}
120-
link.setAvailable(true);
121-
ret.add(link);
122-
lastShopName = shopName;
123-
index++;
135+
/* Text based vouchers -> Download html page */
136+
final DownloadLink text = this.createDownloadlink(br.getURL() + ".jdeatme");
137+
text.setDownloadSize(br.getRequest().getHtmlCode().getBytes("UTF-8").length);
138+
text.setAvailable(true);
139+
ret.add(text);
124140
}
125141
final FilePackage fp = FilePackage.getInstance();
126-
fp.setName(lastShopName);
142+
if (lastShopName != null) {
143+
fp.setName(lastShopName);
144+
} else {
145+
/* Fallback */
146+
}
127147
fp.setPackageKey("cadooz://ecard/" + content_id);
128148
fp.addLinks(ret);
129149
return ret;

svn_trunk/src/jd/plugins/decrypter/FilefactoryComFolder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
import jd.plugins.PluginForDecrypt;
4747
import jd.plugins.hoster.FileFactory;
4848

49-
@DecrypterPlugin(revision = "$Revision: 51663 $", interfaceVersion = 2, names = {}, urls = {})
49+
@DecrypterPlugin(revision = "$Revision: 51668 $", interfaceVersion = 2, names = {}, urls = {})
5050
@PluginDependencies(dependencies = { FileFactory.class })
5151
public class FilefactoryComFolder extends PluginForDecrypt {
5252
public FilefactoryComFolder(PluginWrapper wrapper) {
@@ -320,6 +320,7 @@ public ArrayList<DownloadLink> decryptIt(final CryptedLink param, ProgressContro
320320
for (final Map<String, Object> file : files) {
321321
final String file_id = file.get("viewhash").toString();
322322
if (!dupes.add(file_id)) {
323+
/* Skip duplicates */
323324
continue;
324325
}
325326
numberofNewItemsThisPage++;

0 commit comments

Comments
 (0)