Skip to content

Commit 1c9372b

Browse files
author
updating-bot
committed
mirroring bot - 2025/07/31
1 parent 3003b58 commit 1c9372b

File tree

14 files changed

+547
-309
lines changed

14 files changed

+547
-309
lines changed

svn_trunk/src/jd/controlling/downloadcontroller/DownloadWatchDog.java

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@
9191
import org.jdownloader.controlling.hosterrule.HosterRuleControllerListener;
9292
import org.jdownloader.gui.IconKey;
9393
import org.jdownloader.gui.translate._GUI;
94+
import org.jdownloader.gui.views.downloads.action.ResetSettings;
95+
import org.jdownloader.gui.views.downloads.action.ResetSettings.DeleteMode;
9496
import org.jdownloader.images.AbstractIcon;
9597
import org.jdownloader.logging.LogController;
9698
import org.jdownloader.plugins.ConditionalSkipReason;
@@ -1996,6 +1998,11 @@ public boolean isHighPriority() {
19961998
}
19971999

19982000
public void reset(final List<DownloadLink> resetLinks) {
2001+
final ResetSettings settings = new ResetSettings();
2002+
reset(resetLinks, settings);
2003+
}
2004+
2005+
public void reset(final List<DownloadLink> resetLinks, final ResetSettings settings) {
19992006
if (resetLinks == null || resetLinks.size() == 0) {
20002007
return;
20012008
}
@@ -2007,10 +2014,10 @@ public void execute(DownloadSession currentSession) {
20072014
currentSession.getForcedLinks().removeAll(resetLinks);
20082015
}
20092016
for (final DownloadLink link : resetLinks) {
2010-
SingleDownloadController con = link.getDownloadLinkController();
2017+
final SingleDownloadController con = link.getDownloadLinkController();
20112018
if (con == null) {
20122019
/* link has no/no alive singleDownloadController, so reset it now */
2013-
resetLink(link, currentSession);
2020+
resetLink(link, currentSession, settings);
20142021
} else {
20152022
/* link has a running singleDownloadController, abort it and reset it after */
20162023
con.getJobsAfterDetach().add(new DownloadWatchDogJob() {
@@ -2021,7 +2028,7 @@ public void interrupt() {
20212028
@Override
20222029
public void execute(DownloadSession currentSession) {
20232030
/* now we can reset the link */
2024-
resetLink(link, currentSession);
2031+
resetLink(link, currentSession, settings);
20252032
}
20262033

20272034
@Override
@@ -2089,7 +2096,7 @@ private List<PluginForHost> getPluginsFromHistory(DownloadLink link, DownloadLin
20892096
return new ArrayList<PluginForHost>(plugins);
20902097
}
20912098

2092-
private void resetLink(DownloadLink link, DownloadSession session) {
2099+
private void resetLink(DownloadLink link, DownloadSession session, ResetSettings settings) {
20932100
if (link.getDownloadLinkController() != null) {
20942101
throw new IllegalStateException("Link is in progress! cannot reset!");
20952102
}
@@ -2100,7 +2107,12 @@ private void resetLink(DownloadLink link, DownloadSession session) {
21002107
container.invalidate();
21012108
}
21022109
}
2103-
deleteFile(link, DeleteOption.NULL);
2110+
final DeleteMode dm = settings.getDeleteMode();
2111+
if (dm == DeleteMode.MOVE_TO_TRASH) {
2112+
deleteFile(link, DeleteOption.RECYCLE);
2113+
} else {
2114+
deleteFile(link, DeleteOption.NULL);
2115+
}
21042116
unSkipLink(link, session);
21052117
final List<PluginForHost> plugins = getPluginsFromHistory(link, history);
21062118
link.reset(plugins);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
import jd.plugins.components.PluginJSonUtils;
5353
import jd.plugins.hoster.DeviantArtCom;
5454

55-
@DecrypterPlugin(revision = "$Revision: 51022 $", interfaceVersion = 3, names = {}, urls = {})
55+
@DecrypterPlugin(revision = "$Revision: 51286 $", interfaceVersion = 3, names = {}, urls = {})
5656
public class DeviantArtComCrawler extends PluginForDecrypt {
5757
public DeviantArtComCrawler(PluginWrapper wrapper) {
5858
super(wrapper);
@@ -334,7 +334,7 @@ private ArrayList<DownloadLink> crawlArt(final CryptedLink param, final Account
334334
/* Pass item to hosterplugin straight away. */
335335
return ret;
336336
}
337-
hosterplugin.requestFileInformation(mainlink, account, false);
337+
hosterplugin.requestFileInformation(mainlink, account);
338338
mainlink.setAvailable(true);
339339
if (!DeviantArtCom.isImage(mainlink)) {
340340
/* Item is not an image item -> No need to look for more image items. */

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

Lines changed: 13 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -18,121 +18,32 @@
1818
import java.util.ArrayList;
1919

2020
import jd.PluginWrapper;
21-
import jd.config.SubConfiguration;
2221
import jd.controlling.ProgressController;
23-
import jd.nutils.encoding.Encoding;
24-
import jd.parser.Regex;
2522
import jd.plugins.CryptedLink;
2623
import jd.plugins.DecrypterPlugin;
2724
import jd.plugins.DownloadLink;
28-
import jd.plugins.FilePackage;
25+
import jd.plugins.LinkStatus;
26+
import jd.plugins.PluginException;
2927
import jd.plugins.PluginForDecrypt;
30-
import jd.utils.JDUtilities;
3128

32-
@DecrypterPlugin(revision = "$Revision: 49222 $", interfaceVersion = 2, names = { "sta.sh" }, urls = { "https?://(?:www\\.)?sta\\.sh/(zip/)?[a-z0-9]+" })
29+
@DecrypterPlugin(revision = "$Revision: 51281 $", interfaceVersion = 2, names = { "sta.sh" }, urls = { "https?://(?:www\\.)?sta\\.sh/(zip/)?[a-z0-9]+" })
3330
public class StaShDecrypter extends PluginForDecrypt {
3431
public StaShDecrypter(PluginWrapper wrapper) {
3532
super(wrapper);
3633
}
3734

38-
private final String INVALIDLINKS = "https?://(www\\.)?sta\\.sh/(muro|writer|login)";
39-
private final String TYPE_ZIP = "https?://(www\\.)?sta\\.sh/zip/[a-z0-9]+";
40-
private static String FORCEHTMLDOWNLOAD = "FORCEHTMLDOWNLOAD";
41-
private static String USE_LINKID_AS_FILENAME = "USE_LINKID_AS_FILENAME";
42-
private static String DOWNLOAD_ZIP = "DOWNLOAD_ZIP";
43-
4435
public ArrayList<DownloadLink> decryptIt(CryptedLink param, ProgressController progress) throws Exception {
45-
ArrayList<DownloadLink> decryptedLinks = new ArrayList<DownloadLink>();
46-
final String parameter = param.toString();
47-
if (parameter.matches(TYPE_ZIP)) {
48-
final DownloadLink link = createDownloadlink(parameter);
49-
link.setProperty("iszip", true);
50-
link.setProperty("directlink", parameter);
51-
decryptedLinks.add(link);
52-
return decryptedLinks;
53-
}
54-
JDUtilities.getPluginForHost("sta.sh");
55-
final SubConfiguration cfg = SubConfiguration.getConfig("sta.sh");
56-
final boolean force_html_dl = cfg.getBooleanProperty(FORCEHTMLDOWNLOAD, false);
57-
final boolean linkid_as_filename = cfg.getBooleanProperty(USE_LINKID_AS_FILENAME, false);
58-
final String main_linkid = new Regex(parameter, "sta\\.sh/(.+)").getMatch(0);
59-
final DownloadLink main = createDownloadlink(parameter);
60-
if (parameter.matches(INVALIDLINKS)) {
61-
decryptedLinks.add(this.createOfflinelink(parameter));
62-
return decryptedLinks;
63-
}
64-
br.getPage(parameter);
65-
if (this.br.getHttpConnection().getResponseCode() == 404) {
66-
decryptedLinks.add(this.createOfflinelink(parameter));
67-
return decryptedLinks;
68-
}
69-
final String linkid_general = new Regex(parameter, "([a-z0-9]+)$").getMatch(0);
70-
String fpName = br.getRegex("name=\"og:title\" content=\"([^<>\"]*?)\"").getMatch(0);
71-
if (fpName == null) {
72-
/* Fallback */
73-
fpName = linkid_general;
74-
}
75-
fpName = Encoding.htmlDecode(fpName.trim());
76-
if (this.br.containsHTML("dev\\-metainfo\\-details\\-client\\-link")) {
77-
/* We should have one or multiple pictures. */
78-
final String[][] picdata = br.getRegex("class=\"thumb\" href=\"(https?://(www\\.)?sta\\.sh/[a-z0-9]+)\" title=\"([^<>\"]*?)\"").getMatches();
79-
if (picdata == null || picdata.length == 0) {
80-
decryptedLinks.add(main);
81-
return decryptedLinks;
82-
}
83-
for (final String singleLinkData[] : picdata) {
84-
final String url = singleLinkData[0];
85-
final String linkid = new Regex(url, "sta\\.sh/(.+)").getMatch(0);
86-
String name = Encoding.htmlDecode(singleLinkData[2]);
87-
final DownloadLink dl = createDownloadlink(url);
88-
/* Obey user setting */
89-
if (linkid_as_filename) {
90-
name = linkid;
91-
}
92-
if (force_html_dl) {
93-
dl.setName(name + ".html");
94-
dl.setAvailable(true);
95-
} else {
96-
dl.setName(name);
97-
dl.setAvailable(true);
98-
}
99-
decryptedLinks.add(dl);
100-
}
101-
} else {
102-
/* These URLs will go back into the decrypter. */
103-
final String[] URLs = this.br.getRegex("href=\"(https?://sta\\.sh/[a-z0-9]{10,})\"").getColumn(0);
104-
for (final String url : URLs) {
105-
if (url.contains(linkid_general)) {
106-
/* Fail-safe to prevent infinite loops! */
107-
continue;
108-
} else {
109-
decryptedLinks.add(this.createDownloadlink(url));
110-
}
111-
}
36+
final ArrayList<DownloadLink> ret = new ArrayList<DownloadLink>();
37+
final String contenturl = param.getCryptedUrl().replaceFirst("(?i)http://", "https://");
38+
br.getPage(contenturl);
39+
if (br.getHttpConnection().getResponseCode() == 404) {
40+
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
11241
}
113-
/* Download zip if it exists and user wants it. */
114-
final String zipLink = br.getRegex("\"(/zip/[a-z0-9]+)\"").getMatch(0);
115-
if (cfg.getBooleanProperty(DOWNLOAD_ZIP, false) && zipLink != null) {
116-
final DownloadLink zip = createDownloadlink(parameter);
117-
zip.setProperty("iszip", true);
118-
zip.setProperty("directlink", zipLink);
119-
String zip_filename;
120-
if (linkid_as_filename) {
121-
zip_filename = main_linkid;
122-
} else {
123-
zip_filename = fpName;
124-
}
125-
if (force_html_dl) {
126-
zip.setName(zip_filename + ".html");
127-
} else {
128-
zip.setName(zip_filename + ".zip");
129-
}
130-
zip.setAvailable(true);
131-
decryptedLinks.add(zip);
42+
final String redirect = br.getRedirectLocation();
43+
if (redirect == null) {
44+
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
13245
}
133-
final FilePackage fp = FilePackage.getInstance();
134-
fp.setName(fpName);
135-
fp.addLinks(decryptedLinks);
136-
return decryptedLinks;
46+
ret.add(this.createDownloadlink(redirect));
47+
return ret;
13748
}
13849
}
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
//jDownloader - Downloadmanager
2+
//Copyright (C) 2009 JD-Team support@jdownloader.org
3+
//
4+
//This program is free software: you can redistribute it and/or modify
5+
//it under the terms of the GNU General Public License as published by
6+
//the Free Software Foundation, either version 3 of the License, or
7+
//(at your option) any later version.
8+
//
9+
//This program is distributed in the hope that it will be useful,
10+
//but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
//GNU General Public License for more details.
13+
//
14+
//You should have received a copy of the GNU General Public License
15+
//along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
package jd.plugins.decrypter;
17+
18+
import java.util.ArrayList;
19+
import java.util.List;
20+
import java.util.Map;
21+
22+
import org.appwork.storage.TypeRef;
23+
24+
import com.formdev.flatlaf.util.StringUtils;
25+
26+
import jd.PluginWrapper;
27+
import jd.controlling.ProgressController;
28+
import jd.http.Browser;
29+
import jd.parser.Regex;
30+
import jd.plugins.Account;
31+
import jd.plugins.CryptedLink;
32+
import jd.plugins.DecrypterPlugin;
33+
import jd.plugins.DownloadLink;
34+
import jd.plugins.FilePackage;
35+
import jd.plugins.LinkStatus;
36+
import jd.plugins.PluginException;
37+
import jd.plugins.PluginForDecrypt;
38+
import jd.plugins.hoster.DirectHTTP;
39+
40+
@DecrypterPlugin(revision = "$Revision: 51287 $", interfaceVersion = 3, names = {}, urls = {})
41+
public class ThreeCatCat extends PluginForDecrypt {
42+
public ThreeCatCat(PluginWrapper wrapper) {
43+
super(wrapper);
44+
}
45+
46+
@Override
47+
public Browser createNewBrowserInstance() {
48+
final Browser br = super.createNewBrowserInstance();
49+
br.setFollowRedirects(true);
50+
return br;
51+
}
52+
53+
public static List<String[]> getPluginDomains() {
54+
final List<String[]> ret = new ArrayList<String[]>();
55+
// each entry in List<String[]> will result in one PluginForDecrypt, Plugin.getHost() will return String[0]->main domain
56+
ret.add(new String[] { "3cat.cat" });
57+
return ret;
58+
}
59+
60+
public static String[] getAnnotationNames() {
61+
return buildAnnotationNames(getPluginDomains());
62+
}
63+
64+
@Override
65+
public String[] siteSupportedNames() {
66+
return buildSupportedNames(getPluginDomains());
67+
}
68+
69+
public static String[] getAnnotationUrls() {
70+
return buildAnnotationUrls(getPluginDomains());
71+
}
72+
73+
public static String[] buildAnnotationUrls(final List<String[]> pluginDomains) {
74+
final List<String> ret = new ArrayList<String>();
75+
for (final String[] domains : pluginDomains) {
76+
ret.add("https?://(?:www\\.)?" + buildHostsPatternPart(domains) + "/.+/(audio|video)/(\\d+)/");
77+
}
78+
return ret.toArray(new String[0]);
79+
}
80+
81+
public ArrayList<DownloadLink> decryptIt(final CryptedLink param, ProgressController progress) throws Exception {
82+
final ArrayList<DownloadLink> ret = new ArrayList<DownloadLink>();
83+
final String contenturl = param.getCryptedUrl();
84+
final Regex urlinfo = new Regex(contenturl, this.getSupportedLinks());
85+
final String mediaType = urlinfo.getMatch(0);
86+
final String mediaID = urlinfo.getMatch(1);
87+
br.getPage("https://dinamics.ccma.cat/pvideo/media.jsp?media=" + mediaType + "&version=0s&idint=" + mediaID);
88+
if (br.getHttpConnection().getResponseCode() == 404) {
89+
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
90+
}
91+
final Map<String, Object> entries = restoreFromString(br.getRequest().getHtmlCode(), TypeRef.MAP);
92+
final Map<String, Object> info = (Map<String, Object>) entries.get("informacio");
93+
final Map<String, Object> images = (Map<String, Object>) entries.get("imatges");
94+
final Map<String, Object> media = (Map<String, Object>) entries.get("media");
95+
final String title = info.get("titol_complet").toString();
96+
final String description = (String) info.get("descripcio");
97+
/* Add thumbnail */
98+
final String thumbnail = images.get("url").toString();
99+
ret.add(this.createDownloadlink(DirectHTTP.createURLForThisPlugin(thumbnail)));
100+
/* Add video qualities */
101+
final List<Map<String, Object>> qualities = (List<Map<String, Object>>) media.get("url");
102+
for (final Map<String, Object> quality : qualities) {
103+
final String url = quality.get("file").toString();
104+
ret.add(this.createDownloadlink(DirectHTTP.createURLForThisPlugin(url)));
105+
}
106+
final FilePackage fp = FilePackage.getInstance();
107+
fp.setName(title);
108+
if (!StringUtils.isEmpty(description)) {
109+
fp.setComment(description);
110+
}
111+
fp.setPackageKey(this.getHost() + ":/" + mediaType + "/" + mediaID);
112+
for (final DownloadLink result : ret) {
113+
result._setFilePackage(fp);
114+
result.setAvailable(true);
115+
}
116+
return ret;
117+
}
118+
119+
@Override
120+
public boolean hasCaptcha(CryptedLink link, Account acc) {
121+
return false;
122+
}
123+
}

0 commit comments

Comments
 (0)