Skip to content

Commit a9fab49

Browse files
author
updating-bot
committed
mirroring bot - 2024/10/30
1 parent 9262809 commit a9fab49

File tree

13 files changed

+424
-338
lines changed

13 files changed

+424
-338
lines changed

svn_trunk/src/jd/plugins/MultiHostHostData.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
import java.util.ArrayList;
44
import java.util.List;
55

6-
import org.appwork.storage.Storable;
7-
86
import jd.plugins.MultiHostHost.MultihosterHostStatus;
97

8+
import org.appwork.storage.Storable;
9+
1010
public class MultiHostHostData implements Storable {
1111
private String name;
1212
private List<String> domains;
@@ -158,6 +158,9 @@ public void setUnavailableUntilTimestamp(long unavailableUntilTimestamp) {
158158
}
159159

160160
public static List<MultiHostHostData> createFromMultiHostHostList(final List<MultiHostHost> sourcelist) {
161+
if (sourcelist == null || sourcelist.size() == 0) {
162+
return null;
163+
}
161164
final List<MultiHostHostData> ret = new ArrayList<MultiHostHostData>();
162165
for (final MultiHostHost mhost : sourcelist) {
163166
ret.add(createFromMultiHostHost(mhost));

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
*
4040
* @author raztoki
4141
*/
42-
@DecrypterPlugin(revision = "$Revision: 50037 $", interfaceVersion = 3, names = { "gourl.us" }, urls = { "https?://(?:www\\.)?gourl\\.us/([a-zA-Z0-9_\\-]+)$" })
42+
@DecrypterPlugin(revision = "$Revision: 50040 $", interfaceVersion = 3, names = { "gourl.us" }, urls = { "https?://(?:www\\.)?gourl\\.us/([a-zA-Z0-9_\\-]+)$" })
4343
public class MFS_ShortUrlScript extends PluginForDecrypt {
4444
public MFS_ShortUrlScript(PluginWrapper wrapper) {
4545
super(wrapper);
@@ -48,14 +48,25 @@ public MFS_ShortUrlScript(PluginWrapper wrapper) {
4848
@Override
4949
public Browser createNewBrowserInstance() {
5050
final Browser br = super.createNewBrowserInstance();
51-
br.setFollowRedirects(true);
51+
br.setFollowRedirects(false);
5252
return br;
5353
}
5454

5555
public ArrayList<DownloadLink> decryptIt(final CryptedLink param, final ProgressController progress) throws Exception {
56+
final ArrayList<DownloadLink> ret = new ArrayList<DownloadLink>();
5657
final String parameter = param.getCryptedUrl().replaceFirst("^http://", "https://");
5758
// final String fuid = new Regex(parameter, this.getSupportedLinks()).getMatch(0);
5859
br.getPage(parameter);
60+
final String redirect = br.getRedirectLocation();
61+
if (redirect != null && !this.canHandle(redirect) && !redirect.contains(this.getHost() + "/")) {
62+
logger.info("Found direct redirect to final link: " + redirect);
63+
ret.add(createDownloadlink(redirect));
64+
return ret;
65+
}
66+
br.setFollowRedirects(true);
67+
if (redirect != null) {
68+
br.followRedirect(true);
69+
}
5970
final String errorFromURL = UrlQuery.parse(br.getURL()).get("e");
6071
if (errorFromURL != null) {
6172
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
@@ -82,7 +93,6 @@ public ArrayList<DownloadLink> decryptIt(final CryptedLink param, final Progress
8293
continue;
8394
}
8495
}
85-
final ArrayList<DownloadLink> ret = new ArrayList<DownloadLink>();
8696
final String frame = br.getRegex("<frame [^>]*src=\"(interstitualAdTop\\.php\\?url=\\d+)\"").getMatch(0);
8797
if (frame == null) {
8898
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import java.util.ArrayList;
1919
import java.util.List;
20+
import java.util.Locale;
2021

2122
import javax.script.ScriptEngine;
2223
import javax.script.ScriptEngineManager;
@@ -30,6 +31,7 @@
3031
import jd.controlling.ProgressController;
3132
import jd.http.Browser;
3233
import jd.nutils.encoding.Encoding;
34+
import jd.parser.Regex;
3335
import jd.parser.html.Form;
3436
import jd.parser.html.InputField;
3537
import jd.plugins.CryptedLink;
@@ -39,7 +41,7 @@
3941
import jd.plugins.PluginException;
4042
import jd.plugins.PluginForDecrypt;
4143

42-
@DecrypterPlugin(revision = "$Revision: 48378 $", interfaceVersion = 3, names = {}, urls = {})
44+
@DecrypterPlugin(revision = "$Revision: 50040 $", interfaceVersion = 3, names = {}, urls = {})
4345
public class MylinkLi extends PluginForDecrypt {
4446
public MylinkLi(PluginWrapper wrapper) {
4547
super(wrapper);
@@ -63,14 +65,19 @@ public String[] siteSupportedNames() {
6365
public static String[] getAnnotationUrls() {
6466
final List<String> ret = new ArrayList<String>();
6567
for (final String[] domains : getPluginDomains()) {
66-
ret.add("https?://(?:www\\.)?" + buildHostsPatternPart(domains) + "/[A-Za-z0-9]+");
68+
ret.add("https?://(?:www\\.)?" + buildHostsPatternPart(domains) + "/([A-Za-z0-9]+)");
6769
}
6870
return ret.toArray(new String[0]);
6971
}
7072

7173
public ArrayList<DownloadLink> decryptIt(final CryptedLink param, ProgressController progress) throws Exception {
7274
/** 2023-10-19: The usage of getAndSetSpecialCookie is not needed anymore but it doesn't hurt either so I've left it in. */
7375
// final String contentID = new Regex(param.getCryptedUrl(), "/([A-Za-z0-9]+)$").getMatch(0);
76+
final String contentID = new Regex(param.getCryptedUrl(), this.getSupportedLinks()).getMatch(0);
77+
if (StringUtils.equals(contentID.toLowerCase(Locale.ENGLISH), contentID)) {
78+
/* Lowercase contentID -> Invalid -> E.g. https://mylink.vc/api */
79+
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND, "Invalid contentID");
80+
}
7481
br.setFollowRedirects(true);
7582
br.getHeaders().put("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36");
7683
br.getPage(param.getCryptedUrl());

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

Lines changed: 82 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
import jd.plugins.PluginForHost;
4343
import jd.utils.JDUtilities;
4444

45-
@DecrypterPlugin(revision = "$Revision: 50039 $", interfaceVersion = 3, names = { "nexusmods.com" }, urls = { "https?://(?:www\\.)?nexusmods\\.com/(?!contents)([^/]+)/mods/(\\d+)/?" })
45+
@DecrypterPlugin(revision = "$Revision: 50040 $", interfaceVersion = 3, names = { "nexusmods.com" }, urls = { "https?://(?:www\\.)?nexusmods\\.com/(?!contents)([^/]+)/mods/(\\d+)/?" })
4646
public class NexusmodsComCrawler extends PluginForDecrypt {
4747
public NexusmodsComCrawler(PluginWrapper wrapper) {
4848
super(wrapper);
@@ -65,7 +65,7 @@ public ArrayList<DownloadLink> decryptIt(final CryptedLink param, ProgressContro
6565
if (apikey != null) {
6666
ret = crawlAPI(param, account, game_domain_name, mod_id);
6767
} else {
68-
ret = crawlWebsite(param, account, game_domain_name, mod_id);
68+
ret = crawlWebsite(param, game_domain_name, mod_id);
6969
}
7070
return ret;
7171
}
@@ -133,14 +133,10 @@ private ArrayList<DownloadLink> crawlAPI(final CryptedLink param, final Account
133133
return ret;
134134
}
135135

136-
private ArrayList<DownloadLink> crawlWebsite(final CryptedLink param, final Account account, final String game_domain_name, final String mod_id) throws Exception {
136+
/** Crawls items from website (without account). */
137+
private ArrayList<DownloadLink> crawlWebsite(final CryptedLink param, final String game_domain_name, final String mod_id) throws Exception {
137138
final String parameter = param.getCryptedUrl();
138139
final PluginForHost plugin = JDUtilities.getPluginForHost(this.getHost());
139-
final ArrayList<DownloadLink> ret = new ArrayList<DownloadLink>();
140-
if (account != null) {
141-
/* Login via website */
142-
((jd.plugins.hoster.NexusmodsCom) plugin).loginWebsite(account);
143-
}
144140
br.setFollowRedirects(true);
145141
((jd.plugins.hoster.NexusmodsCom) plugin).getPage(br, parameter);
146142
if (jd.plugins.hoster.NexusmodsCom.isOfflineWebsite(br)) {
@@ -152,6 +148,7 @@ private ArrayList<DownloadLink> crawlWebsite(final CryptedLink param, final Acco
152148
logger.info("Adult content: Enable it in your account settings to be able to download such files via JD: Profile --> Settings --> Content blocking --> Show adult content");
153149
throw new AccountRequiredException("Adult content: Enable it in your account settings to be able to download such files via JD: Profile --> Settings --> Content blocking --> Show adult content");
154150
}
151+
final ArrayList<DownloadLink> ret = new ArrayList<DownloadLink>();
155152
String mod_name = br.getRegex("<meta property=\"og:title\" content=\"([^<>\"]+)\"").getMatch(0);
156153
if (mod_name == null) {
157154
/* This should never happen */
@@ -164,61 +161,91 @@ private ArrayList<DownloadLink> crawlWebsite(final CryptedLink param, final Acco
164161
final Browser br2 = br.cloneBrowser();
165162
((jd.plugins.hoster.NexusmodsCom) plugin).getPage(br2, "/" + game_domain_name + "/mods/" + mod_id + "?tab=files");
166163
final String[] categoryNames = br2.getRegex("<div class=\"file-category-header\">\\s*<h2>([^>]+)</h2>").getColumn(0);
167-
final String[] downloadCategoriesHTMLs = br2.getRegex("<dd[^>]* data-id=\"\\d+\"[^>]*>.*?</div>\\s*</dt>").getColumn(-1);
168-
if (downloadCategoriesHTMLs == null || downloadCategoriesHTMLs.length == 0) {
164+
final String[] downloadCategoriesHTMLs = br2.getRegex("<dd[^>]*data-id=\"\\d+\"[^>]*>.*?</div>\\s*</dt>").getColumn(-1);
165+
String description = br2.getRegex("<meta name=\"description\" content=\"([^\"]+)").getMatch(0);
166+
if (downloadCategoriesHTMLs != null && downloadCategoriesHTMLs.length > 0) {
167+
int index = -1;
168+
for (final String downnloadTypeHTML : downloadCategoriesHTMLs) {
169+
index++;
170+
String category_name = null;
171+
if (categoryNames != null && categoryNames.length == downloadCategoriesHTMLs.length) {
172+
category_name = categoryNames[index];
173+
}
174+
category_name = Encoding.htmlDecode(category_name).trim();
175+
ret.addAll(websiteCrawlFiles(downnloadTypeHTML, category_name, index, mod_id, game_id, game_domain_name, mod_name));
176+
}
177+
} else {
178+
/* Fallback: Don't care about the categories, just find the files */
179+
logger.warning("Failed to find categories");
180+
ret.addAll(websiteCrawlFiles(br2.getRequest().getHtmlCode(), null, 0, mod_id, game_id, game_domain_name, mod_name));
181+
}
182+
if (ret.isEmpty()) {
183+
/*
184+
* Effectively, items are only downloadable via (paid) account so if the crawler fails, let's suppress that and instead ask the
185+
* user to retry again with account -> User can then use the API so then the crawler will work fine.
186+
*/
187+
// throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT, "Failed to find game_id");
188+
throw new AccountRequiredException();
189+
}
190+
if (description != null) {
191+
/* Set description as package comment. */
192+
description = Encoding.htmlDecode(description).trim();
193+
for (final DownloadLink link : ret) {
194+
if (link.getFilePackage() == null) {
195+
continue;
196+
}
197+
link.getFilePackage().setComment(description);
198+
}
199+
}
200+
return ret;
201+
}
202+
203+
private List<DownloadLink> websiteCrawlFiles(final String html_source, final String category_name, final int categoryIndex, final String mod_id, final String game_id, final String game_domain_name, final String mod_name) throws PluginException {
204+
final ArrayList<DownloadLink> ret = new ArrayList<DownloadLink>();
205+
final FilePackage fp = FilePackage.getInstance();
206+
if (category_name != null) {
207+
fp.setName(game_domain_name + " - " + mod_name + " - " + category_name);
208+
} else {
209+
fp.setName(game_domain_name + " - " + mod_name);
210+
}
211+
final String currentPath = game_domain_name + "/" + mod_name + "/" + category_name;
212+
final String[] htmls = new Regex(html_source, "<dt id=\"file-expander-header-\\d+\".*?/use>\\s*</svg>\\s*</div>").getColumn(-1);
213+
if (htmls == null || htmls.length == 0) {
169214
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
170215
}
171-
int index = -1;
172-
for (final String downnloadTypeHTML : downloadCategoriesHTMLs) {
173-
index++;
174-
String category_name = null;
175-
if (categoryNames != null && categoryNames.length == downloadCategoriesHTMLs.length) {
176-
category_name = categoryNames[index];
216+
for (final String html : htmls) {
217+
String file_id = new Regex(html, "\\?id=(\\d+)").getMatch(0);
218+
if (file_id == null) {
219+
file_id = new Regex(html, "data-id=\"(\\d+)\"").getMatch(0);
177220
}
178-
if (category_name == null) {
179-
/* Fallback */
180-
category_name = "Unknown_category_" + (index + 1);
221+
if (file_id == null) {
222+
logger.info("file_id is null");
223+
continue;
181224
}
182-
final FilePackage fp = FilePackage.getInstance();
183-
fp.setName(game_domain_name + " - " + mod_name + " - " + category_name);
184-
category_name = Encoding.htmlDecode(category_name).trim();
185-
final String currentPath = game_domain_name + "/" + mod_name + "/" + category_name;
186-
final String[] htmls = new Regex(downnloadTypeHTML, "<dt id=\"file-expander-header-\\d+\".*?/use>\\s*</svg>\\s*</div>").getColumn(-1);
187-
if (htmls == null || htmls.length == 0) {
188-
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
225+
final String filename = new Regex(html, "data-url=\"([^<>\"]+)\"").getMatch(0);
226+
final DownloadLink link = createDownloadlink(generatePluginPatternMatcher(file_id, game_id));
227+
link.setContentUrl(generateContentURL(game_domain_name, mod_id, file_id));
228+
final String filesizeStr = new Regex(html, ">\\s*File\\s*size\\s*</div>.*?\"stat\"\\s*>\\s*([0-9\\.TKGMB]+)").getMatch(0);
229+
if (filesizeStr != null) {
230+
link.setDownloadSize(SizeFormatter.getSize(filesizeStr));
189231
}
190-
for (final String html : htmls) {
191-
String file_id = new Regex(html, "\\?id=(\\d+)").getMatch(0);
192-
if (file_id == null) {
193-
file_id = new Regex(html, "data-id=\"(\\d+)\"").getMatch(0);
194-
}
195-
if (file_id == null) {
196-
logger.info("file_id is null");
197-
continue;
198-
}
199-
final String filename = new Regex(html, "data-url=\"([^<>\"]+)\"").getMatch(0);
200-
final DownloadLink link = createDownloadlink(generatePluginPatternMatcher(file_id, game_id));
201-
link.setContentUrl(generateContentURL(game_domain_name, mod_id, file_id));
202-
final String filesizeStr = new Regex(html, ">\\s*File\\s*size\\s*</div>.*?\"stat\"\\s*>\\s*([0-9\\.TKGMB]+)").getMatch(0);
203-
if (filesizeStr != null) {
204-
link.setDownloadSize(SizeFormatter.getSize(filesizeStr));
205-
}
206-
if (filename != null) {
207-
link.setName(file_id + "_" + Encoding.htmlOnlyDecode(filename));
208-
} else {
209-
link.setName(file_id);
210-
}
211-
link.setAvailable(true);
212-
link.setMimeHint(CompiledFiletypeFilter.ArchiveExtensions.ZIP);
213-
link.setRelativeDownloadFolderPath(currentPath);
214-
link._setFilePackage(fp);
215-
/* Important! These properties are especially required for all API requests! */
216-
link.setProperty("game_domain_name", game_domain_name);
217-
link.setProperty("mod_id", mod_id);
232+
if (filename != null) {
233+
link.setName(file_id + "_" + Encoding.htmlOnlyDecode(filename));
234+
} else {
235+
link.setName(file_id);
236+
}
237+
link.setAvailable(true);
238+
link.setMimeHint(CompiledFiletypeFilter.ArchiveExtensions.ZIP);
239+
link.setRelativeDownloadFolderPath(currentPath);
240+
link._setFilePackage(fp);
241+
/* Important! These properties are especially required for all API requests! */
242+
link.setProperty("game_domain_name", game_domain_name);
243+
link.setProperty("mod_id", mod_id);
244+
if (category_name != null) {
218245
/* Every category goes into a subfolder */
219246
link.setRelativeDownloadFolderPath(game_domain_name + "/" + category_name);
220-
ret.add(link);
221247
}
248+
ret.add(link);
222249
}
223250
return ret;
224251
}

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,48 +20,48 @@
2020
import jd.PluginWrapper;
2121
import jd.controlling.ProgressController;
2222
import jd.nutils.encoding.Encoding;
23+
import jd.plugins.AccountRequiredException;
2324
import jd.plugins.CryptedLink;
2425
import jd.plugins.DecrypterPlugin;
2526
import jd.plugins.DownloadLink;
2627
import jd.plugins.FilePackage;
28+
import jd.plugins.LinkStatus;
29+
import jd.plugins.PluginException;
2730
import jd.plugins.PluginForDecrypt;
2831

29-
@DecrypterPlugin(revision = "$Revision: 43195 $", interfaceVersion = 2, names = { "nicovideo.jp" }, urls = { "https?://(?:www\\.)?nicovideo\\.jp/(?:user/\\d+/)?mylist/\\d+" })
32+
@DecrypterPlugin(revision = "$Revision: 50041 $", interfaceVersion = 2, names = { "nicovideo.jp" }, urls = { "https?://(?:www\\.)?nicovideo\\.jp/(?:user/\\d+/)?mylist/\\d+" })
3033
public class NicoVideoJpPlaylist extends PluginForDecrypt {
3134
public NicoVideoJpPlaylist(PluginWrapper wrapper) {
3235
super(wrapper);
3336
}
3437

3538
public ArrayList<DownloadLink> decryptIt(CryptedLink param, ProgressController progress) throws Exception {
36-
ArrayList<DownloadLink> decryptedLinks = new ArrayList<DownloadLink>();
39+
ArrayList<DownloadLink> ret = new ArrayList<DownloadLink>();
3740
final String parameter = param.toString();
3841
br.setFollowRedirects(true);
3942
br.getPage(parameter);
40-
if (br.containsHTML(">This My List is set as private")) {
41-
logger.info("Private playlist, cannot decrypt: " + parameter);
42-
return decryptedLinks;
43+
if (br.containsHTML(">\\s*This My List is set as private")) {
44+
throw new AccountRequiredException();
4345
} else if (br.getHttpConnection().getResponseCode() == 404) {
44-
decryptedLinks.add(this.createOfflinelink(parameter));
45-
return decryptedLinks;
46+
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
4647
}
4748
final String fpName = br.getRegex("MylistGroup\\.preloadSingle\\(\\d+, \\{.*?name: \"([^<>\"]*?)\"").getMatch(0);
4849
final String[] videoids = br.getRegex("nicovideo\\.jp..watch..(([a-z]{2})?\\d+)").getColumn(0);
4950
if (videoids == null || videoids.length == 0) {
50-
logger.warning("Decrypter broken for link: " + parameter);
51-
return null;
51+
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
5252
}
5353
for (String singleLink : videoids) {
54-
decryptedLinks.add(createDownloadlink("https://www.nicovideo.jp/watch/" + singleLink));
54+
ret.add(createDownloadlink("https://www.nicovideo.jp/watch/" + singleLink));
5555
}
5656
if (fpName != null) {
5757
final FilePackage fp = FilePackage.getInstance();
58-
fp.setName(Encoding.htmlDecode(fpName.trim()));
59-
fp.addLinks(decryptedLinks);
58+
fp.setName(Encoding.htmlDecode(fpName).trim());
59+
fp.addLinks(ret);
6060
}
61-
return decryptedLinks;
61+
return ret;
6262
}
6363

64-
/* NO OVERRIDE!! */
64+
@Override
6565
public boolean hasCaptcha(CryptedLink link, jd.plugins.Account acc) {
6666
return false;
6767
}

0 commit comments

Comments
 (0)