-added free account support for euroshare closes #5948

-added premium support for uploadoz closes #5947
-fixed errorhandling for mngstrm fixes #5949
-fixed gfservices decrypter for redirect links fixes #5950
-fixed gldsl and added stream decrypt support fixes #5951
-shareapic.net: RIP fixes #5953
-stereomood works fine for me, just removed directhttp for decrypted links as some of them are not direct fixes #5954
-added correct password handling for stlth fixes #5955
-fixed filesmap fixes #5956
-mojofile.com: RIP fixes #5591
-fixed uploaded free handling fixes #5952
-improved 1fichier
-fixed localhostr and added support for their 2nd domain
-added support for tsarfile
-added support for freeuploads
-fixed tnypaste and added support for their new domain
-added support for zshare
-added support for github

git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@18285 ebf7c1c2-ba36-0410-9fe8-c592906822b4
This commit is contained in:
psp 2012-08-18 19:34:59 +00:00
parent 2f8a4669d4
commit 9f6e1fa23a
25 changed files with 1732 additions and 361 deletions

View File

@ -877,4 +877,5 @@ jd/plugins/decrypter/QckLnkM.class
jd/plugins/decrypter/SurfMvsOrg.class
jd/plugins/hoster/UploadBoostCom.class
jd/plugins/decrypter/Frdwnldzs.class
jd/plugins/decrypter/TelonaBiz.class
jd/plugins/decrypter/TelonaBiz.class
jd/plugins/decrypter/ShareaPicNet.class

View File

@ -21,7 +21,6 @@ import java.util.ArrayList;
import jd.PluginWrapper;
import jd.controlling.ProgressController;
import jd.nutils.encoding.Encoding;
import jd.parser.html.HTMLParser;
import jd.plugins.CryptedLink;
import jd.plugins.DecrypterPlugin;
import jd.plugins.DownloadLink;
@ -55,12 +54,7 @@ public class FilesMapCom extends PluginForDecrypt {
/** Handling for all others */
String fpName = br.getRegex("property=\"og:title\" content=\"(.*?) \\(\\d+\\.?.{1,6}\\)").getMatch(0);
if (fpName == null) fpName = br.getRegex("<title>(.*?) \\(\\d+\\.?.{1,6}\\)").getMatch(0);
final String pagePiece = br.getRegex("style=\"width:100%;overflow:auto;\" readonly=\"readonly\"(.*?)</textarea></td><td class=\"t1span\"").getMatch(0);
if (pagePiece == null) {
logger.warning("Decrypter broken for link: " + parameter);
return null;
}
String[] links = HTMLParser.getHttpLinks(pagePiece, "");
final String[] links = br.getRegex("\"http://(www\\.)?((es|ar|en|pt|ru|ja|de|fr|tr|pl)?\\.)?filesmap\\.com/redirect/\\?url=(http[^<>\"]*?)\"").getColumn(3);
if (links == null || links.length == 0) {
logger.warning("Decrypter broken for link: " + parameter);
return null;

View File

@ -61,17 +61,27 @@ public class GldSlTo extends PluginForDecrypt {
logger.warning("Decrypter broken for link: " + parameter);
return null;
}
progress.setRange(decryptIDs.length);
final String[] streamIDs = br.getRegex("onClick=\"load_Stream\\(\\'(\\d+)\\'\\)").getColumn(0);
br.getHeaders().put("X-Requested-With", "XMLHttpRequest");
for (String cryptID : decryptIDs) {
br.postPage("http://goldesel.to/ajax/go2dl.php", "Download=" + cryptID);
for (final String cryptID : decryptIDs) {
br.postPage("http://goldesel.to/ajax/lddl.php", "ID=" + cryptID);
String finallink = br.toString();
if (!finallink.startsWith("http") || finallink.length() > 500) {
logger.warning("Decrypter broken for link: " + parameter);
return null;
}
decryptedLinks.add(createDownloadlink(finallink));
progress.increase(1);
}
if (streamIDs != null && streamIDs.length != 0) {
for (final String streamID : streamIDs) {
br.postPage("http://goldesel.to/ajax/streams.php", "Stream=" + streamID);
String finallink = br.getRegex("<a href=\"(http[^<>\"]*?)\"").getMatch(0);
if (finallink == null || finallink.length() > 500) {
logger.warning("Decrypter broken for link: " + parameter);
return null;
}
decryptedLinks.add(createDownloadlink(finallink));
}
}
if (fpName != null) {
FilePackage fp = FilePackage.getInstance();

View File

@ -17,50 +17,45 @@ import jd.plugins.PluginForDecrypt;
@DecrypterPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "mangastream.com" }, urls = { "http://[\\w\\.]*?mangastream\\.com/read/.*?/\\d+" }, flags = { 0 })
public class MngStrm extends PluginForDecrypt {
public MngStrm(PluginWrapper wrapper) {
super(wrapper);
}
public MngStrm(PluginWrapper wrapper) {
super(wrapper);
}
@Override
public ArrayList<DownloadLink> decryptIt(CryptedLink parameter,
ProgressController progress) throws Exception {
ArrayList<DownloadLink> decryptedLinks = new ArrayList<DownloadLink>();
br.setFollowRedirects(false);
String url = parameter.toString();
br.getPage(url + "/1");
if (br.containsHTML("404: Page Not Found<"))
return null;
String title = br.getRegex("<title>(.*?)- Read").getMatch(0);
if (title == null)
return null;
String prefix = new Regex(url, "(/read.+)").getMatch(0);
String pages[] = br.getRegex("\"(" + prefix + "/\\d+)\"").getColumn(0);
if (pages == null)
return null;
ArrayList<String> done = new ArrayList<String>();
for (String page : pages) {
if (done.contains(page))
continue;
done.add(page);
// System.out.println("---- " + page);
}
progress.setRange(done.size());
NumberFormat formatter = new DecimalFormat("00");
for (String page : done) {
DownloadLink link = createDownloadlink("mangastream://" + page);
link.setAvailableStatus(AvailableStatus.TRUE);
link.setFinalFileName(title.trim()
+ " page "
+ formatter.format(Double.parseDouble(new Regex(page,
".+/(\\d+)$").getMatch(0))) + ".png");
decryptedLinks.add(link);
@Override
public ArrayList<DownloadLink> decryptIt(CryptedLink parameter, ProgressController progress) throws Exception {
ArrayList<DownloadLink> decryptedLinks = new ArrayList<DownloadLink>();
br.setFollowRedirects(false);
String url = parameter.toString();
br.getPage(url + "/1");
if (br.containsHTML(">We couldn\\'t find the page you were looking for<")) {
logger.info("Link offline: " + parameter);
return decryptedLinks;
}
String title = br.getRegex("<title>(.*?)- Read").getMatch(0);
if (title == null) return null;
String prefix = new Regex(url, "(/read.+)").getMatch(0);
String pages[] = br.getRegex("\"(" + prefix + "/\\d+)\"").getColumn(0);
if (pages == null) return null;
ArrayList<String> done = new ArrayList<String>();
for (String page : pages) {
if (done.contains(page)) continue;
done.add(page);
// System.out.println("---- " + page);
}
progress.setRange(done.size());
NumberFormat formatter = new DecimalFormat("00");
for (String page : done) {
DownloadLink link = createDownloadlink("mangastream://" + page);
link.setAvailableStatus(AvailableStatus.TRUE);
link.setFinalFileName(title.trim() + " page " + formatter.format(Double.parseDouble(new Regex(page, ".+/(\\d+)$").getMatch(0))) + ".png");
decryptedLinks.add(link);
progress.increase(1);
}
FilePackage fp = FilePackage.getInstance();
fp.setName(title.trim());
fp.addLinks(decryptedLinks);
progress.increase(1);
}
FilePackage fp = FilePackage.getInstance();
fp.setName(title.trim());
fp.addLinks(decryptedLinks);
return decryptedLinks;
}
return decryptedLinks;
}
}

View File

@ -1,103 +0,0 @@
// jDownloader - Downloadmanager
// Copyright (C) 2009 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/>.
package jd.plugins.decrypter;
import java.util.ArrayList;
import jd.PluginWrapper;
import jd.controlling.ProgressController;
import jd.parser.Regex;
import jd.plugins.CryptedLink;
import jd.plugins.DecrypterException;
import jd.plugins.DecrypterPlugin;
import jd.plugins.DownloadLink;
import jd.plugins.FilePackage;
import jd.plugins.PluginForDecrypt;
import jd.utils.locale.JDL;
@DecrypterPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "shareapic.net" }, urls = { "http://(www\\.)?shareapic\\.net/([0-9]+|(Zoom|View)-[0-9]+|content\\.php\\?id=[0-9]+)" }, flags = { 0 })
public class ShareaPicNet extends PluginForDecrypt {
public ShareaPicNet(PluginWrapper wrapper) {
super(wrapper);
}
public ArrayList<DownloadLink> decryptIt(CryptedLink param, ProgressController progress) throws Exception {
ArrayList<DownloadLink> decryptedLinks = new ArrayList<DownloadLink>();
String parameter = param.toString();
// content links are kinda the same as View and can be handled easily so
// i try to use them as much as i can in the plugin
if (parameter.contains("content")) {
String picid = new Regex(parameter, "shareapic\\.net/content\\.php\\?id=(\\d+)").getMatch(0);
parameter = "http://www.shareapic.net/View-" + picid;
}
br.setFollowRedirects(false);
parameter = parameter.replaceAll("(View|Zoom)", "Zoom") + ".html";
br.getPage(parameter);
/* Error handling */
if (br.containsHTML("Access Denied - This is a non-public gallery") || br.containsHTML("error404") || br.containsHTML("Image has been removed from the server")) throw new DecrypterException(JDL.L("plugins.decrypt.errormsg.unavailable", "Perhaps wrong URL or the download is not available anymore."));
/* Single pictures handling */
if (parameter.contains("Zoom") || parameter.contains("View")) {
String finallink = getFinallink();
if (finallink == null) return null;
decryptedLinks.add(createDownloadlink("directhttp://" + finallink));
return decryptedLinks;
}
/* Gallery handling */
String fpName = br.getRegex("<title>(.*?)\\| Shareapic\\.net</title>").getMatch(0);
if (fpName == null) {
fpName = br.getRegex("NAME=\"Abstract\" CONTENT=\"(.*?)\">").getMatch(0);
if (fpName == null) {
fpName = br.getRegex("Description\" CONTENT=\"(.*?)\">").getMatch(0);
if (fpName == null) {
fpName = br.getRegex("font\\-stretch: normal; \\-x-system\\-font: none;\">(.*?)</h1>").getMatch(0);
}
}
}
String pagepiece = br.getRegex("<textarea(.*?)</textarea>").getMatch(0);
if (pagepiece == null) return null;
String[] links = new Regex(pagepiece, "\"(http://(www\\.)?shareapic\\.net/View\\-[0-9]+)").getColumn(0);
if (links == null || links.length == 0) return null;
progress.setRange(links.length);
for (String link : links) {
link = link.replace("View", "Zoom");
br.getPage(link + ".html");
String finallink = getFinallink();
if (finallink == null) return null;
DownloadLink dl = createDownloadlink("directhttp://" + finallink);
dl.setAvailable(true);
decryptedLinks.add(dl);
progress.increase(1);
}
if (fpName != null) {
FilePackage fp = FilePackage.getInstance();
fp.setName(fpName.trim());
fp.addLinks(decryptedLinks);
}
return decryptedLinks;
}
private String getFinallink() {
String finallink = br.getRegex("</noscript>[\t\n\r ]+</td>[\t\n\r ]+<td>[\t\n\r ]+<img src=\"(http://.*?)\"").getMatch(0);
if (finallink == null) finallink = br.getRegex("\"(http://images\\.shareapic\\.net/fullsize\\d+/\\d+.*?)\"").getMatch(0);
return finallink;
}
}

View File

@ -11,7 +11,7 @@ import jd.plugins.DecrypterPlugin;
import jd.plugins.DownloadLink;
import jd.plugins.PluginForDecrypt;
@DecrypterPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "stereomood.com" }, urls = { "http://[\\w\\.]*?stereomood\\.com/(song/\\d+|artist/.+|activity/.+|mood/.+)" }, flags = { 0 })
@DecrypterPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "stereomood.com" }, urls = { "http://(www\\.)?stereomood\\.com/(song/\\d+|artist/.+|activity/.+|mood/.+)" }, flags = { 0 })
public class StereoMoodCom extends PluginForDecrypt {
public StereoMoodCom(PluginWrapper wrapper) {
@ -41,7 +41,6 @@ public class StereoMoodCom extends PluginForDecrypt {
}
index++;
}
progress.setRange(locations.size());
for (String location : locations) {
location = location.replaceAll("\\\\/", "/");
Browser br2 = br.cloneBrowser();
@ -49,8 +48,7 @@ public class StereoMoodCom extends PluginForDecrypt {
br2.getPage(location);
String url = br2.getRedirectLocation();
if (url == null) continue;
decryptedLinks.add(this.createDownloadlink("directhttp://" + url));
progress.increase(1);
decryptedLinks.add(this.createDownloadlink(url));
}
return decryptedLinks;
}

View File

@ -56,10 +56,15 @@ public class Stlth extends PluginForDecrypt {
setBrowserExclusive();
br.setFollowRedirects(true);
br.getPage(parameter);
if (br.containsHTML("besucherpass.png")) {
final Form form = br.getFormBySubmitvalue("Weiter");
form.put("access_pass", Plugin.getUserInput(null, param));
br.submitForm(form);
if (br.containsHTML("besucherpass\\.png")) {
for (int i = 0; i <= 3; i++) {
final Form form = br.getFormBySubmitvalue("Weiter");
form.put("access_pass", Plugin.getUserInput(null, param));
br.submitForm(form);
if (br.containsHTML("besucherpass\\.png")) continue;
break;
}
if (br.containsHTML("besucherpass\\.png")) throw new DecrypterException(DecrypterException.PASSWORD);
}
// Captcha
if (br.containsHTML("Sicherheitsabfrage")) {

View File

@ -37,11 +37,11 @@ public class TgfServicesComFolder extends PluginForDecrypt {
public ArrayList<DownloadLink> decryptIt(CryptedLink param, ProgressController progress) throws Exception {
ArrayList<DownloadLink> decryptedLinks = new ArrayList<DownloadLink>();
String parameter = param.toString();
br.setFollowRedirects(false);
br.setFollowRedirects(true);
br.getPage(parameter);
String fpName = null;
// Decrypt folders
if (parameter.contains("tgf-services.com/downloads/")) {
if (br.getURL().contains("tgf-services.com/downloads/")) {
if (br.getRedirectLocation() != null) {
if (br.getRedirectLocation().contains("/Warning/?err_num=15")) return decryptedLinks;
return null;

View File

@ -29,7 +29,7 @@ import jd.plugins.DecrypterPlugin;
import jd.plugins.DownloadLink;
import jd.plugins.PluginForDecrypt;
@DecrypterPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "tinypaste.com" }, urls = { "http://[\\w\\.]*?tinypaste\\.com/([0-9a-z]+|.*?id=[0-9a-z]+)" }, flags = { 0 })
@DecrypterPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "tny.cz" }, urls = { "http://(www\\.)?(tinypaste\\.com|tny\\.cz)/([0-9a-z]+|.*?id=[0-9a-z]+)" }, flags = { 0 })
public class Tnypst extends PluginForDecrypt {
private DownloadLink dl = null;
@ -42,7 +42,7 @@ public class Tnypst extends PluginForDecrypt {
public ArrayList<DownloadLink> decryptIt(CryptedLink parameter, ProgressController progress) throws Exception {
ArrayList<DownloadLink> decryptedLinks = new ArrayList<DownloadLink>();
br.setFollowRedirects(true);
String link = parameter.toString();
String link = parameter.toString().replace("tinypaste.com/", "tny.cz/");
br.getPage(link);
if (br.containsHTML("(Hello, my name is 404\\!<|The page you requested is no longer here)")) {
logger.info("Link offline: " + parameter);
@ -50,8 +50,8 @@ public class Tnypst extends PluginForDecrypt {
}
if (br.containsHTML("(Enter the correct password|has been password protected)")) {
for (int i = 0; i <= 3; i++) {
String id = new Regex(link, "tinypaste\\.com/.*?id=([0-9a-z]+)").getMatch(0);
if (id == null) id = new Regex(link, "tinypaste\\.com/([0-9a-z]+)").getMatch(0);
String id = new Regex(link, "tny\\.cz/.*?id=([0-9a-z]+)").getMatch(0);
if (id == null) id = new Regex(link, "tny\\.cz/([0-9a-z]+)").getMatch(0);
Form pwform = br.getForm(0);
if (pwform == null || id == null) return null;
String pw = getUserInput(null, parameter);
@ -62,8 +62,8 @@ public class Tnypst extends PluginForDecrypt {
}
if (br.containsHTML("(Enter the correct password|has been password protected)")) throw new DecrypterException(DecrypterException.PASSWORD);
}
String pasteFrame = br.getRegex("frameborder=\\'0\\' id=\\'pasteFrame\\' src=\"(http://tinypaste\\.com/.*?)\"").getMatch(0);
if (pasteFrame == null) pasteFrame = br.getRegex("\"(http://tinypaste\\.com/[a-z0-9]+/fullscreen\\.php\\?hash=[a-z0-9]+\\&linenum=(false|true))\"").getMatch(0);
String pasteFrame = br.getRegex("frameborder=\\'0\\' id=\\'pasteFrame\\' src=\"(http://tny\\.cz/.*?)\"").getMatch(0);
if (pasteFrame == null) pasteFrame = br.getRegex("\"(http://tny\\.cz/[a-z0-9]+/fullscreen\\.php\\?hash=[a-z0-9]+\\&linenum=(false|true))\"").getMatch(0);
if (pasteFrame == null) {
logger.warning("Decrypter broken for link: " + parameter);
return null;
@ -74,7 +74,7 @@ public class Tnypst extends PluginForDecrypt {
ArrayList<String> pws = HTMLParser.findPasswords(br.toString());
for (String element : links) {
/* prevent recursion */
if (element.contains("tinypaste.com")) continue;
if (element.contains("tny.cz")) continue;
decryptedLinks.add(dl = createDownloadlink(element));
if (pws != null && pws.size() > 0) dl.setSourcePluginPasswordList(pws);
}

View File

@ -29,7 +29,7 @@ import jd.plugins.PluginForDecrypt;
import jd.utils.locale.JDL;
//When adding new domains here also add them to the hosterplugin (TurboBitNet)
@DecrypterPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "turbobit.net" }, urls = { "http://(www\\.)?(maxisoc\\.ru|turo\\-bit\\.net|depositfiles\\.com\\.ua|dlbit\\.net|sharephile\\.com|filesmail\\.ru|hotshare\\.biz|bluetooths\\.pp\\.ru|speed-file\\.ru|sharezoid\\.com|turbobit\\.pl|dz-files\\.ru|file\\.alexforum\\.ws|file\\.grad\\.by|file\\.krut-warez\\.ru|filebit\\.org|files\\.best-trainings\\.org\\.ua|files\\.wzor\\.ws|gdefile\\.ru|letitshare\\.ru|mnogofiles\\.com|share\\.uz|sibit\\.net|turbo-bit\\.ru|turbobit\\.net|upload\\.mskvn\\.by|vipbit\\.ru|files\\.prime-speed\\.ru|filestore\\.net\\.ru|turbobit\\.ru|upload\\.dwmedia\\.ru|upload\\.uz|xrfiles\\.ru|unextfiles\\.com|e-flash\\.com\\.ua|turbobax\\.net|zharabit\\.net|download\\.uzhgorod\\.name|trium-club\\.ru|alfa-files\\.com|turbabit\\.net|filedeluxe\\.com|turbobit\\.name|files\\.uz\\-translations\\.uz|turboblt\\.ru|fo\\.letitbook\\.ru|freefo\\.ru|bayrakweb\\.com)/download/folder/\\d+" }, flags = { 0 })
@DecrypterPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "turbobit.net" }, urls = { "http://(www\\.)?(maxisoc\\.ru|turo\\-bit\\.net|depositfiles\\.com\\.ua|dlbit\\.net|sharephile\\.com|filesmail\\.ru|hotshare\\.biz|bluetooths\\.pp\\.ru|speed-file\\.ru|sharezoid\\.com|turbobit\\.pl|dz-files\\.ru|file\\.alexforum\\.ws|file\\.grad\\.by|file\\.krut-warez\\.ru|filebit\\.org|files\\.best-trainings\\.org\\.ua|files\\.wzor\\.ws|gdefile\\.ru|letitshare\\.ru|mnogofiles\\.com|share\\.uz|sibit\\.net|turbo-bit\\.ru|turbobit\\.net|upload\\.mskvn\\.by|vipbit\\.ru|files\\.prime-speed\\.ru|filestore\\.net\\.ru|turbobit\\.ru|upload\\.dwmedia\\.ru|upload\\.uz|xrfiles\\.ru|unextfiles\\.com|e-flash\\.com\\.ua|turbobax\\.net|zharabit\\.net|download\\.uzhgorod\\.name|trium-club\\.ru|alfa-files\\.com|turbabit\\.net|filedeluxe\\.com|turbobit\\.name|files\\.uz\\-translations\\.uz|turboblt\\.ru|fo\\.letitbook\\.ru|freefo\\.ru|bayrakweb\\.com|savebit\\.net)/download/folder/\\d+" }, flags = { 0 })
public class TurboBitNetFolder extends PluginForDecrypt {
public TurboBitNetFolder(PluginWrapper wrapper) {

View File

@ -0,0 +1,195 @@
//jDownloader - Downloadmanager
//Copyright (C) 2009 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/>.
package jd.plugins.decrypter;
import java.util.ArrayList;
import java.util.Random;
import jd.PluginWrapper;
import jd.controlling.ProgressController;
import jd.nutils.encoding.Encoding;
import jd.parser.Regex;
import jd.plugins.CryptedLink;
import jd.plugins.DecrypterPlugin;
import jd.plugins.DownloadLink;
import jd.plugins.PluginForDecrypt;
//EmbedDecrypter 0.1.1
@DecrypterPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "video-one.com" }, urls = { "http://(www\\.)?video\\-one\\.com/video/[a-z0-9]+\\.html" }, flags = { 0 })
public class VideoOneCom extends PluginForDecrypt {
public VideoOneCom(PluginWrapper wrapper) {
super(wrapper);
}
public ArrayList<DownloadLink> decryptIt(CryptedLink param, ProgressController progress) throws Exception {
ArrayList<DownloadLink> decryptedLinks = new ArrayList<DownloadLink>();
String parameter = param.toString();
br.getPage(parameter);
String filename = new Regex(parameter, "http://(www\\.)?video\\-one\\.com/video/([a-z0-9]+)\\.html").getMatch(1);
br.getPage("http://m.8-d.com/prein");
final Regex th = br.getRegex("\\&t=(\\d+)\\&h=([a-z0-9]+)\"");
String t = th.getMatch(0);
String h = th.getMatch(1);
if (t == null || h == null) {
logger.warning("Decrypter broken for link: " + parameter);
return null;
}
br.getPage("http://m.8-d.com/in?r=&p=http://video-one.com/video/" + filename + ".html&t=" + t + "&h=" + h);
t = br.getRegex("var t=\\'(\\d+)\\';").getMatch(0);
h = br.getRegex("var h=\\'([a-z0-9]+)\\';").getMatch(0);
if (t == null || h == null) {
logger.warning("Decrypter broken for link: " + parameter);
return null;
}
br.getPage("http://video-one.com/iframe/" + filename + "?t=" + t + "&h=" + h + "&p=video-one.com/eval/seq/2");
String externID = br.getRegex("xvideos\\.com/embedframe/(\\d+)\"").getMatch(0);
if (externID != null) {
decryptedLinks.add(createDownloadlink("http://www.xvideos.com/video" + externID));
return decryptedLinks;
}
externID = br.getRegex("madthumbs\\.com%2Fvideos%2Fembed_config%3Fid%3D(\\d+)").getMatch(0);
if (externID != null) {
DownloadLink dl = createDownloadlink("http://www.madthumbs.com/videos/amateur/" + new Random().nextInt(100000) + "/" + externID);
decryptedLinks.add(dl);
return decryptedLinks;
}
externID = br.getRegex("(\"|\\')(http://(www\\.)?tube8\\.com/embed/[^<>\"/]*?/[^<>\"/]*?/\\d+/?)(\"|\\')").getMatch(1);
if (externID != null) {
decryptedLinks.add(createDownloadlink(externID.replace("tube8.com/embed/", "tube8.com/")));
return decryptedLinks;
}
externID = br.getRegex("redtube\\.com/player/\"><param name=\"FlashVars\" value=\"id=(\\d+)\\&").getMatch(0);
if (externID == null) externID = br.getRegex("embed\\.redtube\\.com/player/\\?id=(\\d+)\\&").getMatch(0);
if (externID != null) {
DownloadLink dl = createDownloadlink("http://www.redtube.com/" + externID);
decryptedLinks.add(dl);
return decryptedLinks;
}
externID = br.getRegex("(http://(www\\.)?drtuber\\.com/player/config_embed3\\.php\\?vkey=[a-z0-9]+)").getMatch(0);
if (externID != null) {
decryptedLinks.add(createDownloadlink(externID));
return decryptedLinks;
}
externID = br.getRegex("xhamster\\.com/xembed\\.php\\?video=(\\d+)\"").getMatch(0);
if (externID != null) {
decryptedLinks.add(createDownloadlink("http://xhamster.com/movies/" + externID + "/" + System.currentTimeMillis() + ".html"));
return decryptedLinks;
}
externID = br.getRegex("emb\\.slutload\\.com/([A-Za-z0-9]+)\"").getMatch(0);
if (externID != null) {
decryptedLinks.add(createDownloadlink("http://slutload.com/watch/" + externID));
return decryptedLinks;
}
externID = br.getRegex("pornerbros\\.com/content/(\\d+)\\.xml").getMatch(0);
if (externID != null) {
decryptedLinks.add(createDownloadlink("http://www.pornerbros.com/" + externID + "/" + System.currentTimeMillis() + ".html"));
return decryptedLinks;
}
externID = br.getRegex("hardsextube\\.com/embed/(\\d+)/\"").getMatch(0);
if (externID != null) {
decryptedLinks.add(createDownloadlink("http://www.hardsextube.com/video/" + externID + "/"));
return decryptedLinks;
}
externID = br.getRegex("embed\\.pornrabbit\\.com/player\\.swf\\?movie_id=(\\d+)\"").getMatch(0);
if (externID == null) externID = br.getRegex("pornrabbit\\.com/embed/(\\d+)").getMatch(0);
if (externID != null) {
decryptedLinks.add(createDownloadlink("http://pornrabbit.com/video/" + externID + "/"));
return decryptedLinks;
}
externID = br.getRegex("player\\.tnaflix\\.com/video/(\\d+)\"").getMatch(0);
if (externID != null) {
decryptedLinks.add(createDownloadlink("http://www.tnaflix.com/cum-videos/" + System.currentTimeMillis() + "/video" + externID));
return decryptedLinks;
}
externID = br.getRegex("metacafe\\.com/fplayer/(\\d+)/").getMatch(0);
if (externID != null) {
decryptedLinks.add(createDownloadlink("http://www.metacafe.com/watch/" + externID + "/" + System.currentTimeMillis()));
return decryptedLinks;
}
externID = br.getRegex("pornhub\\.com/embed/(\\d+)").getMatch(0);
if (externID == null) externID = br.getRegex("pornhub\\.com/view_video\\.php\\?viewkey=(\\d+)").getMatch(0);
if (externID != null) {
DownloadLink dl = createDownloadlink("http://www.pornhub.com/view_video.php?viewkey=" + externID);
decryptedLinks.add(dl);
return decryptedLinks;
}
// pornhub handling number 2
externID = br.getRegex("name=\"FlashVars\" value=\"options=(http://(www\\.)?pornhub\\.com/embed_player(_v\\d+)?\\.php\\?id=\\d+)\"").getMatch(0);
if (externID != null) {
br.getPage(externID);
if (br.containsHTML("<link_url>N/A</link_url>")) {
logger.info("Link offline: " + parameter);
return decryptedLinks;
}
externID = br.getRegex("<link_url>(http://[^<>\"]*?)</link_url>").getMatch(0);
if (externID == null) {
logger.warning("Decrypter broken for link: " + parameter);
return null;
}
decryptedLinks.add(createDownloadlink(externID));
return decryptedLinks;
}
externID = br.getRegex("(\\'|\")(http://(www\\.)?myxvids\\.com/embed_code/\\d+/\\d+/myxvids_embed\\.js)(\\'|\")").getMatch(1);
if (externID != null) {
br.getPage(externID);
externID = br.getRegex("var urlAddress = \"(http://[^<>\"]*?)\";").getMatch(0);
if (externID != null) {
decryptedLinks.add(createDownloadlink(externID));
return decryptedLinks;
}
}
externID = br.getRegex("player\\.empflix\\.com/video/(\\d+)\"").getMatch(0);
if (externID != null) {
decryptedLinks.add(createDownloadlink("http://www.empflix.com/videos/" + System.currentTimeMillis() + "-" + externID + ".html"));
return decryptedLinks;
}
externID = br.getRegex("<iframe src=\"http://(www\\.)?yobt\\.tv/embed/(\\d+)\\.html\"").getMatch(1);
if (externID != null) {
decryptedLinks.add(createDownloadlink("http://www.yobt.tv/content/" + externID + "/" + System.currentTimeMillis() + ".html"));
return decryptedLinks;
}
// filename needed for all IDs below here
if (filename == null) {
logger.warning("Decrypter broken for link: " + parameter);
return null;
}
filename = Encoding.htmlDecode(filename.trim());
externID = br.getRegex("shufuni\\.com/Flash/.*?flashvars=\"VideoCode=(.*?)\"").getMatch(0);
if (externID != null) {
DownloadLink dl = createDownloadlink("http://www.shufuni.com/handlers/FLVStreamingv2.ashx?videoCode=" + externID);
dl.setFinalFileName(Encoding.htmlDecode(filename.trim()));
decryptedLinks.add(dl);
return decryptedLinks;
}
externID = br.getRegex("src=\"http://videos\\.allelitepass\\.com/txc/([^<>\"/]*?)\\.swf\"").getMatch(0);
if (externID != null) {
br.getPage("http://videos.allelitepass.com/txc/player.php?video=" + Encoding.htmlDecode(externID));
externID = br.getRegex("<file>(http://[^<>\"]*?)</file>").getMatch(0);
if (externID != null) {
final DownloadLink dl = createDownloadlink("directhttp://" + externID);
dl.setFinalFileName(filename + ".flv");
decryptedLinks.add(dl);
return decryptedLinks;
}
}
logger.warning("Decrypter broken for link: " + parameter);
return null;
}
}

View File

@ -28,7 +28,7 @@ import jd.plugins.DownloadLink;
import jd.plugins.FilePackage;
import jd.plugins.PluginForDecrypt;
@DecrypterPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "XFileShareProFolder" }, urls = { "http://(www\\.)?((divload\\.org|divupload\\.org)|rapidfileshare\\.net|rd\\-fs\\.com|hostinoo\\.com|fireget\\.com|filedefend\\.com|creafile\\.net|247upload\\.com|dippic\\.com|4savefile\\.com|4bytez\\.com|fileprohost\\.com|bitupload\\.com|galaxy\\-file\\.com|aa\\.vg|fileza\\.net|allbox4\\.com|netuploaded\\.com|ishareupload\\.com|project\\-free\\-upload\\.com|upfile\\.biz|syfiles\\.com|gorillavid\\.in|(ezzfile\\.com|file4up\\.com)|foxishare\\.com|your\\-filehosting\\.com|mp3the\\.net|mummyfile\\.com|kongsifile\\.com|filerose\\.com|shareupload\\.com|gbitfiles\\.com|animegoon\\.com|ddl\\.mn|spaceha\\.com|mooshare\\.biz|flashdrive\\.it|gptfile\\.com|zooupload\\.com|filedwon\\.com|filemade\\.com|xenubox\\.com|backupload\\.net|mixshared\\.com|longfiles\\.com|helluploads\\.com|novafile\\.com|vidpe\\.com|filetechnology\\.com|saryshare\\.com|orangefiles\\.com|filecosy\\.com|squillion\\.com|ufile\\.eu|fileor\\.com|filesega\\.com|qtyfiles\\.com|pizzaupload\\.com|filesbb\\.com|free\\-uploading\\.com|megaul\\.com|megaup1oad\\.net|fireuploads\\.net|filestay\\.com|(elitedisk\\.com|igetfile\\.com|pandamemo\\.com)|free\\-uploading\\.com|uload\\.to|cosmobox\\.org|filereactor\\.com|uploadjet\\.net|fileove\\.com|rapidapk\\.com|filehost\\.ws|hyshare\\.com|(squillion\\.com|uppit\\.com)|vidhuge\\.com|nosupload\\.com|idup\\.in|potload\\.com|coraldrive\\.net|uploadbaz\\.com|simpleshare\\.org|ryushare\\.com|lafiles\\.com|clicktoview\\.org|lumfiles\\.com|bloonga\\.com|gigfiles\\.net|shareonline\\.org|downloadani\\.me|allmyvideos\\.net|movdivx\\.com|filenuke\\.com|((flashstream\\.in|sharefiles4u\\.com)|xvidstage\\.com|xvidstream\\.net)|ginbig\\.com|vidbux\\.com|divxbase\\.com|queenshare\\.com|filesabc\\.com|((fiberupload|bulletupload)\\.com)|edoc\\.com|easybytez\\.com|filesabc\\.com|mojofile\\.com|fileduct\\.com)/(users/[a-z0-9_]+/.+|folder/\\d+/.+)" }, flags = { 0 })
@DecrypterPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "XFileShareProFolder" }, urls = { "http://(www\\.)?((divload\\.org|divupload\\.org)|rapidfileshare\\.net|rd\\-fs\\.com|hostinoo\\.com|fireget\\.com|filedefend\\.com|creafile\\.net|247upload\\.com|dippic\\.com|4savefile\\.com|4bytez\\.com|fileprohost\\.com|bitupload\\.com|galaxy\\-file\\.com|aa\\.vg|fileza\\.net|allbox4\\.com|netuploaded\\.com|ishareupload\\.com|project\\-free\\-upload\\.com|upfile\\.biz|syfiles\\.com|gorillavid\\.in|(ezzfile\\.com|file4up\\.com)|foxishare\\.com|your\\-filehosting\\.com|mp3the\\.net|mummyfile\\.com|kongsifile\\.com|filerose\\.com|shareupload\\.com|gbitfiles\\.com|animegoon\\.com|ddl\\.mn|spaceha\\.com|mooshare\\.biz|flashdrive\\.it|gptfile\\.com|zooupload\\.com|filedwon\\.com|filemade\\.com|xenubox\\.com|backupload\\.net|mixshared\\.com|longfiles\\.com|helluploads\\.com|novafile\\.com|vidpe\\.com|filetechnology\\.com|saryshare\\.com|orangefiles\\.com|filecosy\\.com|squillion\\.com|ufile\\.eu|fileor\\.com|filesega\\.com|qtyfiles\\.com|pizzaupload\\.com|filesbb\\.com|free\\-uploading\\.com|megaul\\.com|megaup1oad\\.net|fireuploads\\.net|filestay\\.com|(elitedisk\\.com|igetfile\\.com|pandamemo\\.com)|free\\-uploading\\.com|uload\\.to|cosmobox\\.org|filereactor\\.com|uploadjet\\.net|fileove\\.com|rapidapk\\.com|filehost\\.ws|hyshare\\.com|(squillion\\.com|uppit\\.com)|vidhuge\\.com|nosupload\\.com|idup\\.in|potload\\.com|coraldrive\\.net|uploadbaz\\.com|simpleshare\\.org|ryushare\\.com|lafiles\\.com|clicktoview\\.org|lumfiles\\.com|bloonga\\.com|gigfiles\\.net|shareonline\\.org|downloadani\\.me|allmyvideos\\.net|movdivx\\.com|filenuke\\.com|((flashstream\\.in|sharefiles4u\\.com)|xvidstage\\.com|xvidstream\\.net)|ginbig\\.com|vidbux\\.com|divxbase\\.com|queenshare\\.com|filesabc\\.com|((fiberupload|bulletupload)\\.com)|edoc\\.com|easybytez\\.com|filesabc\\.com|fileduct\\.com)/(users/[a-z0-9_]+/.+|folder/\\d+/.+)" }, flags = { 0 })
public class XFileShareProFolder extends PluginForDecrypt {
// DEV NOTES

View File

@ -18,6 +18,7 @@ package jd.plugins.hoster;
import java.io.IOException;
import java.util.ArrayList;
import java.util.concurrent.atomic.AtomicInteger;
import jd.PluginWrapper;
import jd.nutils.encoding.Encoding;
@ -37,7 +38,9 @@ import org.appwork.utils.formatter.TimeFormatter;
@HostPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "euroshare.eu" }, urls = { "http://(www\\.)?euroshare\\.(eu|sk)/file/\\d+/[^<>\"/]+" }, flags = { 2 })
public class EuroShareEu extends PluginForHost {
private static final String TOOMANYSIMULTANDOWNLOADS = "<p>Naraz je z jednej IP adresy možné sťahovať iba jeden súbor";
private static final String TOOMANYSIMULTANDOWNLOADS = "<p>Naraz je z jednej IP adresy možné sťahovať iba jeden súbor";
private static final Object LOCK = new Object();
private static AtomicInteger maxPrem = new AtomicInteger(1);
public EuroShareEu(PluginWrapper wrapper) {
super(wrapper);
@ -111,8 +114,10 @@ public class EuroShareEu extends PluginForHost {
}
@Override
public AccountInfo fetchAccountInfo(Account account) throws Exception {
public AccountInfo fetchAccountInfo(final Account account) throws Exception {
AccountInfo ai = new AccountInfo();
/* reset maxPrem workaround on every fetchaccount info */
maxPrem.set(1);
try {
login(account);
} catch (PluginException e) {
@ -121,16 +126,28 @@ public class EuroShareEu extends PluginForHost {
}
ai.setUnlimitedTraffic();
account.setValid(true);
String expire = br.getRegex(">Prémium účet máte aktívny do: ([^<>\"]*?)</a>").getMatch(0);
if (expire == null) {
ai.setExpired(true);
account.setValid(false);
return ai;
ai.setStatus("Free (registered) User");
try {
maxPrem.set(-1);
account.setMaxSimultanDownloads(maxPrem.get());
account.setConcurrentUsePossible(false);
} catch (final Throwable e) {
}
account.setProperty("FREE", true);
} else {
account.setValid(true);
ai.setValidUntil(TimeFormatter.getMilliSeconds(expire, "dd.MM.yyyy", null) + (1000l * 60 * 60 * 24));
ai.setStatus("Premium User");
try {
maxPrem.set(-1);
account.setMaxSimultanDownloads(maxPrem.get());
account.setConcurrentUsePossible(true);
} catch (final Throwable e) {
}
account.setProperty("FREE", false);
}
ai.setStatus("Premium User");
return ai;
}
@ -146,20 +163,27 @@ public class EuroShareEu extends PluginForHost {
@Override
public int getMaxSimultanPremiumDownloadNum() {
return -1;
return maxPrem.get();
}
@Override
public void handleFree(DownloadLink downloadLink) throws Exception, PluginException {
public void handleFree(final DownloadLink downloadLink) throws Exception, PluginException {
requestFileInformation(downloadLink);
doFree(downloadLink);
}
public void doFree(final DownloadLink downloadLink) throws Exception, PluginException {
br.getPage(downloadLink.getDownloadURL());
if (br.containsHTML(TOOMANYSIMULTANDOWNLOADS)) throw new PluginException(LinkStatus.ERROR_IP_BLOCKED, "Too many simultan downloads", 10 * 60 * 1000l);
if (br.containsHTML("(>Všetky sloty pre Free užívateľov sú obsadené|Skúste prosím neskôr\\.<br)")) throw new PluginException(LinkStatus.ERROR_HOSTER_TEMPORARILY_UNAVAILABLE, JDL.L("plugins.hoster.euroshareeu.nofreeslots", "No free slots available"), 5 * 60 * 1000l);
br.setFollowRedirects(false);
String dllink = br.getRegex("iba jeden súbor\\.<a href=\"(http://.*?)\"").getMatch(0);
if (dllink == null) dllink = br.getRegex("\"(http://euroshare\\.eu/download/\\d+/.*?/\\d+/.*?)\"").getMatch(0);
if (dllink == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
dl = jd.plugins.BrowserAdapter.openDownload(br, downloadLink, dllink, false, 1);
// br.setFollowRedirects(false);
// String dllink =
// br.getRegex("iba jeden súbor\\.<a href=\"(http://.*?)\"").getMatch(0);
// if (dllink == null) dllink =
// br.getRegex("\"(http://euroshare\\.eu/download/\\d+/.*?/\\d+/.*?)\"").getMatch(0);
// if (dllink == null) throw new
// PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
dl = jd.plugins.BrowserAdapter.openDownload(br, downloadLink, downloadLink.getDownloadURL() + "/download/", false, 1);
if (dl.getConnection().getContentType().contains("html")) {
br.followConnection();
if (br.containsHTML(TOOMANYSIMULTANDOWNLOADS)) throw new PluginException(LinkStatus.ERROR_IP_BLOCKED, "Too many simultan downloads", 10 * 60 * 1000l);
@ -169,16 +193,20 @@ public class EuroShareEu extends PluginForHost {
}
@Override
public void handlePremium(DownloadLink link, Account account) throws Exception {
public void handlePremium(final DownloadLink link, final Account account) throws Exception {
requestFileInformation(link);
login(account);
dl = jd.plugins.BrowserAdapter.openDownload(br, link, link.getDownloadURL() + "/download/", true, 0);
if (dl.getConnection().getContentType().contains("html")) {
logger.warning("The final dllink seems not to be a file!");
br.followConnection();
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
if (account.getBooleanProperty("FREE")) {
doFree(link);
} else {
dl = jd.plugins.BrowserAdapter.openDownload(br, link, link.getDownloadURL() + "/download/", true, 0);
if (dl.getConnection().getContentType().contains("html")) {
logger.warning("The final dllink seems not to be a file!");
br.followConnection();
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
}
dl.startDownload();
}
dl.startDownload();
}
private void login(Account account) throws Exception {

View File

@ -117,7 +117,7 @@ public class File4GoCom extends PluginForHost {
br.setFollowRedirects(true);
// br.getPage("");
br.postPage("http://www.file4go.com/login.html", "acao=logar&login=" + Encoding.urlEncode(account.getUser()) + "&senha=" + Encoding.urlEncode(account.getPass()));
if (br.getCookie(MAINPAGE, "PREMIUM") == null) throw new PluginException(LinkStatus.ERROR_PREMIUM, PluginException.VALUE_ID_PREMIUM_DISABLE);
if (br.getCookie(MAINPAGE, "FILE4GO") == null) throw new PluginException(LinkStatus.ERROR_PREMIUM, PluginException.VALUE_ID_PREMIUM_DISABLE);
// Save cookies
final HashMap<String, String> cookies = new HashMap<String, String>();
final Cookies add = this.br.getCookies(MAINPAGE);

View File

@ -0,0 +1,118 @@
//jDownloader - Downloadmanager
//Copyright (C) 2010 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/>.
package jd.plugins.hoster;
import jd.PluginWrapper;
import jd.http.Browser;
import jd.plugins.DownloadLink;
import jd.plugins.DownloadLink.AvailableStatus;
import jd.plugins.HostPlugin;
import jd.plugins.LinkStatus;
import jd.plugins.PluginException;
import jd.plugins.PluginForHost;
import org.appwork.utils.formatter.SizeFormatter;
@HostPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "freeuploads.fr" }, urls = { "http://(www\\.)?freeuploads\\.fr/\\?d=[A-Z0-9]+" }, flags = { 0 })
public class FreeUploadsFr extends PluginForHost {
public FreeUploadsFr(PluginWrapper wrapper) {
super(wrapper);
// this.enablePremium(COOKIE_HOST + "/register.php?g=3");
}
@Override
public String getAGBLink() {
return COOKIE_HOST + "/rules.php";
}
private static final String COOKIE_HOST = "http://freeuploads.fr";
private static final int DEFAULTWAITTIME = 0;
// MhfScriptBasic 1.7
// FREE limits: 1 * 1
// PREMIUM limits: Chunks * Maxdl
// Captchatype: none
// Other notes:
public void correctDownloadLink(DownloadLink link) {
link.setUrlDownload(link.getDownloadURL().replaceAll("(en|ru|fr|es|de)/file/", "file/"));
}
@Override
public AvailableStatus requestFileInformation(DownloadLink parameter) throws Exception {
this.setBrowserExclusive();
br.setFollowRedirects(true);
br.setCookie(COOKIE_HOST, "mfh_mylang", "en");
br.setCookie(COOKIE_HOST, "yab_mylang", "en");
br.getPage(parameter.getDownloadURL());
if (br.getURL().contains("&code=DL_FileNotFound") || br.containsHTML("(Your requested file is not found|No file found)")) throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
String filename = br.getRegex("id=\"download\">[\t\n\r ]+<h2>([^<>\"]*?)</h2>").getMatch(0);
String filesize = br.getRegex("<b>Size:</b>([^<>\"]*?)<br/>").getMatch(0);
if (filename == null || filename.matches("")) throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
parameter.setFinalFileName(filename.trim());
if (filesize != null) parameter.setDownloadSize(SizeFormatter.getSize(filesize));
return AvailableStatus.TRUE;
}
@Override
public void handleFree(DownloadLink downloadLink) throws Exception {
this.setBrowserExclusive();
requestFileInformation(downloadLink);
if (br.containsHTML("value=\"Free Users\""))
br.postPage(downloadLink.getDownloadURL(), "Free=Free+Users");
else if (br.getFormbyProperty("name", "entryform1") != null) br.submitForm(br.getFormbyProperty("name", "entryform1"));
final String reconnectWaittime = br.getRegex("You must wait (\\d+) mins\\. for next download.").getMatch(0);
if (reconnectWaittime != null) throw new PluginException(LinkStatus.ERROR_IP_BLOCKED, Integer.parseInt(reconnectWaittime) * 60 * 1001l);
final String finalLink = findLink(br);
if (finalLink == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
int wait = DEFAULTWAITTIME;
final String waittime = br.getRegex("countdown\\((\\d+)\\);").getMatch(0);
if (waittime != null) wait = Integer.parseInt(waittime);
sleep(wait * 1001l, downloadLink);
// Resume and chunks disabled because couldn't test
dl = jd.plugins.BrowserAdapter.openDownload(br, downloadLink, finalLink, false, 1);
if (dl.getConnection().getContentType().contains("html")) {
br.followConnection();
if (br.containsHTML(">AccessKey is expired, please request")) throw new PluginException(LinkStatus.ERROR_FATAL, "FATAL server error, waittime skipped?");
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
}
dl.startDownload();
}
@Override
public int getMaxSimultanFreeDownloadNum() {
return -1;
}
private String findLink(final Browser br) throws Exception {
return br.getRegex("\"(http://s\\d+\\.freeuploads\\.fr/download/[^<>\"]*?)\"").getMatch(0);
}
private String getData(final String data) {
return br.getRegex("<b>" + data + "Size:</b>([^<>\"]*?)<br/>").getMatch(0);
}
@Override
public void reset() {
}
@Override
public void resetDownloadlink(DownloadLink link) {
}
}

View File

@ -0,0 +1,79 @@
//jDownloader - Downloadmanager
//Copyright (C) 2012 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/>.
package jd.plugins.hoster;
import java.io.IOException;
import jd.PluginWrapper;
import jd.nutils.encoding.Encoding;
import jd.parser.Regex;
import jd.plugins.DownloadLink;
import jd.plugins.DownloadLink.AvailableStatus;
import jd.plugins.HostPlugin;
import jd.plugins.LinkStatus;
import jd.plugins.PluginException;
import jd.plugins.PluginForHost;
@HostPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "github.com" }, urls = { "https://(www\\.)?github\\.com/[^<>\"]+/downloads" }, flags = { 0 })
public class GitHubCom extends PluginForHost {
public GitHubCom(PluginWrapper wrapper) {
super(wrapper);
}
@Override
public String getAGBLink() {
return "https://github.com/site/terms";
}
@Override
public AvailableStatus requestFileInformation(DownloadLink link) throws IOException, PluginException {
this.setBrowserExclusive();
br.setFollowRedirects(true);
br.getPage(link.getDownloadURL());
if (br.containsHTML("assets\\.github\\.com/images/modules/404/")) throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
String filename = new Regex(link.getDownloadURL(), ".*?/([^<>\"/]*?)/downloads$").getMatch(0);
if (filename == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
link.setName(Encoding.htmlDecode(filename.trim()));
return AvailableStatus.TRUE;
}
@Override
public void handleFree(DownloadLink downloadLink) throws Exception, PluginException {
requestFileInformation(downloadLink);
dl = jd.plugins.BrowserAdapter.openDownload(br, downloadLink, downloadLink.getDownloadURL().replace("/downloads", "/zipball/master"), false, 1);
if (dl.getConnection().getContentType().contains("html")) {
br.followConnection();
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
}
dl.startDownload();
}
@Override
public void reset() {
}
@Override
public int getMaxSimultanFreeDownloadNum() {
return -1;
}
@Override
public void resetDownloadlink(DownloadLink link) {
}
}

View File

@ -30,7 +30,7 @@ import jd.plugins.PluginForHost;
import org.appwork.utils.formatter.SizeFormatter;
@HostPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "localhostr.com" }, urls = { "http://(www\\.)?localhostr\\.com/download/[A-Za-z0-9]+/.+" }, flags = { 0 })
@HostPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "localhostr.com" }, urls = { "http://(www\\.)?(localhostr\\.com|lh\\.rs)/[A-Za-z0-9]+" }, flags = { 0 })
public class LocalHostrCom extends PluginForHost {
public LocalHostrCom(PluginWrapper wrapper) {
@ -42,6 +42,10 @@ public class LocalHostrCom extends PluginForHost {
return "http://localhostr.com/terms/";
}
public void correctDownloadLink(DownloadLink link) {
link.setUrlDownload(link.getDownloadURL().replace("lh.rs/", "localhostr.com/"));
}
@Override
public AvailableStatus requestFileInformation(DownloadLink link) throws IOException, PluginException {
this.setBrowserExclusive();
@ -49,9 +53,14 @@ public class LocalHostrCom extends PluginForHost {
br.getPage(link.getDownloadURL());
if (br.containsHTML("(>404<|>File not found|>We can\\'t find the file you\\'re looking for)")) throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
final Regex fInfo = br.getRegex("<div id=\"download\\-left\">[\t\n\r ]+<h1>([^<>\"]*?)</h1>[\t\n\r ]+<h3>([^<>\"]*?)</h3>");
final Regex gifLinkRegex = br.getRegex("<h1>(.*?)<small style=\"float:right\"> Size \\d+x\\d+ / (.*?) / \\d+ Views</small></h1>");
String filename = br.getRegex("<title>([^<>\"]*?) \\- Localhostr</title>").getMatch(0);
if (filename == null) filename = fInfo.getMatch(0);
if (filename == null) {
filename = fInfo.getMatch(0);
if (filename == null) filename = gifLinkRegex.getMatch(0);
}
String filesize = fInfo.getMatch(1);
if (filesize == null) filesize = gifLinkRegex.getMatch(1);
if (filename == null || filesize == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
link.setName(Encoding.htmlDecode(filename.trim()));
link.setDownloadSize(SizeFormatter.getSize(filesize));
@ -61,7 +70,10 @@ public class LocalHostrCom extends PluginForHost {
@Override
public void handleFree(DownloadLink downloadLink) throws Exception, PluginException {
requestFileInformation(downloadLink);
dl = jd.plugins.BrowserAdapter.openDownload(br, downloadLink, downloadLink.getDownloadURL().replace("/download/", "/file/") + "?agree=on", true, 0);
String dllink = br.getRegex("\"(/file/[^<>\"]*?)\"").getMatch(0);
if (dllink == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
dllink = "http://localhostr.com" + dllink;
dl = jd.plugins.BrowserAdapter.openDownload(br, downloadLink, dllink, true, 0);
if (dl.getConnection().getContentType().contains("html")) {
br.followConnection();
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);

View File

@ -0,0 +1,592 @@
//jDownloader - Downloadmanager
//Copyright (C) 2012 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/>.
package jd.plugins.hoster;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Pattern;
import jd.PluginWrapper;
import jd.config.Property;
import jd.http.Browser;
import jd.http.URLConnectionAdapter;
import jd.nutils.encoding.Encoding;
import jd.parser.Regex;
import jd.parser.html.Form;
import jd.parser.html.HTMLParser;
import jd.parser.html.InputField;
import jd.plugins.DownloadLink;
import jd.plugins.DownloadLink.AvailableStatus;
import jd.plugins.HostPlugin;
import jd.plugins.LinkStatus;
import jd.plugins.Plugin;
import jd.plugins.PluginException;
import jd.plugins.PluginForHost;
import jd.utils.JDUtilities;
import jd.utils.locale.JDL;
import org.appwork.utils.formatter.SizeFormatter;
@HostPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "ngsfile.com" }, urls = { "https?://(www\\.)?ngsfile\\.com/[a-z0-9]{12}" }, flags = { 0 })
public class NgsFileCom extends PluginForHost {
private String correctedBR = "";
private static final String PASSWORDTEXT = "<br><b>Passwor(d|t):</b> <input";
private final String COOKIE_HOST = "http://ngsfile.com";
private static final String MAINTENANCE = ">This server is in maintenance mode";
private static final String MAINTENANCEUSERTEXT = JDL.L("hoster.xfilesharingprobasic.errors.undermaintenance", "This server is under Maintenance");
private static final String ALLWAIT_SHORT = JDL.L("hoster.xfilesharingprobasic.errors.waitingfordownloads", "Waiting till new downloads can be started");
private static final String PREMIUMONLY1 = JDL.L("hoster.xfilesharingprobasic.errors.premiumonly1", "Max downloadable filesize for free users:");
private static final String PREMIUMONLY2 = JDL.L("hoster.xfilesharingprobasic.errors.premiumonly2", "Only downloadable via premium or registered");
// note: can not be negative -x or 0 .:. [1-*]
private static AtomicInteger totalMaxSimultanFreeDownload = new AtomicInteger(20);
// don't touch
private static AtomicInteger maxFree = new AtomicInteger(1);
// DEV NOTES
/**
* Script notes: Streaming versions of this script sometimes redirect you to
* their directlinks when accessing this link + the link ID:
* http://somehoster.in/vidembed-
* */
// XfileSharingProBasic Version 2.5.6.8-raz
// mods:
// non account: 20 * 20
// free account: chunk * maxdl
// premium account: chunk * maxdl
// protocol: no https
// captchatype: null
// other: no redirects
@Override
public void correctDownloadLink(DownloadLink link) {
link.setUrlDownload(link.getDownloadURL().replace("https://", "http://"));
}
@Override
public String getAGBLink() {
return COOKIE_HOST + "/tos.html";
}
public NgsFileCom(PluginWrapper wrapper) {
super(wrapper);
// this.enablePremium(COOKIE_HOST + "/premium.html");
}
// do not add @Override here to keep 0.* compatibility
public boolean hasAutoCaptcha() {
return true;
}
// do not add @Override here to keep 0.* compatibility
public boolean hasCaptcha() {
return true;
}
public void prepBrowser() {
// define custom browser headers and language settings.
br.getHeaders().put("Accept-Language", "en-gb, en;q=0.9, de;q=0.8");
br.setCookie(COOKIE_HOST, "lang", "english");
}
@Override
public AvailableStatus requestFileInformation(DownloadLink link) throws Exception {
this.setBrowserExclusive();
br.setFollowRedirects(false);
prepBrowser();
getPage(link.getDownloadURL());
if (new Regex(correctedBR, "(No such file|>File Not Found<|>The file was removed by|Reason (of|for) deletion:\n)").matches()) throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
if (correctedBR.contains(MAINTENANCE)) {
link.getLinkStatus().setStatusText(JDL.L("plugins.hoster.xfilesharingprobasic.undermaintenance", MAINTENANCEUSERTEXT));
return AvailableStatus.TRUE;
}
String[] fileInfo = new String[3];
// scan the first page
scanInfo(fileInfo);
// scan the second page. filesize[1] and md5hash[2] are not mission
// critical
if (fileInfo[0] == null) {
Form download1 = getFormByKey("op", "download1");
if (download1 != null) {
download1.remove("method_premium");
sendForm(download1);
scanInfo(fileInfo);
}
}
if (fileInfo[0] == null || fileInfo[0].equals("")) {
if (correctedBR.contains("You have reached the download(\\-| )limit")) {
logger.warning("Waittime detected, please reconnect to make the linkchecker work!");
return AvailableStatus.UNCHECKABLE;
}
logger.warning("filename equals null, throwing \"plugin defect\"");
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
}
if (fileInfo[2] != null && !fileInfo[2].equals("")) link.setMD5Hash(fileInfo[2].trim());
fileInfo[0] = fileInfo[0].replaceAll("(</b>|<b>|\\.html)", "");
link.setFinalFileName(fileInfo[0].trim());
if (fileInfo[1] != null && !fileInfo[1].equals("")) link.setDownloadSize(SizeFormatter.getSize(fileInfo[1]));
return AvailableStatus.TRUE;
}
private String[] scanInfo(String[] fileInfo) {
// standard traits from base page
if (fileInfo[0] == null) {
fileInfo[0] = new Regex(correctedBR, "You have requested.*?https?://(www\\.)?" + this.getHost() + "/[A-Za-z0-9]{12}/(.*?)</font>").getMatch(1);
if (fileInfo[0] == null) {
fileInfo[0] = new Regex(correctedBR, "fname\"( type=\"hidden\")? value=\"(.*?)\"").getMatch(1);
if (fileInfo[0] == null) {
fileInfo[0] = new Regex(correctedBR, "<h2>Download File(.*?)</h2>").getMatch(0);
if (fileInfo[0] == null) {
fileInfo[0] = new Regex(correctedBR, "Download File:? ?(<[^>]+> ?)+?([^<>\"\\']+)").getMatch(1);
// traits from download1 page below.
if (fileInfo[0] == null) {
fileInfo[0] = new Regex(correctedBR, "Filename:? ?(<[^>]+> ?)+?([^<>\"\\']+)").getMatch(1);
// next two are details from sharing box
if (fileInfo[0] == null) {
fileInfo[0] = new Regex(correctedBR, "copy\\(this\\);.+>(.+) \\- [\\d\\.]+ (KB|MB|GB)</a></textarea>[\r\n\t ]+</div>").getMatch(0);
if (fileInfo[0] == null) {
fileInfo[0] = new Regex(correctedBR, "copy\\(this\\);.+\\](.+) \\- [\\d\\.]+ (KB|MB|GB)\\[/URL\\]").getMatch(0);
}
}
}
}
}
}
}
if (fileInfo[1] == null) {
fileInfo[1] = new Regex(correctedBR, "\\(([0-9]+ bytes)\\)").getMatch(0);
if (fileInfo[1] == null) {
fileInfo[1] = new Regex(correctedBR, "</font>[ ]+\\(([^<>\"\\'/]+)\\)(.*?)</font>").getMatch(0);
if (fileInfo[1] == null) {
fileInfo[1] = new Regex(correctedBR, "([\\d\\.]+ ?(KB|MB|GB))").getMatch(0);
}
}
}
if (fileInfo[2] == null) fileInfo[2] = new Regex(correctedBR, "<b>MD5.*?</b>.*?nowrap>(.*?)<").getMatch(0);
return fileInfo;
}
@Override
public void handleFree(DownloadLink downloadLink) throws Exception, PluginException {
requestFileInformation(downloadLink);
doFree(downloadLink, true, 0, "freelink");
}
public void doFree(DownloadLink downloadLink, boolean resumable, int maxchunks, String directlinkproperty) throws Exception, PluginException {
String passCode = null;
// First, bring up saved final links
String dllink = checkDirectLink(downloadLink, directlinkproperty);
// Second, check for streaming links on the first page
if (dllink == null) dllink = getDllink();
// Third, continue like normal.
if (dllink == null) {
checkErrors(downloadLink, false, passCode);
Form download1 = getFormByKey("op", "download1");
if (download1 != null) {
download1.remove("method_premium");
sendForm(download1);
checkErrors(downloadLink, false, passCode);
}
dllink = getDllink();
}
if (dllink == null) {
Form dlForm = br.getFormbyProperty("name", "F1");
if (dlForm == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
// how many forms deep do you want to try.
int repeat = 3;
for (int i = 1; i < repeat; i++) {
dlForm.remove(null);
final long timeBefore = System.currentTimeMillis();
boolean password = false;
boolean skipWaittime = false;
if (new Regex(correctedBR, PASSWORDTEXT).matches()) {
password = true;
logger.info("The downloadlink seems to be password protected.");
}
// md5 can be on the subquent pages
if (downloadLink.getMD5Hash() == null) {
String md5hash = new Regex(correctedBR, "<b>MD5.*?</b>.*?nowrap>(.*?)<").getMatch(0);
if (md5hash != null) downloadLink.setMD5Hash(md5hash.trim());
}
/* Captcha START */
if (correctedBR.contains(";background:#ccc;text-align")) {
logger.info("Detected captcha method \"plaintext captchas\" for this host");
/** Captcha method by ManiacMansion */
String[][] letters = new Regex(br, "<span style=\\'position:absolute;padding\\-left:(\\d+)px;padding\\-top:\\d+px;\\'>(&#\\d+;)</span>").getMatches();
if (letters == null || letters.length == 0) {
logger.warning("plaintext captchahandling broken!");
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
}
SortedMap<Integer, String> capMap = new TreeMap<Integer, String>();
for (String[] letter : letters) {
capMap.put(Integer.parseInt(letter[0]), Encoding.htmlDecode(letter[1]));
}
StringBuilder code = new StringBuilder();
for (String value : capMap.values()) {
code.append(value);
}
dlForm.put("code", code.toString());
logger.info("Put captchacode " + code.toString() + " obtained by captcha metod \"plaintext captchas\" in the form.");
} else if (correctedBR.contains("/captchas/")) {
logger.info("Detected captcha method \"Standard captcha\" for this host");
String[] sitelinks = HTMLParser.getHttpLinks(br.toString(), null);
String captchaurl = null;
if (sitelinks == null || sitelinks.length == 0) {
logger.warning("Standard captcha captchahandling broken!");
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
}
for (String link : sitelinks) {
if (link.contains("/captchas/")) {
captchaurl = link;
break;
}
}
if (captchaurl == null) {
logger.warning("Standard captcha captchahandling broken!");
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
}
String code = getCaptchaCode("xfilesharingprobasic", captchaurl, downloadLink);
dlForm.put("code", code);
logger.info("Put captchacode " + code + " obtained by captcha metod \"Standard captcha\" in the form.");
} else if (new Regex(correctedBR, "(api\\.recaptcha\\.net|google\\.com/recaptcha/api/)").matches()) {
logger.info("Detected captcha method \"Re Captcha\" for this host");
PluginForHost recplug = JDUtilities.getPluginForHost("DirectHTTP");
jd.plugins.hoster.DirectHTTP.Recaptcha rc = ((DirectHTTP) recplug).getReCaptcha(br);
rc.setForm(dlForm);
String id = new Regex(correctedBR, "\\?k=([A-Za-z0-9%_\\+\\- ]+)\"").getMatch(0);
rc.setId(id);
rc.load();
File cf = rc.downloadCaptcha(getLocalCaptchaFile());
String c = getCaptchaCode(cf, downloadLink);
Form rcform = rc.getForm();
rcform.put("recaptcha_challenge_field", rc.getChallenge());
rcform.put("recaptcha_response_field", Encoding.urlEncode(c));
logger.info("Put captchacode " + c + " obtained by captcha metod \"Re Captcha\" in the form and submitted it.");
dlForm = rc.getForm();
/** wait time is often skippable for reCaptcha handling */
skipWaittime = true;
}
/* Captcha END */
if (password) passCode = handlePassword(passCode, dlForm, downloadLink);
if (!skipWaittime) waitTime(timeBefore, downloadLink);
sendForm(dlForm);
logger.info("Submitted DLForm");
checkErrors(downloadLink, true, passCode);
dllink = getDllink();
if (dllink == null && (!br.containsHTML("<Form name=\"F1\" method=\"POST\" action=\"\"") || i == repeat)) {
logger.warning("Final downloadlink (String is \"dllink\") regex didn't match!");
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
} else if (dllink == null && br.containsHTML("<Form name=\"F1\" method=\"POST\" action=\"\"")) {
dlForm = br.getFormbyProperty("name", "F1");
continue;
} else
break;
}
}
logger.info("Final downloadlink = " + dllink + " starting the download...");
dl = jd.plugins.BrowserAdapter.openDownload(br, downloadLink, dllink, resumable, maxchunks);
if (dl.getConnection().getContentType().contains("html")) {
logger.warning("The final dllink seems not to be a file!");
br.followConnection();
correctBR();
checkServerErrors();
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
}
downloadLink.setProperty(directlinkproperty, dllink);
if (passCode != null) downloadLink.setProperty("pass", passCode);
try {
// add a download slot
controlFree(+1);
// start the dl
dl.startDownload();
} finally {
// remove download slot
controlFree(-1);
}
}
@Override
public int getMaxSimultanFreeDownloadNum() {
return maxFree.get();
}
/**
* Prevents more than one free download from starting at a given time. One
* step prior to dl.startDownload(), it adds a slot to maxFree which allows
* the next singleton download to start, or at least try.
*
* This is needed because xfileshare(website) only throws errors after a
* final dllink starts transferring or at a given step within pre download
* sequence. But this template(XfileSharingProBasic) allows multiple
* slots(when available) to commence the download sequence,
* this.setstartintival does not resolve this issue. Which results in x(20)
* captcha events all at once and only allows one download to start. This
* prevents wasting peoples time and effort on captcha solving and|or
* wasting captcha trading credits. Users will experience minimal harm to
* downloading as slots are freed up soon as current download begins.
*
* @param controlFree
* (+1|-1)
*/
public synchronized void controlFree(int num) {
logger.info("maxFree was = " + maxFree.get());
maxFree.set(Math.min(Math.max(1, maxFree.addAndGet(num)), totalMaxSimultanFreeDownload.get()));
logger.info("maxFree now = " + maxFree.get());
}
/** Remove HTML code which could break the plugin */
public void correctBR() throws NumberFormatException, PluginException {
correctedBR = br.toString();
ArrayList<String> someStuff = new ArrayList<String>();
ArrayList<String> regexStuff = new ArrayList<String>();
regexStuff.add("<\\!(\\-\\-.*?\\-\\-)>");
regexStuff.add("(display: ?none;\">.*?</div>)");
regexStuff.add("(visibility:hidden>.*?<)");
for (String aRegex : regexStuff) {
String lolz[] = br.getRegex(aRegex).getColumn(0);
if (lolz != null) {
for (String dingdang : lolz) {
someStuff.add(dingdang);
}
}
}
for (String fun : someStuff) {
correctedBR = correctedBR.replace(fun, "");
}
}
public String getDllink() {
String dllink = br.getRedirectLocation();
if (dllink == null) {
dllink = new Regex(correctedBR, "dotted #bbb;padding.*?<a href=\"(.*?)\"").getMatch(0);
if (dllink == null) {
dllink = new Regex(correctedBR, "This (direct link|download link) will be available for your IP.*?href=\"(http.*?)\"").getMatch(1);
if (dllink == null) {
dllink = new Regex(correctedBR, "Download: <a href=\"(.*?)\"").getMatch(0);
if (dllink == null) {
dllink = new Regex(correctedBR, "<a href=\"(https?://[^\"]+)\"[^>]+>(Click to Download|Download File)").getMatch(0);
// generic fail over for COOKIE_HOST on final link
// format.
if (dllink == null) {
// dllink = new Regex(correctedBR,
// "(https?://[^/]+/cgi\\-bin/dl\\.cgi/[a-z0-9]+/[^\"\\']+)").getMatch(0);
// dllink = new Regex(correctedBR,
// "(https?://[^/]+/files/\\d+/[a-z0-9]+/[^\"\\']+)").getMatch(0);
if (dllink == null) {
String cryptedScripts[] = new Regex(correctedBR, "p\\}\\((.*?)\\.split\\('\\|'\\)").getColumn(0);
if (cryptedScripts != null && cryptedScripts.length != 0) {
for (String crypted : cryptedScripts) {
dllink = decodeDownloadLink(crypted);
if (dllink != null) break;
}
}
}
}
}
}
}
}
return dllink;
}
private void getPage(String page) throws Exception {
br.getPage(page);
correctBR();
}
private void postPage(String page, String postdata) throws Exception {
br.postPage(page, postdata);
correctBR();
}
private void sendForm(Form form) throws Exception {
br.submitForm(form);
correctBR();
}
public void checkErrors(DownloadLink theLink, boolean checkAll, String passCode) throws NumberFormatException, PluginException {
if (checkAll) {
if (new Regex(correctedBR, PASSWORDTEXT).matches() || correctedBR.contains("Wrong password")) {
logger.warning("Wrong password, the entered password \"" + passCode + "\" is wrong, retrying...");
throw new PluginException(LinkStatus.ERROR_RETRY, "Wrong password entered");
}
if (correctedBR.contains("Wrong captcha")) {
logger.warning("Wrong captcha or wrong password!");
throw new PluginException(LinkStatus.ERROR_CAPTCHA);
}
if (correctedBR.contains("\">Skipped countdown<")) throw new PluginException(LinkStatus.ERROR_FATAL, "Fatal countdown error (countdown skipped)");
}
/** Wait time reconnect handling */
if (new Regex(correctedBR, "(You have reached the download(\\-| )limit|You have to wait)").matches()) {
// adjust this regex to catch the wait time string for COOKIE_HOST
String WAIT = new Regex(correctedBR, "((You have reached the download(\\-| )limit|You have to wait)[^<>]+)").getMatch(0);
String tmphrs = new Regex(WAIT, "\\s+(\\d+)\\s+hours?").getMatch(0);
if (tmphrs == null) tmphrs = new Regex(correctedBR, "You have to wait.*?\\s+(\\d+)\\s+hours?").getMatch(0);
String tmpmin = new Regex(WAIT, "\\s+(\\d+)\\s+minutes?").getMatch(0);
if (tmpmin == null) tmpmin = new Regex(correctedBR, "You have to wait.*?\\s+(\\d+)\\s+minutes?").getMatch(0);
String tmpsec = new Regex(WAIT, "\\s+(\\d+)\\s+seconds?").getMatch(0);
String tmpdays = new Regex(WAIT, "\\s+(\\d+)\\s+days?").getMatch(0);
if (tmphrs == null && tmpmin == null && tmpsec == null && tmpdays == null) {
logger.info("Waittime regexes seem to be broken");
throw new PluginException(LinkStatus.ERROR_IP_BLOCKED, null, 60 * 60 * 1000l);
} else {
int minutes = 0, seconds = 0, hours = 0, days = 0;
if (tmphrs != null) hours = Integer.parseInt(tmphrs);
if (tmpmin != null) minutes = Integer.parseInt(tmpmin);
if (tmpsec != null) seconds = Integer.parseInt(tmpsec);
if (tmpdays != null) days = Integer.parseInt(tmpdays);
int waittime = ((days * 24 * 3600) + (3600 * hours) + (60 * minutes) + seconds + 1) * 1000;
logger.info("Detected waittime #2, waiting " + waittime + "milliseconds");
/** Not enough wait time to reconnect->Wait and try again */
if (waittime < 180000) { throw new PluginException(LinkStatus.ERROR_HOSTER_TEMPORARILY_UNAVAILABLE, JDL.L("plugins.hoster.xfilesharingprobasic.allwait", ALLWAIT_SHORT), waittime); }
throw new PluginException(LinkStatus.ERROR_IP_BLOCKED, null, waittime);
}
}
if (correctedBR.contains("You're using all download slots for IP")) { throw new PluginException(LinkStatus.ERROR_IP_BLOCKED, null, 10 * 60 * 1001l); }
if (correctedBR.contains("Error happened when generating Download Link")) throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Server error!", 10 * 60 * 1000l);
/** Error handling for only-premium links */
if (new Regex(correctedBR, "( can download files up to |Upgrade your account to download bigger files|>Upgrade your account to download larger files|>The file you requested reached max downloads limit for Free Users|Please Buy Premium To download this file<|This file reached max downloads limit)").matches()) {
String filesizelimit = new Regex(correctedBR, "You can download files up to(.*?)only").getMatch(0);
if (filesizelimit != null) {
filesizelimit = filesizelimit.trim();
logger.warning("As free user you can download files up to " + filesizelimit + " only");
throw new PluginException(LinkStatus.ERROR_FATAL, PREMIUMONLY1 + " " + filesizelimit);
} else {
logger.warning("Only downloadable via premium");
throw new PluginException(LinkStatus.ERROR_FATAL, PREMIUMONLY2);
}
}
if (correctedBR.contains(MAINTENANCE)) throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, MAINTENANCEUSERTEXT, 2 * 60 * 60 * 1000l);
}
public void checkServerErrors() throws NumberFormatException, PluginException {
if (new Regex(correctedBR, Pattern.compile("No file", Pattern.CASE_INSENSITIVE)).matches()) throw new PluginException(LinkStatus.ERROR_FATAL, "Server error");
if (new Regex(correctedBR, "(File Not Found|<h1>404 Not Found</h1>)").matches()) {
logger.warning("Server says link offline, please recheck that!");
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
}
}
private String decodeDownloadLink(String s) {
String decoded = null;
try {
Regex params = new Regex(s, "\\'(.*?[^\\\\])\\',(\\d+),(\\d+),\\'(.*?)\\'");
String p = params.getMatch(0).replaceAll("\\\\", "");
int a = Integer.parseInt(params.getMatch(1));
int c = Integer.parseInt(params.getMatch(2));
String[] k = params.getMatch(3).split("\\|");
while (c != 0) {
c--;
if (k[c].length() != 0) p = p.replaceAll("\\b" + Integer.toString(c, a) + "\\b", k[c]);
}
decoded = p;
} catch (Exception e) {
}
String finallink = null;
if (decoded != null) {
finallink = new Regex(decoded, "name=\"src\"value=\"(.*?)\"").getMatch(0);
if (finallink == null) {
finallink = new Regex(decoded, "type=\"video/divx\"src=\"(.*?)\"").getMatch(0);
if (finallink == null) {
finallink = new Regex(decoded, "\\.addVariable\\(\\'file\\',\\'(http://.*?)\\'\\)").getMatch(0);
}
}
}
return finallink;
}
private String handlePassword(String passCode, Form pwform, DownloadLink thelink) throws IOException, PluginException {
passCode = thelink.getStringProperty("pass", null);
if (passCode == null) passCode = Plugin.getUserInput("Password?", thelink);
pwform.put("password", passCode);
logger.info("Put password \"" + passCode + "\" entered by user in the DLForm.");
return Encoding.urlEncode(passCode);
}
private String checkDirectLink(DownloadLink downloadLink, String property) {
String dllink = downloadLink.getStringProperty(property);
if (dllink != null) {
try {
Browser br2 = br.cloneBrowser();
URLConnectionAdapter con = br2.openGetConnection(dllink);
if (con.getContentType().contains("html") || con.getLongContentLength() == -1) {
downloadLink.setProperty(property, Property.NULL);
dllink = null;
}
con.disconnect();
} catch (Exception e) {
downloadLink.setProperty(property, Property.NULL);
dllink = null;
}
}
return dllink;
}
@Override
public void reset() {
}
@Override
public void resetDownloadlink(DownloadLink link) {
}
private void waitTime(long timeBefore, DownloadLink downloadLink) throws PluginException {
int passedTime = (int) ((System.currentTimeMillis() - timeBefore) / 1000) - 1;
/** Ticket Time */
final String ttt = new Regex(correctedBR, "id=\"countdown_str\">[^<>\"]+<span id=\"[^<>\"]+\"( class=\"[^<>\"]+\")?>([\n ]+)?(\\d+)([\n ]+)?</span>").getMatch(2);
if (ttt != null) {
int tt = Integer.parseInt(ttt);
tt -= passedTime;
logger.info("Waittime detected, waiting " + ttt + " - " + passedTime + " seconds from now on...");
if (tt > 0) sleep(tt * 1000l, downloadLink);
}
}
// TODO: remove this when v2 becomes stable. use br.getFormbyKey(String key,
// String value)
/**
* Returns the first form that has a 'key' that equals 'value'.
*
* @param key
* @param value
* @return
*/
private Form getFormByKey(final String key, final String value) {
Form[] workaround = br.getForms();
if (workaround != null) {
for (Form f : workaround) {
for (InputField field : f.getInputFields()) {
if (key != null && key.equals(field.getKey())) {
if (value == null && field.getValue() == null) return f;
if (value != null && value.equals(field.getValue())) return f;
}
}
}
}
return null;
}
}

View File

@ -109,7 +109,7 @@ public class OneFichierCom extends PluginForHost {
return acc == null && link.getProperty("HOTLINK", null) != null;
}
public void doFree(DownloadLink downloadLink) throws Exception, PluginException {
public void doFree(final DownloadLink downloadLink) throws Exception, PluginException {
String dllink = downloadLink.getStringProperty(FREELINK, null);
if (dllink != null) {
/* try to resume existing file */
@ -184,40 +184,70 @@ public class OneFichierCom extends PluginForHost {
}
@Override
public AccountInfo fetchAccountInfo(Account account) throws Exception {
public AccountInfo fetchAccountInfo(final Account account) throws Exception {
AccountInfo ai = new AccountInfo();
/* reset maxPrem workaround on every fetchaccount info */
maxPrem.set(1);
// br.getPage("https://www.1fichier.com/en/login.pl");
br.postPage("https://www.1fichier.com/en/login.pl", "lt=on&Login=Login&secure=on&mail=" + Encoding.urlEncode(account.getUser()) + "&pass=" + account.getPass());
final String logincheck = br.getCookie("http://1fichier.com/", "SID");
if (logincheck == null || logincheck.equals("")) {
ai.setStatus("Username/Password invalid");
account.setProperty("type", Property.NULL);
account.setValid(false);
return ai;
}
br.getHeaders().put("X-Requested-With", "XMLHttpRequest");
br.getPage("https://www.1fichier.com/en/console/details.pl");
String freeCredits = br.getRegex(">Your account have ([^<>\"]*?) of direct download credits").getMatch(0);
if (freeCredits != null) {
/* not finished yet */
br.getPage("https://1fichier.com/console/account.pl?user=" + Encoding.urlEncode(account.getUser()) + "&pass=" + Encoding.urlEncode(JDHash.getMD5(account.getPass())));
String timeStamp = br.getRegex("(\\d+)").getMatch(0);
String freeCredits = br.getRegex("0[\r\n]+([0-9\\.]+)").getMatch(0);
if (timeStamp == null || "error".equalsIgnoreCase(timeStamp)) {
/** API might be wrong */
logger.info("Username/Password invalid via API, trying non-API login");
br.postPage("https://www.1fichier.com/en/login.pl", "lt=on&Login=Login&secure=on&mail=" + Encoding.urlEncode(account.getUser()) + "&pass=" + account.getPass());
final String logincheck = br.getCookie("http://1fichier.com/", "SID");
if (logincheck == null || logincheck.equals("")) {
logger.info("Username/Password also invalid via site login!");
ai.setStatus("Username/Password also invalid via site login!");
account.setProperty("type", Property.NULL);
account.setValid(false);
return ai;
}
account.setValid(true);
account.setProperty("type", "FREE");
ai.setStatus("Free Account (Credits available)");
ai.setTrafficLeft(SizeFormatter.getSize(freeCredits));
ai.setStatus("Free User (Credits available)");
br.getHeaders().put("X-Requested-With", "XMLHttpRequest");
br.getPage("https://www.1fichier.com/en/console/details.pl");
String freeCredits2 = br.getRegex(">Your account have ([^<>\"]*?) of direct download credits").getMatch(0);
if (freeCredits2 != null)
ai.setTrafficLeft(SizeFormatter.getSize(freeCredits2));
else
ai.setUnlimitedTraffic();
try {
maxPrem.set(1);
account.setMaxSimultanDownloads(-1);
account.setConcurrentUsePossible(true);
} catch (final Throwable e) {
}
account.setProperty("freeAPIdisabled", true);
return ai;
} else if ("0".equalsIgnoreCase(timeStamp)) {
if (freeCredits != null && Float.parseFloat(freeCredits) > 0) {
/* not finished yet */
account.setValid(true);
account.setProperty("type", "FREE");
ai.setStatus("Free User (Credits available)");
ai.setTrafficLeft(SizeFormatter.getSize(freeCredits + " GB"));
try {
maxPrem.set(1);
account.setMaxSimultanDownloads(-1);
account.setConcurrentUsePossible(true);
} catch (final Throwable e) {
}
account.setProperty("freeAPIdisabled", false);
} else {
ai.setStatus("Free User (No credits left)");
account.setProperty("type", Property.NULL);
account.setValid(false);
return ai;
}
return ai;
} else {
/** This might be broken... */
account.setValid(true);
account.setProperty("type", "PREMIUM");
ai.setStatus("Premium User");
ai.setValidUntil(Long.parseLong(timeStamp) * 1000l + (24 * 60 * 60 * 1000l));
ai.setUnlimitedTraffic();
try {
maxPrem.set(20);
@ -251,7 +281,7 @@ public class OneFichierCom extends PluginForHost {
doFree(downloadLink);
}
private String handlePassword(DownloadLink downloadLink, String passCode) throws IOException, PluginException {
private String handlePassword(final DownloadLink downloadLink, String passCode) throws IOException, PluginException {
logger.info("This link seems to be password protected, continuing...");
if (downloadLink.getStringProperty("pass", null) == null) {
passCode = Plugin.getUserInput("Password?", downloadLink);
@ -271,27 +301,27 @@ public class OneFichierCom extends PluginForHost {
public void handlePremium(final DownloadLink link, final Account account) throws Exception {
requestFileInformation(link);
String passCode = null;
if ("FREE".equals(account.getProperty("type"))) {
String dllink = link.getStringProperty(PREMLINK, null);
boolean useSSL = getPluginConfig().getBooleanProperty(SSL_CONNECTION, true);
if (dllink != null) {
/* try to resume existing file */
if (useSSL) dllink = dllink.replaceFirst("http://", "https://");
br.setFollowRedirects(true);
dl = jd.plugins.BrowserAdapter.openDownload(br, link, dllink, true, 0);
if (dl.getConnection().getContentType().contains("html")) {
/* could not resume, fetch new link */
br.followConnection();
link.setProperty(PREMLINK, Property.NULL);
dllink = null;
} else {
/* resume download */
dl.startDownload();
return;
}
}
if ("FREE".equals(account.getStringProperty("type")) && account.getBooleanProperty("freeAPIdisabled")) {
doFree(link);
} else {
String dllink = link.getStringProperty(PREMLINK, null);
boolean useSSL = getPluginConfig().getBooleanProperty(SSL_CONNECTION, true);
if (dllink != null) {
/* try to resume existing file */
if (useSSL) dllink = dllink.replaceFirst("http://", "https://");
br.setFollowRedirects(true);
dl = jd.plugins.BrowserAdapter.openDownload(br, link, dllink, true, 0);
if (dl.getConnection().getContentType().contains("html")) {
/* could not resume, fetch new link */
br.followConnection();
link.setProperty(PREMLINK, Property.NULL);
dllink = null;
} else {
/* resume download */
dl.startDownload();
return;
}
}
br.setFollowRedirects(false);
sleep(2 * 1000l, link);
String url = link.getDownloadURL().replace("en/index.html", "");
@ -329,7 +359,7 @@ public class OneFichierCom extends PluginForHost {
}
private void setConfigElements() {
this.getConfig().addEntry(new ConfigEntry(ConfigContainer.TYPE_CHECKBOX, this.getPluginConfig(), SSL_CONNECTION, JDL.L("plugins.hoster.rapidshare.com.ssl2", "Use Secure Communication over SSL")).setDefaultValue(true));
this.getConfig().addEntry(new ConfigEntry(ConfigContainer.TYPE_CHECKBOX, this.getPluginConfig(), SSL_CONNECTION, JDL.L("plugins.hoster.onefichiercom.com.ssl2", "Use Secure Communication over SSL")).setDefaultValue(true));
}
private void prepareBrowser(final Browser br) {

View File

@ -1,18 +1,18 @@
// jDownloader - Downloadmanager
// Copyright (C) 2012 JD-Team support@jdownloader.org
//jDownloader - Downloadmanager
//Copyright (C) 2012 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 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.
//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/>.
//You should have received a copy of the GNU General Public License
//along with this program. If not, see <http://www.gnu.org/licenses/>.
package jd.plugins.hoster;
@ -21,17 +21,18 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Pattern;
import jd.PluginWrapper;
import jd.config.Property;
import jd.http.Browser;
import jd.http.RandomUserAgent;
import jd.http.URLConnectionAdapter;
import jd.nutils.encoding.Encoding;
import jd.parser.Regex;
import jd.parser.html.Form;
import jd.parser.html.HTMLParser;
import jd.parser.html.InputField;
import jd.plugins.DownloadLink;
import jd.plugins.DownloadLink.AvailableStatus;
import jd.plugins.HostPlugin;
@ -44,22 +45,33 @@ import jd.utils.locale.JDL;
import org.appwork.utils.formatter.SizeFormatter;
@HostPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "mojofile.com" }, urls = { "https?://(www\\.)?mojofile\\.com/[a-z0-9]{12}" }, flags = { 0 })
public class MojoFileCom extends PluginForHost {
@HostPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "tsarfile.com" }, urls = { "https?://(www\\.)?tsarfile\\.com/[a-z0-9]{12}" }, flags = { 0 })
public class TsarFileCom extends PluginForHost {
private String correctedBR = "";
private static final String PASSWORDTEXT = "<br><b>Passwor(d|t):</b> <input";
private static final String COOKIE_HOST = "http://mojofile.com";
private static final String MAINTENANCE = ">This server is in maintenance mode";
private static final String MAINTENANCEUSERTEXT = "This server is under Maintenance";
private static final String ALLWAIT_SHORT = "Waiting till new downloads can be started";
private static String ua = RandomUserAgent.generate();
private String correctedBR = "";
private static final String PASSWORDTEXT = "<br><b>Passwor(d|t):</b> <input";
private final String COOKIE_HOST = "http://tsarfile.com";
private static final String MAINTENANCE = ">This server is in maintenance mode";
private static final String MAINTENANCEUSERTEXT = JDL.L("hoster.xfilesharingprobasic.errors.undermaintenance", "This server is under Maintenance");
private static final String ALLWAIT_SHORT = JDL.L("hoster.xfilesharingprobasic.errors.waitingfordownloads", "Waiting till new downloads can be started");
private static final String PREMIUMONLY1 = JDL.L("hoster.xfilesharingprobasic.errors.premiumonly1", "Max downloadable filesize for free users:");
private static final String PREMIUMONLY2 = JDL.L("hoster.xfilesharingprobasic.errors.premiumonly2", "Only downloadable via premium or registered");
// note: can not be negative -x or 0 .:. [1-*]
private static AtomicInteger totalMaxSimultanFreeDownload = new AtomicInteger(20);
// don't touch
private static AtomicInteger maxFree = new AtomicInteger(1);
// DEV NOTES
// XfileSharingProBasic Version 2.5.3.8
// mods: filename, wait time,
// free: 1 chunk, no resume 1 maxdl
// premium:
/**
* Script notes: Streaming versions of this script sometimes redirect you to
* their directlinks when accessing this link + the link ID:
* http://somehoster.in/vidembed-
* */
// XfileSharingProBasic Version 2.5.6.8-raz
// mods:
// non account: 1 * maxdl
// free account: chunk * maxdl
// premium account: chunk * maxdl
// protocol: no https
// captchatype: recaptcha
// other: no redirects
@ -74,15 +86,14 @@ public class MojoFileCom extends PluginForHost {
return COOKIE_HOST + "/tos.html";
}
public MojoFileCom(PluginWrapper wrapper) {
public TsarFileCom(PluginWrapper wrapper) {
super(wrapper);
this.setStartIntervall(10 * 1000);
// this.enablePremium(COOKIE_HOST + "/premium.html");
}
// do not add @Override here to keep 0.* compatibility
public boolean hasAutoCaptcha() {
return false;
return true;
}
// do not add @Override here to keep 0.* compatibility
@ -90,51 +101,89 @@ public class MojoFileCom extends PluginForHost {
return true;
}
public void prepBrowser() {
// define custom browser headers and language settings.
br.getHeaders().put("Accept-Language", "en-gb, en;q=0.9, de;q=0.8");
br.setCookie(COOKIE_HOST, "lang", "english");
}
@Override
public AvailableStatus requestFileInformation(DownloadLink link) throws IOException, PluginException {
public AvailableStatus requestFileInformation(DownloadLink link) throws Exception {
this.setBrowserExclusive();
br.setFollowRedirects(false);
br.setCookie(COOKIE_HOST, "lang", "english");
br.getHeaders().put("User-Agent", ua);
br.getPage(link.getDownloadURL());
doSomething();
if (new Regex(correctedBR, Pattern.compile("(No such file|>File Not Found<|>The file was removed by|Reason (of|for) deletion:\n)", Pattern.CASE_INSENSITIVE)).matches()) throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
prepBrowser();
getPage(link.getDownloadURL());
if (new Regex(correctedBR, "(No such file|>File Not Found<|>The file was removed by|Reason (of|for) deletion:\n)").matches()) throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
if (correctedBR.contains(MAINTENANCE)) {
link.getLinkStatus().setStatusText(JDL.L("plugins.hoster.xfilesharingprobasic.undermaintenance", MAINTENANCEUSERTEXT));
return AvailableStatus.TRUE;
}
System.out.println(correctedBR + "\n");
String filename = new Regex(correctedBR, "You have requested.*?https?://(www\\.)?" + this.getHost() + "/[A-Za-z0-9]{12}/(.*?)</font>").getMatch(1);
if (filename == null) {
filename = new Regex(correctedBR, "fname\"( type=\"hidden\")? value=\"(.*?)\"").getMatch(1);
if (filename == null) {
filename = new Regex(correctedBR, "<h2>Download File(.*?)</h2>").getMatch(0);
if (filename == null) {
filename = new Regex(correctedBR, "(?i)You have requested:[\r\n\t ]+([^<>\"\t\n\r]+)").getMatch(0);
}
String[] fileInfo = new String[3];
// scan the first page
scanInfo(fileInfo);
// scan the second page. filesize[1] and md5hash[2] are not mission
// critical
if (fileInfo[0] == null) {
Form download1 = getFormByKey("op", "download1");
if (download1 != null) {
download1.remove("method_premium");
sendForm(download1);
scanInfo(fileInfo);
}
}
String filesize = new Regex(correctedBR, "\\(([0-9]+ bytes)\\)").getMatch(0);
if (filesize == null) {
filesize = new Regex(correctedBR, "</font>[ ]+\\(([^<>\"\\'/]+)\\)(.*?)</font>").getMatch(0);
if (filesize == null) {
filesize = new Regex(br, "(?i)([\\d\\.]+ ?(KB|MB|GB))").getMatch(0);
}
}
if (filename == null || filename.equals("")) {
if (correctedBR.contains("You have reached the download-limit")) {
if (fileInfo[0] == null || fileInfo[0].equals("")) {
if (correctedBR.contains("You have reached the download(\\-| )limit")) {
logger.warning("Waittime detected, please reconnect to make the linkchecker work!");
return AvailableStatus.UNCHECKABLE;
}
logger.warning("The filename equals null, throwing \"plugin defect\" now...");
logger.warning("filename equals null, throwing \"plugin defect\"");
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
}
filename = filename.replaceAll("(</b>|<b>|\\.html)", "");
link.setFinalFileName(filename.trim());
if (filesize != null && !filesize.equals("")) link.setDownloadSize(SizeFormatter.getSize(filesize));
if (fileInfo[2] != null && !fileInfo[2].equals("")) link.setMD5Hash(fileInfo[2].trim());
fileInfo[0] = fileInfo[0].replaceAll("(</b>|<b>|\\.html)", "");
link.setFinalFileName(fileInfo[0].trim());
if (fileInfo[1] != null && !fileInfo[1].equals("")) link.setDownloadSize(SizeFormatter.getSize(fileInfo[1]));
return AvailableStatus.TRUE;
}
private String[] scanInfo(String[] fileInfo) {
// standard traits from base page
if (fileInfo[0] == null) {
fileInfo[0] = new Regex(correctedBR, "You have requested.*?https?://(www\\.)?" + this.getHost() + "/[A-Za-z0-9]{12}/(.*?)</font>").getMatch(1);
if (fileInfo[0] == null) {
fileInfo[0] = new Regex(correctedBR, "fname\"( type=\"hidden\")? value=\"(.*?)\"").getMatch(1);
if (fileInfo[0] == null) {
fileInfo[0] = new Regex(correctedBR, "<h2>Download File(.*?)</h2>").getMatch(0);
if (fileInfo[0] == null) {
fileInfo[0] = new Regex(correctedBR, "Download File:? ?(<[^>]+> ?)+?([^<>\"\\']+)").getMatch(1);
// traits from download1 page below.
if (fileInfo[0] == null) {
fileInfo[0] = new Regex(correctedBR, "Filename:? ?(<[^>]+> ?)+?([^<>\"\\']+)").getMatch(1);
// next two are details from sharing box
if (fileInfo[0] == null) {
fileInfo[0] = new Regex(correctedBR, "copy\\(this\\);.+>(.+) \\- [\\d\\.]+ (KB|MB|GB)</a></textarea>[\r\n\t ]+</div>").getMatch(0);
if (fileInfo[0] == null) {
fileInfo[0] = new Regex(correctedBR, "copy\\(this\\);.+\\](.+) \\- [\\d\\.]+ (KB|MB|GB)\\[/URL\\]").getMatch(0);
}
}
}
}
}
}
}
if (fileInfo[1] == null) {
fileInfo[1] = new Regex(correctedBR, "\\(([0-9]+ bytes)\\)").getMatch(0);
if (fileInfo[1] == null) {
fileInfo[1] = new Regex(correctedBR, "</font>[ ]+\\(([^<>\"\\'/]+)\\)(.*?)</font>").getMatch(0);
if (fileInfo[1] == null) {
fileInfo[1] = new Regex(correctedBR, "([\\d\\.]+ ?(KB|MB|GB))").getMatch(0);
}
}
}
if (fileInfo[2] == null) fileInfo[2] = new Regex(correctedBR, "<b>MD5.*?</b>.*?nowrap>(.*?)<").getMatch(0);
return fileInfo;
}
@Override
public void handleFree(DownloadLink downloadLink) throws Exception, PluginException {
requestFileInformation(downloadLink);
@ -143,23 +192,17 @@ public class MojoFileCom extends PluginForHost {
public void doFree(DownloadLink downloadLink, boolean resumable, int maxchunks, String directlinkproperty) throws Exception, PluginException {
String passCode = null;
String md5hash = new Regex(correctedBR, "<b>MD5.*?</b>.*?nowrap>(.*?)<").getMatch(0);
if (md5hash != null) {
md5hash = md5hash.trim();
logger.info("Found md5hash: " + md5hash);
downloadLink.setMD5Hash(md5hash);
}
// First, bring up saved final links
String dllink = checkDirectLink(downloadLink, directlinkproperty);
/**
* Video links can already be found here, if a link is found here we can
* skip wait times and captchas
*/
// Second, check for streaming links on the first page
if (dllink == null) dllink = getDllink();
// Third, continue like normal.
if (dllink == null) {
checkErrors(downloadLink, false, passCode);
if (correctedBR.contains("\"download1\"")) {
br.postPage(br.getURL(), "op=download1&usr_login=&id=" + new Regex(downloadLink.getDownloadURL(), "/([A-Za-z0-9]{12})$").getMatch(0) + "&fname=" + Encoding.urlEncode(downloadLink.getName()) + "&referer=&method_free=Free+Download");
doSomething();
Form download1 = getFormByKey("op", "download1");
if (download1 != null) {
download1.remove("method_premium");
sendForm(download1);
checkErrors(downloadLink, false, passCode);
}
dllink = getDllink();
@ -167,7 +210,9 @@ public class MojoFileCom extends PluginForHost {
if (dllink == null) {
Form dlForm = br.getFormbyProperty("name", "F1");
if (dlForm == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
for (int i = 0; i <= 3; i++) {
// how many forms deep do you want to try.
int repeat = 3;
for (int i = 1; i < repeat; i++) {
dlForm.remove(null);
final long timeBefore = System.currentTimeMillis();
boolean password = false;
@ -176,19 +221,23 @@ public class MojoFileCom extends PluginForHost {
password = true;
logger.info("The downloadlink seems to be password protected.");
}
// md5 can be on the subquent pages
if (downloadLink.getMD5Hash() == null) {
String md5hash = new Regex(correctedBR, "<b>MD5.*?</b>.*?nowrap>(.*?)<").getMatch(0);
if (md5hash != null) downloadLink.setMD5Hash(md5hash.trim());
}
/* Captcha START */
if (correctedBR.contains(";background:#ccc;text-align")) {
logger.info("Detected captcha method \"plaintext captchas\" for this host");
/** Captcha method by ManiacMansion */
String[][] letters = new Regex(Encoding.htmlDecode(br.toString()), "<span style=\\'position:absolute;padding\\-left:(\\d+)px;padding\\-top:\\d+px;\\'>(\\d)</span>").getMatches();
String[][] letters = new Regex(br, "<span style=\\'position:absolute;padding\\-left:(\\d+)px;padding\\-top:\\d+px;\\'>(&#\\d+;)</span>").getMatches();
if (letters == null || letters.length == 0) {
logger.warning("plaintext captchahandling broken!");
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
}
SortedMap<Integer, String> capMap = new TreeMap<Integer, String>();
for (String[] letter : letters) {
capMap.put(Integer.parseInt(letter[0]), letter[1]);
capMap.put(Integer.parseInt(letter[0]), Encoding.htmlDecode(letter[1]));
}
StringBuilder code = new StringBuilder();
for (String value : capMap.values()) {
@ -222,7 +271,7 @@ public class MojoFileCom extends PluginForHost {
PluginForHost recplug = JDUtilities.getPluginForHost("DirectHTTP");
jd.plugins.hoster.DirectHTTP.Recaptcha rc = ((DirectHTTP) recplug).getReCaptcha(br);
rc.setForm(dlForm);
String id = this.br.getRegex("\\?k=([A-Za-z0-9%_\\+\\- ]+)\"").getMatch(0);
String id = new Regex(correctedBR, "\\?k=([A-Za-z0-9%_\\+\\- ]+)\"").getMatch(0);
rc.setId(id);
rc.load();
File cf = rc.downloadCaptcha(getLocalCaptchaFile());
@ -238,17 +287,16 @@ public class MojoFileCom extends PluginForHost {
/* Captcha END */
if (password) passCode = handlePassword(passCode, dlForm, downloadLink);
if (!skipWaittime) waitTime(timeBefore, downloadLink);
br.submitForm(dlForm);
sendForm(dlForm);
logger.info("Submitted DLForm");
doSomething();
checkErrors(downloadLink, true, passCode);
dllink = getDllink();
if (dllink == null && br.containsHTML("(?i)<Form name=\"F1\" method=\"POST\" action=\"\"")) {
dlForm = br.getFormbyProperty("name", "F1");
continue;
} else if (dllink == null && !br.containsHTML("(?i)<Form name=\"F1\" method=\"POST\" action=\"\"")) {
if (dllink == null && (!br.containsHTML("<Form name=\"F1\" method=\"POST\" action=\"\"") || i == repeat)) {
logger.warning("Final downloadlink (String is \"dllink\") regex didn't match!");
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
} else if (dllink == null && br.containsHTML("<Form name=\"F1\" method=\"POST\" action=\"\"")) {
dlForm = br.getFormbyProperty("name", "F1");
continue;
} else
break;
}
@ -258,29 +306,60 @@ public class MojoFileCom extends PluginForHost {
if (dl.getConnection().getContentType().contains("html")) {
logger.warning("The final dllink seems not to be a file!");
br.followConnection();
doSomething();
correctBR();
checkServerErrors();
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
}
downloadLink.setProperty(directlinkproperty, dllink);
if (passCode != null) downloadLink.setProperty("pass", passCode);
dl.startDownload();
try {
// add a download slot
controlFree(+1);
// start the dl
dl.startDownload();
} finally {
// remove download slot
controlFree(-1);
}
}
@Override
public int getMaxSimultanFreeDownloadNum() {
return 1;
return maxFree.get();
}
/** This removes fake messages which can kill the plugin */
public void doSomething() throws NumberFormatException, PluginException {
/**
* Prevents more than one free download from starting at a given time. One
* step prior to dl.startDownload(), it adds a slot to maxFree which allows
* the next singleton download to start, or at least try.
*
* This is needed because xfileshare(website) only throws errors after a
* final dllink starts transferring or at a given step within pre download
* sequence. But this template(XfileSharingProBasic) allows multiple
* slots(when available) to commence the download sequence,
* this.setstartintival does not resolve this issue. Which results in x(20)
* captcha events all at once and only allows one download to start. This
* prevents wasting peoples time and effort on captcha solving and|or
* wasting captcha trading credits. Users will experience minimal harm to
* downloading as slots are freed up soon as current download begins.
*
* @param controlFree
* (+1|-1)
*/
public synchronized void controlFree(int num) {
logger.info("maxFree was = " + maxFree.get());
maxFree.set(Math.min(Math.max(1, maxFree.addAndGet(num)), totalMaxSimultanFreeDownload.get()));
logger.info("maxFree now = " + maxFree.get());
}
/** Remove HTML code which could break the plugin */
public void correctBR() throws NumberFormatException, PluginException {
correctedBR = br.toString();
ArrayList<String> someStuff = new ArrayList<String>();
ArrayList<String> regexStuff = new ArrayList<String>();
regexStuff.add("<\\!(\\-\\-.*?\\-\\-)>");
regexStuff.add("(display: ?none;\">.*?</div>)");
regexStuff.add("(visibility:hidden>.*?<)");
regexStuff.add("<span style=\"font\\-size: 1px;color:#FFFFFF;\">(.*?)</span>");
for (String aRegex : regexStuff) {
String lolz[] = br.getRegex(aRegex).getColumn(0);
if (lolz != null) {
@ -303,11 +382,22 @@ public class MojoFileCom extends PluginForHost {
if (dllink == null) {
dllink = new Regex(correctedBR, "Download: <a href=\"(.*?)\"").getMatch(0);
if (dllink == null) {
String cryptedScripts[] = br.getRegex("p\\}\\((.*?)\\.split\\('\\|'\\)").getColumn(0);
if (cryptedScripts != null && cryptedScripts.length != 0) {
for (String crypted : cryptedScripts) {
dllink = decodeDownloadLink(crypted);
if (dllink != null) break;
dllink = new Regex(correctedBR, "<a href=\"(https?://[^\"]+)\"[^>]+>(Click to Download|Download File)").getMatch(0);
// generic fail over for COOKIE_HOST on final link
// format.
if (dllink == null) {
// dllink = new Regex(correctedBR,
// "(https?://[^/]+/cgi\\-bin/dl\\.cgi/[a-z0-9]+/[^\"\\']+)").getMatch(0);
// dllink = new Regex(correctedBR,
// "(https?://[^/]+/files/\\d+/[a-z0-9]+/[^\"\\']+)").getMatch(0);
if (dllink == null) {
String cryptedScripts[] = new Regex(correctedBR, "p\\}\\((.*?)\\.split\\('\\|'\\)").getColumn(0);
if (cryptedScripts != null && cryptedScripts.length != 0) {
for (String crypted : cryptedScripts) {
dllink = decodeDownloadLink(crypted);
if (dllink != null) break;
}
}
}
}
}
@ -317,6 +407,21 @@ public class MojoFileCom extends PluginForHost {
return dllink;
}
private void getPage(String page) throws Exception {
br.getPage(page);
correctBR();
}
private void postPage(String page, String postdata) throws Exception {
br.postPage(page, postdata);
correctBR();
}
private void sendForm(Form form) throws Exception {
br.submitForm(form);
correctBR();
}
public void checkErrors(DownloadLink theLink, boolean checkAll, String passCode) throws NumberFormatException, PluginException {
if (checkAll) {
if (new Regex(correctedBR, PASSWORDTEXT).matches() || correctedBR.contains("Wrong password")) {
@ -330,14 +435,15 @@ public class MojoFileCom extends PluginForHost {
if (correctedBR.contains("\">Skipped countdown<")) throw new PluginException(LinkStatus.ERROR_FATAL, "Fatal countdown error (countdown skipped)");
}
/** Wait time reconnect handling */
if (new Regex(correctedBR, "(You have reached the download\\-limit|You have to wait|>You reached your hourly traffic limit)").matches()) {
/** TODO: Improve those regexes */
String tmphrs = new Regex(correctedBR, "\\s+(\\d+)\\s+hours?").getMatch(0);
if (new Regex(correctedBR, "(You have reached the download(\\-| )limit|You have to wait)").matches()) {
// adjust this regex to catch the wait time string for COOKIE_HOST
String WAIT = new Regex(correctedBR, "((You have reached the download(\\-| )limit|You have to wait)[^<>]+)").getMatch(0);
String tmphrs = new Regex(WAIT, "\\s+(\\d+)\\s+hours?").getMatch(0);
if (tmphrs == null) tmphrs = new Regex(correctedBR, "You have to wait.*?\\s+(\\d+)\\s+hours?").getMatch(0);
String tmpmin = br.getRegex("var maxtime = (\\d+)").getMatch(0);
String tmpmin = new Regex(WAIT, "\\s+(\\d+)\\s+minutes?").getMatch(0);
if (tmpmin == null) tmpmin = new Regex(correctedBR, "You have to wait.*?\\s+(\\d+)\\s+minutes?").getMatch(0);
String tmpsec = new Regex(correctedBR, "\\s+(\\d+)\\s+seconds?").getMatch(0);
String tmpdays = new Regex(correctedBR, "\\s+(\\d+)\\s+days?").getMatch(0);
String tmpsec = new Regex(WAIT, "\\s+(\\d+)\\s+seconds?").getMatch(0);
String tmpdays = new Regex(WAIT, "\\s+(\\d+)\\s+days?").getMatch(0);
if (tmphrs == null && tmpmin == null && tmpsec == null && tmpdays == null) {
logger.info("Waittime regexes seem to be broken");
throw new PluginException(LinkStatus.ERROR_IP_BLOCKED, null, 60 * 60 * 1000l);
@ -357,18 +463,18 @@ public class MojoFileCom extends PluginForHost {
if (correctedBR.contains("You're using all download slots for IP")) { throw new PluginException(LinkStatus.ERROR_IP_BLOCKED, null, 10 * 60 * 1001l); }
if (correctedBR.contains("Error happened when generating Download Link")) throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Server error!", 10 * 60 * 1000l);
/** Error handling for only-premium links */
if (new Regex(correctedBR, "( can download files up to |Upgrade your account to download bigger files|>Upgrade your account to download larger files|>The file You requested reached max downloads limit for Free Users|Please Buy Premium To download this file<|This file reached max downloads limit)").matches()) {
if (new Regex(correctedBR, "( can download files up to |Upgrade your account to download bigger files|>Upgrade your account to download larger files|>The file you requested reached max downloads limit for Free Users|Please Buy Premium To download this file<|This file reached max downloads limit)").matches()) {
String filesizelimit = new Regex(correctedBR, "You can download files up to(.*?)only").getMatch(0);
if (filesizelimit != null) {
filesizelimit = filesizelimit.trim();
logger.warning("As free user you can download files up to " + filesizelimit + " only");
throw new PluginException(LinkStatus.ERROR_FATAL, "Free users can only download files up to " + filesizelimit);
throw new PluginException(LinkStatus.ERROR_FATAL, PREMIUMONLY1 + " " + filesizelimit);
} else {
logger.warning("Only downloadable via premium");
throw new PluginException(LinkStatus.ERROR_FATAL, "Only downloadable via premium or registered");
throw new PluginException(LinkStatus.ERROR_FATAL, PREMIUMONLY2);
}
}
if (correctedBR.contains(MAINTENANCE)) throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, JDL.L("plugins.hoster.xfilesharingprobasic.undermaintenance", MAINTENANCEUSERTEXT), 2 * 60 * 60 * 1000l);
if (correctedBR.contains(MAINTENANCE)) throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, MAINTENANCEUSERTEXT, 2 * 60 * 60 * 1000l);
}
public void checkServerErrors() throws NumberFormatException, PluginException {
@ -459,4 +565,28 @@ public class MojoFileCom extends PluginForHost {
}
}
// TODO: remove this when v2 becomes stable. use br.getFormbyKey(String key,
// String value)
/**
* Returns the first form that has a 'key' that equals 'value'.
*
* @param key
* @param value
* @return
*/
private Form getFormByKey(final String key, final String value) {
Form[] workaround = br.getForms();
if (workaround != null) {
for (Form f : workaround) {
for (InputField field : f.getInputFields()) {
if (key != null && key.equals(field.getKey())) {
if (value == null && field.getValue() == null) return f;
if (value != null && value.equals(field.getValue())) return f;
}
}
}
}
return null;
}
}

View File

@ -53,7 +53,7 @@ import org.appwork.utils.formatter.SizeFormatter;
import org.appwork.utils.formatter.TimeFormatter;
//When adding new domains here also add them to the turbobit.net decrypter (TurboBitNetFolder)
@HostPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "turbobit.net" }, urls = { "http://(www\\.)?(maxisoc\\.ru|turo\\-bit\\.net|depositfiles\\.com\\.ua|dlbit\\.net|sharephile\\.com|filesmail\\.ru|hotshare\\.biz|bluetooths\\.pp\\.ru|speed-file\\.ru|sharezoid\\.com|turbobit\\.pl|dz-files\\.ru|file\\.alexforum\\.ws|file\\.grad\\.by|file\\.krut-warez\\.ru|filebit\\.org|files\\.best-trainings\\.org\\.ua|files\\.wzor\\.ws|gdefile\\.ru|letitshare\\.ru|mnogofiles\\.com|share\\.uz|sibit\\.net|turbo-bit\\.ru|turbobit\\.net|upload\\.mskvn\\.by|vipbit\\.ru|files\\.prime-speed\\.ru|filestore\\.net\\.ru|turbobit\\.ru|upload\\.dwmedia\\.ru|upload\\.uz|xrfiles\\.ru|unextfiles\\.com|e-flash\\.com\\.ua|turbobax\\.net|zharabit\\.net|download\\.uzhgorod\\.name|trium-club\\.ru|alfa-files\\.com|turbabit\\.net|filedeluxe\\.com|turbobit\\.name|files\\.uz\\-translations\\.uz|turboblt\\.ru|fo\\.letitbook\\.ru|freefo\\.ru|bayrakweb\\.com)/(.*?\\.html|download/free/[a-z0-9]+)" }, flags = { 2 })
@HostPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "turbobit.net" }, urls = { "http://(www\\.)?(maxisoc\\.ru|turo\\-bit\\.net|depositfiles\\.com\\.ua|dlbit\\.net|sharephile\\.com|filesmail\\.ru|hotshare\\.biz|bluetooths\\.pp\\.ru|speed-file\\.ru|sharezoid\\.com|turbobit\\.pl|dz-files\\.ru|file\\.alexforum\\.ws|file\\.grad\\.by|file\\.krut-warez\\.ru|filebit\\.org|files\\.best-trainings\\.org\\.ua|files\\.wzor\\.ws|gdefile\\.ru|letitshare\\.ru|mnogofiles\\.com|share\\.uz|sibit\\.net|turbo-bit\\.ru|turbobit\\.net|upload\\.mskvn\\.by|vipbit\\.ru|files\\.prime-speed\\.ru|filestore\\.net\\.ru|turbobit\\.ru|upload\\.dwmedia\\.ru|upload\\.uz|xrfiles\\.ru|unextfiles\\.com|e-flash\\.com\\.ua|turbobax\\.net|zharabit\\.net|download\\.uzhgorod\\.name|trium-club\\.ru|alfa-files\\.com|turbabit\\.net|filedeluxe\\.com|turbobit\\.name|files\\.uz\\-translations\\.uz|turboblt\\.ru|fo\\.letitbook\\.ru|freefo\\.ru|bayrakweb\\.com|savebit\\.net)/(.*?\\.html|download/free/[a-z0-9]+)" }, flags = { 2 })
public class TurboBitNet extends PluginForHost {
private final static String UA = RandomUserAgent.generate();
@ -199,7 +199,8 @@ public class TurboBitNet extends PluginForHost {
@Override
public void handleFree(final DownloadLink downloadLink) throws Exception {
/*
* we have to load the plugin first! we must not reference a plugin class without loading it before
* we have to load the plugin first! we must not reference a plugin
* class without loading it before
*/
JDUtilities.getPluginForDecrypt("linkcrypt.ws");
requestFileInformation(downloadLink);
@ -474,7 +475,8 @@ public class TurboBitNet extends PluginForHost {
String ua = null;
if (force == false) {
/*
* we have to reuse old UA, else the cookie will become invalid
* we have to reuse old UA, else the cookie will become
* invalid
*/
ua = account.getStringProperty("UA", null);
}
@ -625,7 +627,8 @@ public class TurboBitNet extends PluginForHost {
s[10] = "f9def8a1fa02c9b21ac5b5c9da0746ae2ac671be0c0fd99f194e5b69113a85d65c8bf86e8d00e23d254751eded741d72e7262ecdc19c6267af72d2e26b5e326a59a5ce295d28f89e21ae29ea523acfb545fd8adb";
s[11] = "f980fea5fa0ac9ef1bc7b694de0142f1289075bd0d0ddb9d1b195a6d103d82865cddff69890ae76a251b53efef711d74e07e299bc098";
/*
* we have to load the plugin first! we must not reference a plugin class without loading it before
* we have to load the plugin first! we must not reference a plugin
* class without loading it before
*/
JDUtilities.getPluginForDecrypt("linkcrypt.ws");
return JDHexUtils.toString(jd.plugins.decrypter.LnkCrptWs.IMAGEREGEX(s[i]));

View File

@ -16,6 +16,7 @@
package jd.plugins.hoster;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
@ -47,6 +48,7 @@ import jd.plugins.LinkStatus;
import jd.plugins.PluginException;
import jd.plugins.PluginForHost;
import jd.plugins.download.RAFDownload;
import jd.utils.JDUtilities;
import jd.utils.locale.JDL;
import org.appwork.utils.formatter.SizeFormatter;
@ -192,7 +194,8 @@ public class Uploadedto extends PluginForHost {
int retry = 0;
while (true) {
/*
* workaround for api issues, retry 5 times when content length is only 20 bytes
* workaround for api issues, retry 5 times when content
* length is only 20 bytes
*/
if (retry == 5) return false;
br.postPage("http://uploaded.net/api/filemultiple", sb.toString());
@ -394,12 +397,33 @@ public class Uploadedto extends PluginForHost {
}
Browser brc = br.cloneBrowser();
brc.getPage("http://uploaded.net/js/download.js");
String wait = br.getRegex("Aktuelle Wartezeit: <span>(\\d+)</span> Sekunden</span>").getMatch(0);
br.postPage("http://uploaded.net/io/ticket/captcha/" + getID(downloadLink), "");
final String rcID = brc.getRegex("Recaptcha\\.create\\(\"([^<>\"]*?)\"").getMatch(0);
final String wait = br.getRegex("Aktuelle Wartezeit: <span>(\\d+)</span> Sekunden</span>").getMatch(0);
if (rcID == null || wait == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
br.getHeaders().put("X-Requested-With", "XMLHttpRequest");
br.postPage("http://uploaded.net/io/ticket/slot/" + getID(downloadLink), "");
if (!br.containsHTML("\\{succ:true\\}")) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
final long timebefore = System.currentTimeMillis();
final PluginForHost recplug = JDUtilities.getPluginForHost("DirectHTTP");
jd.plugins.hoster.DirectHTTP.Recaptcha rc = ((DirectHTTP) recplug).getReCaptcha(br);
rc.setId(rcID);
rc.load();
for (int i = 0; i <= 5; i++) {
File cf = rc.downloadCaptcha(getLocalCaptchaFile());
String c = getCaptchaCode(cf, downloadLink);
int passedTime = (int) ((System.currentTimeMillis() - timebefore) / 1000) - 1;
if (i == 0 && passedTime < Integer.parseInt(wait)) {
sleep((Integer.parseInt(wait) - passedTime) * 1001l, downloadLink);
}
br.postPage("http://uploaded.net/io/ticket/captcha/" + getID(downloadLink), "recaptcha_challenge_field=" + rc.getChallenge() + "&recaptcha_response_field=" + c);
if (br.containsHTML("\"err\":\"captcha\"")) {
rc.reload();
continue;
}
break;
}
if (br.containsHTML("No connection to database")) throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "ServerError", 30 * 60 * 1000l);
if (br.containsHTML("err\":\"Ticket kann nicht")) throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "ServerError", 30 * 60 * 1000l);
if (br.containsHTML("\"?err\"?:\"captcha")) throw new PluginException(LinkStatus.ERROR_CAPTCHA);
if (br.containsHTML("err\":\"Leider sind derzeit all unsere")) throw new PluginException(LinkStatus.ERROR_HOSTER_TEMPORARILY_UNAVAILABLE, "No free Downloadslots available", 5 * 60 * 1000l);
if (br.containsHTML("(limit\\-dl|\"err\":\"Sie haben die max\\. Anzahl an Free\\-Downloads)")) throw new PluginException(LinkStatus.ERROR_IP_BLOCKED, 60 * 60 * 1000l);
if (br.containsHTML("limit\\-parallel")) throw new PluginException(LinkStatus.ERROR_IP_BLOCKED, "You're already downloading", 60 * 60 * 1000l);
@ -407,7 +431,6 @@ public class Uploadedto extends PluginForHost {
String url = br.getRegex("url:\\'(http:.*?)\\'").getMatch(0);
if (url == null) url = br.getRegex("url:\\'(dl/.*?)\\'").getMatch(0);
if (url == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
if (wait != null) this.sleep(Integer.parseInt(wait) * 1000l, downloadLink);
dl = BrowserAdapter.openDownload(br, downloadLink, url, false, 1);
try {
/* remove next major update */
@ -436,7 +459,8 @@ public class Uploadedto extends PluginForHost {
if ("No htmlCode read".equalsIgnoreCase(br.toString())) throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "ServerError", 30 * 60 * 1000l);
if (br.containsHTML("Datei herunterladen")) {
/*
* we get fresh entry page after clicking download, means we have to start from beginning
* we get fresh entry page after clicking download, means we
* have to start from beginning
*/
throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Serverproblem", 5 * 60 * 1000l);
}

View File

@ -19,6 +19,9 @@ package jd.plugins.hoster;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.concurrent.atomic.AtomicInteger;
@ -27,12 +30,16 @@ import java.util.regex.Pattern;
import jd.PluginWrapper;
import jd.config.Property;
import jd.http.Browser;
import jd.http.Cookie;
import jd.http.Cookies;
import jd.http.URLConnectionAdapter;
import jd.nutils.encoding.Encoding;
import jd.parser.Regex;
import jd.parser.html.Form;
import jd.parser.html.HTMLParser;
import jd.parser.html.InputField;
import jd.plugins.Account;
import jd.plugins.AccountInfo;
import jd.plugins.DownloadLink;
import jd.plugins.DownloadLink.AvailableStatus;
import jd.plugins.HostPlugin;
@ -44,8 +51,9 @@ import jd.utils.JDUtilities;
import jd.utils.locale.JDL;
import org.appwork.utils.formatter.SizeFormatter;
import org.appwork.utils.formatter.TimeFormatter;
@HostPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "uploadoz.com" }, urls = { "https?://(www\\.)?uploadoz\\.com/[a-z0-9]{12}" }, flags = { 0 })
@HostPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "uploadoz.com" }, urls = { "https?://(www\\.)?uploadoz\\.com/[a-z0-9]{12}" }, flags = { 2 })
public class UploadozCom extends PluginForHost {
private String correctedBR = "";
@ -60,13 +68,15 @@ public class UploadozCom extends PluginForHost {
private static AtomicInteger totalMaxSimultanFreeDownload = new AtomicInteger(1);
// don't touch
private static AtomicInteger maxFree = new AtomicInteger(1);
private static AtomicInteger maxPrem = new AtomicInteger(1);
private static final Object LOCK = new Object();
// DEV NOTES
// XfileSharingProBasic Version 2.5.6.8-raz
// mods:
// non account: 2 * 1
// free account:
// premium account:
// free account: untested, set free limits
// premium account: 10 * 2
// protocol: no https
// captchatype: 4dignum
// other: no redirects, higher read timeout
@ -83,7 +93,7 @@ public class UploadozCom extends PluginForHost {
public UploadozCom(PluginWrapper wrapper) {
super(wrapper);
// this.enablePremium(COOKIE_HOST + "/premium.html");
this.enablePremium(COOKIE_HOST + "/premium.html");
}
// do not add @Override here to keep 0.* compatibility
@ -585,4 +595,155 @@ public class UploadozCom extends PluginForHost {
return null;
}
@Override
public AccountInfo fetchAccountInfo(Account account) throws Exception {
AccountInfo ai = new AccountInfo();
/* reset maxPrem workaround on every fetchaccount info */
maxPrem.set(1);
try {
login(account, true);
} catch (PluginException e) {
account.setValid(false);
return ai;
}
String space[][] = new Regex(correctedBR, "<td>Used space:</td>.*?<td.*?b>([0-9\\.]+) of [0-9\\.]+ (KB|MB|GB|TB)</b>").getMatches();
if ((space != null && space.length != 0) && (space[0][0] != null && space[0][1] != null)) ai.setUsedSpace(space[0][0] + " " + space[0][1]);
account.setValid(true);
String availabletraffic = new Regex(correctedBR, "Traffic available.*?:</TD><TD><b>([^<>\"\\']+)</b>").getMatch(0);
if (availabletraffic != null && !availabletraffic.contains("nlimited") && !availabletraffic.equalsIgnoreCase(" Mb")) {
ai.setTrafficLeft(SizeFormatter.getSize(availabletraffic));
} else {
ai.setUnlimitedTraffic();
}
if (account.getBooleanProperty("nopremium")) {
ai.setStatus("Registered (free) User");
try {
maxPrem.set(1);
// free accounts can still have captcha.
totalMaxSimultanFreeDownload.set(maxPrem.get());
account.setMaxSimultanDownloads(maxPrem.get());
account.setConcurrentUsePossible(false);
} catch (final Throwable e) {
}
} else {
String expire = new Regex(correctedBR, "<td>Premium(\\-| )Account expires?:</td>.*?<td>(<b>)?(\\d{1,2} [A-Za-z]+ \\d{4})(</b>)?</td>").getMatch(2);
if (expire == null) expire = new Regex(correctedBR, "(\\d{1,2} [A-Za-z]+ \\d{4})").getMatch(0);
if (expire == null) {
ai.setExpired(true);
account.setValid(false);
return ai;
} else {
expire = expire.replaceAll("(<b>|</b>)", "");
ai.setValidUntil(TimeFormatter.getMilliSeconds(expire, "dd MMMM yyyy", Locale.ENGLISH));
try {
maxPrem.set(2);
account.setMaxSimultanDownloads(maxPrem.get());
account.setConcurrentUsePossible(true);
} catch (final Throwable e) {
}
}
ai.setStatus("Premium User");
}
return ai;
}
@SuppressWarnings("unchecked")
private void login(Account account, boolean force) throws Exception {
synchronized (LOCK) {
try {
/** Load cookies */
br.setCookiesExclusive(true);
prepBrowser();
final Object ret = account.getProperty("cookies", null);
boolean acmatch = Encoding.urlEncode(account.getUser()).equals(account.getStringProperty("name", Encoding.urlEncode(account.getUser())));
if (acmatch) acmatch = Encoding.urlEncode(account.getPass()).equals(account.getStringProperty("pass", Encoding.urlEncode(account.getPass())));
if (acmatch && ret != null && ret instanceof HashMap<?, ?> && !force) {
final HashMap<String, String> cookies = (HashMap<String, String>) ret;
if (account.isValid()) {
for (final Map.Entry<String, String> cookieEntry : cookies.entrySet()) {
final String key = cookieEntry.getKey();
final String value = cookieEntry.getValue();
this.br.setCookie(COOKIE_HOST, key, value);
}
return;
}
}
getPage(COOKIE_HOST + "/login.html");
Form loginform = br.getFormbyProperty("name", "FL");
if (loginform == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
loginform.put("login", Encoding.urlEncode(account.getUser()));
loginform.put("password", Encoding.urlEncode(account.getPass()));
sendForm(loginform);
if (br.getCookie(COOKIE_HOST, "login") == null || br.getCookie(COOKIE_HOST, "xfss") == null) throw new PluginException(LinkStatus.ERROR_PREMIUM, PluginException.VALUE_ID_PREMIUM_DISABLE);
getPage(COOKIE_HOST + "/?op=my_account");
if (!new Regex(correctedBR, "(Premium(\\-| )Account expire|>Renew premium<)").matches()) {
account.setProperty("nopremium", true);
} else {
account.setProperty("nopremium", false);
}
/** Save cookies */
final HashMap<String, String> cookies = new HashMap<String, String>();
final Cookies add = this.br.getCookies(COOKIE_HOST);
for (final Cookie c : add.getCookies()) {
cookies.put(c.getKey(), c.getValue());
}
account.setProperty("name", Encoding.urlEncode(account.getUser()));
account.setProperty("pass", Encoding.urlEncode(account.getPass()));
account.setProperty("cookies", cookies);
} catch (final PluginException e) {
account.setProperty("cookies", Property.NULL);
throw e;
}
}
}
@Override
public void handlePremium(DownloadLink link, Account account) throws Exception {
String passCode = null;
requestFileInformation(link);
login(account, false);
br.setFollowRedirects(false);
String dllink = null;
if (account.getBooleanProperty("nopremium")) {
getPage(link.getDownloadURL());
doFree(link, true, -2, "freelink2");
} else {
dllink = checkDirectLink(link, "premlink");
if (dllink == null) {
getPage(link.getDownloadURL());
dllink = getDllink();
if (dllink == null) {
checkErrors(link, true, passCode);
Form dlform = br.getFormbyProperty("name", "F1");
if (dlform == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
if (new Regex(correctedBR, PASSWORDTEXT).matches()) passCode = handlePassword(passCode, dlform, link);
sendForm(dlform);
dllink = getDllink();
checkErrors(link, true, passCode);
}
}
if (dllink == null) {
logger.warning("Final downloadlink (String is \"dllink\") regex didn't match!");
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
}
logger.info("Final downloadlink = " + dllink + " starting the download...");
dl = jd.plugins.BrowserAdapter.openDownload(br, link, dllink, true, -10);
if (dl.getConnection().getContentType().contains("html")) {
logger.warning("The final dllink seems not to be a file!");
br.followConnection();
correctBR();
checkServerErrors();
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
}
if (passCode != null) link.setProperty("pass", passCode);
link.setProperty("premlink", dllink);
dl.startDownload();
}
}
@Override
public int getMaxSimultanPremiumDownloadNum() {
/* workaround for free/premium issue on stable 09581 */
return maxPrem.get();
}
}

View File

@ -20,6 +20,7 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
@ -593,7 +594,7 @@ public class XFileSharingProBasic extends PluginForHost {
return ai;
} else {
expire = expire.replaceAll("(<b>|</b>)", "");
ai.setValidUntil(TimeFormatter.getMilliSeconds(expire, "dd MMMM yyyy", null));
ai.setValidUntil(TimeFormatter.getMilliSeconds(expire, "dd MMMM yyyy", Locale.ENGLISH));
try {
maxPrem.set(-1);
account.setMaxSimultanDownloads(maxPrem.get());

View File

@ -0,0 +1,98 @@
// jDownloader - Downloadmanager
// Copyright (C) 2010 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/>.
package jd.plugins.hoster;
import java.io.IOException;
import jd.PluginWrapper;
import jd.nutils.encoding.Encoding;
import jd.parser.html.Form;
import jd.plugins.DownloadLink;
import jd.plugins.DownloadLink.AvailableStatus;
import jd.plugins.HostPlugin;
import jd.plugins.LinkStatus;
import jd.plugins.PluginException;
import jd.plugins.PluginForHost;
import org.appwork.utils.formatter.SizeFormatter;
@HostPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "zshare.ma" }, urls = { "http://(www\\.)?(www\\d+\\.)?zshare\\.ma/[a-z0-9]{12}" }, flags = { 0 })
public class ZShareMa extends PluginForHost {
public ZShareMa(PluginWrapper wrapper) {
super(wrapper);
}
@Override
public String getAGBLink() {
return "http://www2.zshare.ma/";
}
@Override
public AvailableStatus requestFileInformation(DownloadLink link) throws IOException, PluginException {
this.setBrowserExclusive();
br.setFollowRedirects(true);
br.getPage(link.getDownloadURL());
if (br.containsHTML("(>No such file<|>Possible causes of this error could be)")) throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
String filename = br.getRegex("/> File Download : ([^<>\"]*?)</span>").getMatch(0);
if (filename == null) {
filename = br.getRegex("<Title> Download ([^<>\"]*?) \\- zSHARE </Title>").getMatch(0);
if (filename == null) filename = br.getRegex("</span>File Name: ([^<>\"]*?)</div></td>").getMatch(0);
}
String filesize = br.getRegex("\\((\\d+ bytes)\\)").getMatch(0);
if (filename == null || filesize == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
link.setName(Encoding.htmlDecode(filename.trim()));
link.setDownloadSize(SizeFormatter.getSize(filesize));
return AvailableStatus.TRUE;
}
@Override
public void handleFree(DownloadLink downloadLink) throws Exception, PluginException {
requestFileInformation(downloadLink);
br.setFollowRedirects(false);
final Form dlform = br.getFormbyProperty("name", "F1");
if (dlform == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
br.submitForm(dlform);
String dllink = br.getRedirectLocation();
if (dllink == null) {
dllink = br.getRegex("\"(http://www\\d+\\.zshare\\.ma/files/[^<>\"]*?)\"").getMatch(0);
if (dllink == null) dllink = br.getRegex(">Click <A[\t\n\r ]+href=\"(http://[^<>\"]*?)\"").getMatch(0);
}
if (dllink == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
dl = jd.plugins.BrowserAdapter.openDownload(br, downloadLink, dllink, false, 1);
if (dl.getConnection().getContentType().contains("html")) {
br.followConnection();
if (br.containsHTML("No file")) throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Server error", 60 * 60 * 1000l);
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
}
dl.startDownload();
}
@Override
public void reset() {
}
@Override
public int getMaxSimultanFreeDownloadNum() {
return -1;
}
@Override
public void resetDownloadlink(DownloadLink link) {
}
}