-fixed soundcloud fixes #7085 maybe some decrypt types are missing but users will tell us soon

-fixed chomikuj bug in password protected links fixes #7084
-mediafire folderdecrypter now also decrypts folders with over 100 links and sets packagename correctly
-improved freeuploads errorhandling
-deleted double-freeuploads plugin
-fixed oteuploads login
-filecloud normal users are only allowed to have 1 simultan download
-fixed asfile errorhandling - finally works
-added support for mountfile and folderdecrypter closes #7077
-added vk setting

git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@19071 ebf7c1c2-ba36-0410-9fe8-c592906822b4
This commit is contained in:
psp 2012-12-06 18:30:22 +00:00
parent e718a96e9e
commit 63f29d346c
14 changed files with 396 additions and 262 deletions

View File

@ -982,4 +982,5 @@ jd/plugins/hoster/UptalDotNet.class
jd/plugins/hoster/UptalCom.class
jd/plugins/hoster/FileDudeCom.class
jd/plugins/hoster/FileDinoCom.class
jd/plugins/hoster/ZeusUploadCom.class
jd/plugins/hoster/ZeusUploadCom.class
jd/plugins/hoster/FreeUploadsFf.class

View File

@ -88,11 +88,20 @@ public class ChoMikujPl extends PluginForDecrypt {
}
}
br.getPage(parameter);
// Check for redirect and apply new link
String redirect = br.getRedirectLocation();
if (redirect != null) {
parameter = redirect;
br.getPage(parameter);
}
/** Handle single links 2 */
String ext = parameter.substring(parameter.lastIndexOf("."));
if (ext != null && ext.length() <= 5 && ext.matches(ENDINGS)) {
br.getPage(parameter);
final String redirect = br.getRedirectLocation();
redirect = br.getRedirectLocation();
if (redirect != null) {
// Maybe direct link is no direct link anymore?!
ext = redirect.substring(redirect.lastIndexOf("."));
@ -132,8 +141,6 @@ public class ChoMikujPl extends PluginForDecrypt {
return decryptedLinks;
}
br.getPage(parameter);
// Check if link can be decrypted
final String cantDecrypt = getError();
if (cantDecrypt != null) {
@ -201,6 +208,7 @@ public class ChoMikujPl extends PluginForDecrypt {
}
private ArrayList<DownloadLink> decryptAll(final String parameter, final String postdata, final CryptedLink param, final FilePackage fp) throws Exception {
br.setFollowRedirects(true);
ArrayList<DownloadLink> decryptedLinks = new ArrayList<DownloadLink>();
String savePost = postdata;
String saveLink = null;
@ -269,15 +277,25 @@ public class ChoMikujPl extends PluginForDecrypt {
final String linkPart = new Regex(parameter, "chomikuj\\.pl(/.+)").getMatch(0);
/** Decrypt all pages, start with 1 (not 0 as it was before) */
logger.info("Decrypting page " + pageCount + " of link: " + parameter);
final Browser tempBr = new Browser();
final Browser tempBr = br.cloneBrowser();
prepareBrowser(parameter, tempBr);
accessPage(postdata, tempBr, pageCount);
/** Only request further pages is folder isn't password protected */
if (FOLDERPASSWORD != null) {
tempBr.getPage(parameter);
} else {
accessPage(postdata, tempBr, pageCount);
}
String[][] allFolders = null;
final String folderTable = tempBr.getRegex("<div id=\"foldersList\">[\t\n\r ]+<table>(.*?)</table>[\t\n\r ]+</div>").getMatch(0);
if (folderTable != null) {
allFolders = new Regex(folderTable, "<a href=\"(/[^<>\"]*?)\" rel=\"\\d+\" title=\"([^<>\"]*?)\"").getMatches();
}
// Every full page has 30 links
/** For photos */
String[][] fileIds = tempBr.getRegex("<div class=\"left\">[\t\n\r ]+<p class=\"filename\">[\t\n\r ]+<a class=\"downloadAction\" href=\"[^<>\"\\']+\"> +<span class=\"bold\">(.{1,300})</span>(\\..{1,20})</a>[\t\n\r ]+</p>[\t\n\r ]+<div class=\"thumbnail\">.*?title=\"([^<>\"]*?)\".*?</div>[\t\n\r ]+<div class=\"smallTab\">[\t\n\r ]+<ul class=\"tabGradientBg borderRadius\">[\t\n\r ]+<li>([^<>\"\\'/]+)</li>.*?class=\"galeryActionButtons visibleOpt fileIdContainer\" rel=\"(\\d+)\"").getMatches();
addRegexInt(0, 1, 3, 4, 2);
if (fileIds == null || fileIds.length == 0) {
/** Specified for videos */
/** Specified for videos (also works for mp3s, maybe also for other types) */
fileIds = tempBr.getRegex("<ul class=\"borderRadius tabGradientBg\">[\t\n\r ]+<li><span>([^<>\"\\']+)</span></li>[\t\n\r ]+<li><span class=\"date\">[^<>\"\\']+</span></li>[\t\n\r ]+</ul>[\t\n\r ]+</div>[\t\n\r ]+<div class=\"fileActionsButtons clear visibleButtons fileIdContainer\" rel=\"(\\d+)\" style=\"visibility: hidden;\">.*?class=\"expanderHeader downloadAction\" href=\"[^<>\"\\']+\" title=\"[^<>\"\\']+\">[\t\n\r ]+<span class=\"bold\">([^<>\"\\']*?(<span class=\"e\"> </span>[^<>\"\\']*?)?)</span>([^<>\"\\']+)</a>[\t\n\r ]+<img alt=\"pobierz\" class=\"downloadArrow visibleArrow\" src=\"").getMatches();
addRegexInt(2, 4, 0, 1, 0);
/**
@ -287,11 +305,6 @@ public class ChoMikujPl extends PluginForDecrypt {
fileIds = tempBr.getRegex("fileIdContainer\" rel=\"(\\d+)\"").getMatches();
}
}
String[][] allFolders = null;
final String folderTable = tempBr.getRegex("<div id=\"foldersList\">[\t\n\r ]+<table>(.*?)</table>[\t\n\r ]+</div>").getMatch(0);
if (folderTable != null) {
allFolders = new Regex(folderTable, "<a href=\"(/[^<>\"]*?)\" rel=\"\\d+\" title=\"([^<>\"]*?)\"").getMatches();
}
if ((fileIds == null || fileIds.length == 0) && (allFolders == null || allFolders.length == 0)) {
if (tempBr.containsHTML("class=\"noFile\">Nie ma plik\\&#243;w w tym folderze</p>")) {
logger.info("The following link is offline: " + parameter);
@ -314,8 +327,7 @@ public class ChoMikujPl extends PluginForDecrypt {
dl.setDownloadSize(SizeFormatter.getSize(id[REGEXSORT.get(2)].replace(",", ".")));
dl.setAvailable(true);
/**
* If the link is a video it needs other download
* handling
* If the link is a video it needs other download handling
*/
if (id[REGEXSORT.get(1)].trim().matches("\\.(avi|flv|mp4|mpg|rmvb|divx|wmv|mkv)")) dl.setProperty("video", "true");
} else {
@ -367,11 +379,11 @@ public class ChoMikujPl extends PluginForDecrypt {
}
public int getPageCount(final String theParameter) throws NumberFormatException, DecrypterException, IOException {
Browser br2 = br.cloneBrowser();
final Browser br2 = br.cloneBrowser();
prepareBrowser(theParameter, br2);
br.setFollowRedirects(false);
br.getPage(theParameter + ",20000");
final String result = br.getRedirectLocation();
br2.setFollowRedirects(false);
br2.getPage(theParameter + ",20000");
final String result = br2.getRedirectLocation();
if (result == null) {
logger.info("Couldn't find any pages, returning 1");
return 1;

View File

@ -31,6 +31,7 @@ import jd.plugins.Account;
import jd.plugins.CryptedLink;
import jd.plugins.DecrypterPlugin;
import jd.plugins.DownloadLink;
import jd.plugins.FilePackage;
import jd.plugins.PluginForDecrypt;
import jd.plugins.PluginForHost;
import jd.utils.JDUtilities;
@ -107,9 +108,26 @@ public class MdfrFldr extends PluginForDecrypt {
return decryptedLinks;
}
final String[] subFolders = br.getRegex("<folderkey>([a-z0-9]+)</folderkey>").getColumn(0);
apiRequest(this.br, "http://www.mediafire.com/api/folder/get_content.php?folder_key=", folderKey + "&content_type=files");
final String[] files = br.getRegex("<file>(.*?)</file>").getColumn(0);
if ((subFolders == null || subFolders.length == 0) && (files == null || files.length == 0)) {
apiRequest(this.br, "http://www.mediafire.com/api/folder/get_info.php", "?folder_key=" + folderKey);
String fpName = getXML("name", br.toString());
if (fpName == null) fpName = folderKey;
// Decrypt max 100 * 100 = 10 000 links
for (int i = 1; i <= 100; i++) {
apiRequest(this.br, "http://www.mediafire.com/api/folder/get_content.php", "?folder_key=" + folderKey + "&content_type=files&chunk=" + i);
final String[] files = br.getRegex("<file>(.*?)</file>").getColumn(0);
for (final String fileInfo : files) {
final DownloadLink link = createDownloadlink("http://www.mediafire.com/download.php?" + getXML("quickkey", fileInfo));
link.setDownloadSize(SizeFormatter.getSize(getXML("size", fileInfo) + "b"));
link.setName(getXML("filename", fileInfo));
if ("private".equals(getXML("privacy", br.toString()))) {
link.setProperty("privatefile", true);
}
link.setAvailable(true);
decryptedLinks.add(link);
}
if (files == null || files.length < 100) break;
}
if ((subFolders == null || subFolders.length == 0) && (decryptedLinks == null || decryptedLinks.size() == 0)) {
// Probably private folder which can only be decrypted with an active account
if ("114".equals(ERRORCODE)) {
final DownloadLink link = createDownloadlink("http://www.mediafire.com/download.php?" + new Regex(parameter, "([a-z0-9]+)$").getMatch(0));
@ -128,17 +146,10 @@ public class MdfrFldr extends PluginForDecrypt {
decryptedLinks.add(link);
}
}
if (files != null && files.length != 0) {
for (final String fileInfo : files) {
final DownloadLink link = createDownloadlink("http://www.mediafire.com/download.php?" + getXML("quickkey", fileInfo));
link.setDownloadSize(SizeFormatter.getSize(getXML("size", fileInfo) + "b"));
link.setName(getXML("filename", fileInfo));
if ("private".equals(getXML("privacy", br.toString()))) {
link.setProperty("privatefile", true);
}
link.setAvailable(true);
decryptedLinks.add(link);
}
if (fpName != null) {
final FilePackage fp = FilePackage.getInstance();
fp.setName(Encoding.htmlDecode(fpName.trim()));
fp.addLinks(decryptedLinks);
}
return decryptedLinks;
} else {

View File

@ -0,0 +1,69 @@
//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.nutils.encoding.Encoding;
import jd.plugins.CryptedLink;
import jd.plugins.DecrypterPlugin;
import jd.plugins.DownloadLink;
import jd.plugins.FilePackage;
import jd.plugins.PluginForDecrypt;
import org.appwork.utils.formatter.SizeFormatter;
@DecrypterPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "mountfile.net" }, urls = { "http://(www\\.)?mountfile\\.net/d/[A-Za-z0-9]+" }, flags = { 0 })
public class MountFileNetFolder extends PluginForDecrypt {
public MountFileNetFolder(PluginWrapper wrapper) {
super(wrapper);
}
public ArrayList<DownloadLink> decryptIt(CryptedLink param, ProgressController progress) throws Exception {
ArrayList<DownloadLink> decryptedLinks = new ArrayList<DownloadLink>();
final String parameter = param.toString();
br.setFollowRedirects(true);
br.getPage(parameter);
if (br.getURL().equals("http://mountfile.net/")) {
logger.info("Link offline: " + parameter);
return decryptedLinks;
}
String fpName = br.getRegex("<h2 class=\"center\">Download files from folder ([^<>\"]*?)</h2>").getMatch(0);
if (fpName == null) fpName = br.getRegex("<title>Download files from folder ([^<>\"]*?) \\&mdash; Upload").getMatch(0);
final String[][] fileInfo = br.getRegex("\"(/[A-Za-z0-9]+)\" target=\"_blank\">([^<>\"]*?)</a></td>[\t\n\r ]+<td>([^<>\"]*?)</td>").getMatches();
if (fileInfo == null || fileInfo.length == 0) {
logger.warning("Decrypter broken for link: " + parameter);
return null;
}
for (final String linkInfo[] : fileInfo) {
final DownloadLink dl = createDownloadlink("http://mountfile.net" + linkInfo[0]);
dl.setName(linkInfo[1]);
dl.setDownloadSize(SizeFormatter.getSize(linkInfo[2]));
dl.setAvailable(true);
decryptedLinks.add(dl);
}
if (fpName != null) {
final FilePackage fp = FilePackage.getInstance();
fp.setName(Encoding.htmlDecode(fpName.trim()));
fp.addLinks(decryptedLinks);
}
return decryptedLinks;
}
}

View File

@ -20,22 +20,29 @@ import java.util.ArrayList;
import jd.PluginWrapper;
import jd.controlling.ProgressController;
import jd.nutils.encoding.Encoding;
import jd.plugins.CryptedLink;
import jd.plugins.DecrypterPlugin;
import jd.plugins.DownloadLink;
import jd.plugins.DownloadLink.AvailableStatus;
import jd.plugins.FilePackage;
import jd.plugins.PluginForDecrypt;
import jd.plugins.PluginForHost;
import jd.plugins.hoster.SoundcloudCom;
import jd.utils.JDUtilities;
@DecrypterPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "soundcloud.com" }, urls = { "http://(www\\.)?(soundcloud\\.com/(?!you/|tour|signup|logout|login|premium|messages|settings|imprint|community\\-guidelines|videos|terms\\-of\\-use|sounds|jobs|press|mobile|search|upload|people|dashboard)[^<>\"\\']+(\\?format=html\\&page=\\d+|\\?page=\\d+)?|snd\\.sc/[A-Za-z09]+)" }, flags = { 0 })
@DecrypterPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "soundcloud.com" }, urls = { "https?://(www\\.)?(soundcloud\\.com/(?!you/|tour|signup|logout|login|premium|messages|settings|imprint|community\\-guidelines|videos|terms\\-of\\-use|sounds|jobs|press|mobile|search|upload|people|dashboard)[^<>\"\\']+(\\?format=html\\&page=\\d+|\\?page=\\d+)?|snd\\.sc/[A-Za-z09]+)" }, flags = { 0 })
public class SoundCloudComDecrypter extends PluginForDecrypt {
public SoundCloudComDecrypter(PluginWrapper wrapper) {
super(wrapper);
}
private static final String CLIENTID = "b45b1aa10f1ac2941910a7f0d10f8e28";
public ArrayList<DownloadLink> decryptIt(CryptedLink param, ProgressController progress) throws Exception {
ArrayList<DownloadLink> decryptedLinks = new ArrayList<DownloadLink>();
String parameter = param.toString().replaceAll("(/download|\\\\)", "").replace("www.", "");
String parameter = param.toString().replaceAll("(/download|\\\\)", "").replace("www.", "").replace("http://", "https://");
if (parameter.matches("http://(www\\.)?snd\\.sc/[A-Za-z09]+")) {
br.setFollowRedirects(false);
br.getPage(parameter);
@ -53,54 +60,35 @@ public class SoundCloudComDecrypter extends PluginForDecrypt {
if (!decryptList) decryptList = parameter.contains("/groups/");
}
if (decryptList) {
br.getPage(parameter);
if (br.getURL().equals("https://soundcloud.com/login?return_to=%2Fgroups%2Fjoined")) {
logger.info("There is no content to decrypt: " + parameter);
return decryptedLinks;
}
int lastPage = 1;
// only decrypt multiple pages if the user didn't specify and page
// higher than 1
if (parameter.endsWith("page=1") || !parameter.contains("page=")) {
final String maxpage = br.getRegex("class=\"gap\">\\&hellip;</span> <a href=\"[^<>\"]*?page=(\\d+)\"").getMatch(0);
if (maxpage != null) lastPage = Integer.parseInt(maxpage);
}
parameter = parameter.replaceAll("(\\?format=html\\&page=\\d+|\\?page=\\d+)", "");
if (br.containsHTML(">Oops, looks like we can\\'t find that page")) {
final String clientID = jd.plugins.hoster.SoundcloudCom.CLIENTID;
br.getPage("https://api.sndcdn.com/resolve?url=" + Encoding.urlEncode(parameter) + "&_status_code_map%5B302%5D=200&_status_format=json&client_id=" + clientID);
if (br.containsHTML("\"404 \\- Not Found\"")) {
logger.info("Link offline: " + parameter);
return decryptedLinks;
}
if (br.containsHTML(">Favorites<abbr> \\(0\\)") && br.containsHTML(">Sets|<abbr> \\(0\\)") && br.containsHTML(">Tracks<abbr> \\(0\\)")) {
logger.info("Nothing to decrypt from link: " + parameter);
return decryptedLinks;
final PluginForHost hostPlugin = JDUtilities.getPluginForHost("soundcloud.com");
final String fpName = ((SoundcloudCom) hostPlugin).getXML("username", br.toString());
final String userID = br.getRegex("soundcloud\\.com/users/(\\d+)</uri>").getMatch(0);
if (userID == null) {
logger.warning("Decrypter broken for link: " + parameter);
return null;
}
String fpName = br.getRegex("<title>(.*?) on SoundCloud \\- Create, record and share your sounds for free</title>").getMatch(0);
for (int i = 1; i <= lastPage; i++) {
logger.info("Decrypting page " + i + " of " + lastPage);
if (i > 1) br.getPage(parameter + "?page=" + i);
String[] links = br.getRegex("\"(http://soundcloud\\.com/[^\"\\'<>]+)\" property=\"og:song\"").getColumn(0);
if (links == null || links.length == 0) {
links = br.getRegex("class=\"info\"><span>\\d+\\.</span>[\t\n\r ]+<a href=\"(/.*?)\"").getColumn(0);
if (links == null || links.length == 0) {
links = br.getRegex("class=\"action\\-overlay\\-inner\"><a href=\"(/.*?)\"").getColumn(0);
if (links == null || links.length == 0) {
links = br.getRegex("<h3><a href=\"(/.*?)\"").getColumn(0);
}
}
}
String[] playListLinks = br.getRegex("<li class=\"playlist\\-player \"><a href=\"(/[^\"\\'<>]+)(\\?size=large)?\"").getColumn(0);
if ((links == null || links.length == 0) && (playListLinks == null || playListLinks.length == 0)) {
br.getPage("https://api.sndcdn.com/e1/users/" + userID + "/sounds?limit=10000&offset=0&linked_partitioning=1&client_id=" + clientID);
final String[] items = br.getRegex("<stream\\-item>(.*?)</stream\\-item>").getColumn(0);
if (items == null || items.length == 0) {
logger.warning("Decrypter broken for link: " + parameter);
return null;
}
for (final String item : items) {
final String url = ((SoundcloudCom) hostPlugin).getXML("permalink", item);
if (url == null) {
logger.warning("Decrypter broken for link: " + parameter);
return null;
}
if (links != null && links.length != 0) {
for (String sclink : links)
decryptedLinks.add(createDownloadlink("http://soundclouddecrypted.com" + sclink));
}
if (playListLinks != null && playListLinks.length != 0) {
for (String sclink : playListLinks)
decryptedLinks.add(createDownloadlink("http://soundclouddecrypted.com" + sclink));
}
final DownloadLink dl = createDownloadlink(parameter.replace("soundcloud", "soundclouddecrypted") + "/" + url);
final AvailableStatus status = ((SoundcloudCom) hostPlugin).checkStatus(dl, item);
dl.setAvailableStatus(status);
decryptedLinks.add(dl);
}
if (fpName != null) {
FilePackage fp = FilePackage.getInstance();

View File

@ -127,10 +127,11 @@ public class AsFileCom extends PluginForHost {
}
}
long totalReconnectWait = 0;
final String waitMin = br.getRegex("id=\"clock\" class=\"orange\">(\\d+)</span>").getMatch(0);
final String waitMin = br.getRegex("class=\"orange\">(\\d+)</span>[\t\n\r ]+<span id=\"measure\">[\t\n\r ]+minutes").getMatch(0);
if (waitMin != null) totalReconnectWait += Long.parseLong(waitMin) * 60 * 1001l;
final String waitSec = br.getRegex("<span id=\"clock_sec\" class=\"orange\">(\\d+)</span>").getMatch(0);
if (waitSec != null) totalReconnectWait += Long.parseLong(waitSec) * 1001l;
final String waitSec = br.getRegex("class=\"orange\">(\\d+)</span>[\t\n\r ]+<span id=\"measure\">[\t\n\r ]+seconds").getMatch(0);
// waitSe is always there so only add it if we also have minutes
if (waitSec != null && waitMin != null) totalReconnectWait += Long.parseLong(waitSec) * 1001l;
if (totalReconnectWait > 0) throw new PluginException(LinkStatus.ERROR_IP_BLOCKED, totalReconnectWait);
final String fileID = new Regex(downloadLink.getDownloadURL(), "asfile\\.com/file/(.+)").getMatch(0);
final long timeBefore = System.currentTimeMillis();
@ -180,7 +181,7 @@ public class AsFileCom extends PluginForHost {
private void waitTime(long timeBefore, final DownloadLink downloadLink, boolean skip) throws PluginException {
int passedTime = (int) ((System.currentTimeMillis() - timeBefore) / 1000) - 1;
/** Ticket Time */
final String waittime = br.getRegex("class=\"orange\">(\\d+)</span>").getMatch(0);
final String waittime = br.getRegex("class=\"orange\">(\\d+)</span>[\t\n\r ]+<span id=\"measure\">[\t\n\r ]+seconds").getMatch(0);
int wait = 60;
if (waittime != null) wait = Integer.parseInt(waittime);
if (wait > 180) throw new PluginException(LinkStatus.ERROR_IP_BLOCKED, wait * 1001l);
@ -350,7 +351,7 @@ public class AsFileCom extends PluginForHost {
@Override
public int getMaxSimultanFreeDownloadNum() {
return -1;
return 1;
}
@Override

View File

@ -47,6 +47,10 @@ public class FileShareInUa extends PluginForHost {
this.enablePremium("http://fileshare.in.ua/premium.aspx");
}
public void correctDownloadLink(DownloadLink link) {
link.setUrlDownload(link.getDownloadURL().replace("www.fileshare.in.ua/", "fileshare.in.ua/"));
}
@Override
public AccountInfo fetchAccountInfo(Account account) throws Exception {
AccountInfo ai = new AccountInfo();
@ -107,6 +111,7 @@ public class FileShareInUa extends PluginForHost {
// Some countries got captchas
br.postPage(downloadLink.getDownloadURL(), "post2=1");
if (br.containsHTML("(Файл удален|К сожалению, cсылка на этот файл не больше не действительна и запрашиваемый файл отсутствует на сервер)")) throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
if (br.getURL().equals(downloadLink.getDownloadURL())) throw new PluginException(LinkStatus.ERROR_FATAL, "Site is broken, please contact the fileshare.in.ua support!");
String captchapart = br.getRegex("\"(/capture\\.gif\\?m=\\d+)\"").getMatch(0);
if (captchapart == null) captchapart = br.getRegex("<img height=\"18\" align=\"absmiddle\" src=\"(/.*?)\"").getMatch(0);
Form captchaForm = getFormWhichContainsHTML("capture");

View File

@ -1,133 +0,0 @@
//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.config.Property;
import jd.http.Browser;
import jd.http.URLConnectionAdapter;
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.Plugin;
import jd.plugins.PluginException;
import jd.plugins.PluginForHost;
import org.appwork.utils.formatter.SizeFormatter;
@HostPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "freeuploads.fr" }, urls = { "https?://(www\\.)?(freeuploads\\.fr|uploa\\.dk)/\\?(v|d)=\\d+" }, flags = { 0 })
public class FreeUploadsFf extends PluginForHost {
// DEV NOTES:
// protocol: no https
// free: resumes, one chunk, unlimited connections?
// captchatype: null
public FreeUploadsFf(PluginWrapper wrapper) {
super(wrapper);
}
@Override
public void correctDownloadLink(final DownloadLink link) throws Exception {
link.setUrlDownload(link.getDownloadURL().replaceAll("s?://(freeuploads\\.fr|uploa\\.dk)/\\?(v|d)=", "://www.freeuploads.fr/?d="));
}
@Override
public String getAGBLink() {
return "http://www.freeuploads.fr";
}
@Override
public AvailableStatus requestFileInformation(DownloadLink link) throws IOException, PluginException {
this.setBrowserExclusive();
br.setFollowRedirects(false);
br.setCookie("http://www.freeuploads.fr/", "lang", "en");
br.getPage(link.getDownloadURL());
if (br.containsHTML("(?i)>This video may have been deleted or you\\'re using an invalid link\\.<")) throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
String filename = br.getRegex("(?i)id=\"download\">[\r\n\t ]+<h2>([^<>\"]+)</h2>").getMatch(0);
if (filename == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
String filesize = br.getRegex("(?i)Size:?</b> ([\\d\\.]+ ?(GB|MB))").getMatch(0);
link.setName(filename.trim());
if (filesize != null) link.setDownloadSize(SizeFormatter.getSize(filesize));
return AvailableStatus.TRUE;
}
@Override
public int getMaxSimultanFreeDownloadNum() {
return -1;
}
@Override
public void handleFree(DownloadLink downloadLink) throws Exception, PluginException {
requestFileInformation(downloadLink);
String passCode = null;
String dllink = downloadLink.getStringProperty("freelink");
if (dllink != null) {
try {
Browser br2 = br.cloneBrowser();
URLConnectionAdapter con = br2.openGetConnection(dllink);
if (con.getContentType().contains("html") || con.getLongContentLength() == -1) {
downloadLink.setProperty("freelink", Property.NULL);
dllink = null;
}
con.disconnect();
} catch (Exception e) {
downloadLink.setProperty("freelink", Property.NULL);
dllink = null;
}
}
Form passForm = br.getFormbyProperty("name", "filepassword");
if (passForm != null) {
logger.info("FreeUploads: Download seems to be password protected!");
for (int i = 0; i <= 5; i++) {
passCode = downloadLink.getStringProperty("pass", null);
if (passCode == null) passCode = Plugin.getUserInput("FreeUploads.fr: Download password protected!", downloadLink);
passForm.put("pass", Encoding.urlEncode(passCode));
br.submitForm(passForm);
if (br.containsHTML(">Wrong Password<"))
continue;
else
break;
}
}
if (dllink == null) {
dllink = br.getRegex("(?i)(https?://[\\w\\-\\.]+freeuploads\\.fr/download/\\w+/[^\">]+)").getMatch(0);
if (dllink == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
}
dl = jd.plugins.BrowserAdapter.openDownload(br, downloadLink, dllink, true, 1);
if (dl.getConnection().getContentType().contains("html")) {
br.followConnection();
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
}
downloadLink.setProperty("freelink", dllink);
dl.startDownload();
}
@Override
public void reset() {
}
@Override
public void resetDownloadlink(DownloadLink link) {
}
}

View File

@ -87,7 +87,7 @@ public class FreeUploadsFr extends PluginForHost {
dl = jd.plugins.BrowserAdapter.openDownload(br, downloadLink, finalLink, false, 1);
if (dl.getConnection().getContentType().contains("html")) {
br.followConnection();
if (br.containsHTML(">404 Not Found<")) throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Server error", 60 * 60 * 1000l);
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);
}

View File

@ -357,7 +357,7 @@ public class IFileIt extends PluginForHost {
ai.setStatus("Normal User");
account.setProperty("typ", "free");
try {
maxPrem.set(2);
maxPrem.set(1);
// free accounts can still have captcha.
account.setMaxSimultanDownloads(maxPrem.get());
account.setConcurrentUsePossible(false);

View File

@ -0,0 +1,126 @@
//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.File;
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;
import jd.utils.JDUtilities;
import org.appwork.utils.formatter.SizeFormatter;
@HostPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "mountfile.net" }, urls = { "http://(www\\.)?mountfile\\.net/(?!d/)[A-Za-z0-9]+" }, flags = { 0 })
public class MountFileNet extends PluginForHost {
public MountFileNet(PluginWrapper wrapper) {
super(wrapper);
}
@Override
public String getAGBLink() {
return "http://mountfile.net/terms/";
}
@Override
public AvailableStatus requestFileInformation(final DownloadLink link) throws IOException, PluginException {
this.setBrowserExclusive();
br.setFollowRedirects(true);
br.getPage(link.getDownloadURL());
if (br.containsHTML(">File not found<")) throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
final Regex fileInfo = br.getRegex("<h2 style=\"margin:0\">([^<>\"]*?)</h2>[\t\n\r ]+<div class=\"comment\">([^<>\"]*?)</div>");
final String filename = fileInfo.getMatch(0);
final String filesize = fileInfo.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));
return AvailableStatus.TRUE;
}
@Override
public void handleFree(final DownloadLink downloadLink) throws Exception, PluginException {
requestFileInformation(downloadLink);
// First, bring up saved final links
final String fid = new Regex(downloadLink.getDownloadURL(), "([A-Za-z0-9]+)$").getMatch(0);
br.postPage(br.getURL(), "free=Slow+download&hash=" + fid);
final String rcID = br.getRegex("Recaptcha\\.create\\(\\'([^<>\"]*?)\\'").getMatch(0);
if (rcID == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
final long timeBefore = System.currentTimeMillis();
final PluginForHost recplug = JDUtilities.getPluginForHost("DirectHTTP");
final jd.plugins.hoster.DirectHTTP.Recaptcha rc = ((DirectHTTP) recplug).getReCaptcha(br);
rc.setId(rcID);
rc.load();
for (int i = 1; i <= 5; i++) {
final File cf = rc.downloadCaptcha(getLocalCaptchaFile());
final String c = getCaptchaCode(cf, downloadLink);
// Waittime can be skipped
// if (i == 1) waitTime(timeBefore, downloadLink);
br.postPage(br.getURL(), "free=Get+download+link&hash=" + fid + "&recaptcha_challenge_field=" + rc.getChallenge() + "&recaptcha_response_field=" + Encoding.urlEncode(c));
final String reconnectWait = br.getRegex("You should wait (\\d+) minutes before downloading next file").getMatch(0);
if (reconnectWait != null) throw new PluginException(LinkStatus.ERROR_IP_BLOCKED, Integer.parseInt(reconnectWait) * 60 * 1001l);
if (br.containsHTML("Recaptcha\\.create\\(\\'")) {
rc.reload();
continue;
}
break;
}
if (br.containsHTML("Recaptcha\\.create\\(\\'")) throw new PluginException(LinkStatus.ERROR_CAPTCHA);
String dllink = br.getRegex("\"(http://d\\d+\\.mountfile.net/[^<>\"]*?)\"").getMatch(0);
if (dllink == null) dllink = br.getRegex("<div style=\"margin: 10px auto 20px\" class=\"center\">[\t\n\r ]+<a href=\"(http://[^<>\"]*?)\"").getMatch(0);
if (dllink == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
downloadLink.setProperty("ServerComaptibleForByteRangeRequest", false);
dl = jd.plugins.BrowserAdapter.openDownload(br, downloadLink, dllink, false, 1);
if (dl.getConnection().getContentType().contains("html")) {
br.followConnection();
if (br.containsHTML("not found")) throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Server error", 10 * 60 * 1000l);
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
}
dl.startDownload();
}
private void waitTime(long timeBefore, final DownloadLink downloadLink) throws PluginException {
int passedTime = (int) ((System.currentTimeMillis() - timeBefore) / 1000) - 1;
/** Ticket Time */
int wait = 60;
final String ttt = br.getRegex("var sec = (\\d+)").getMatch(0);
if (ttt != null) wait = Integer.parseInt(ttt);
wait -= passedTime;
if (wait > 0) sleep(wait * 1000l, downloadLink);
}
@Override
public void reset() {
}
@Override
public int getMaxSimultanFreeDownloadNum() {
return 1;
}
@Override
public void resetDownloadlink(final DownloadLink link) {
}
}

View File

@ -71,8 +71,7 @@ public class OteUploadCom extends PluginForHost {
// DEV NOTES
/**
* Script notes: Streaming versions of this script sometimes redirect you to
* their directlinks when accessing this link + the link ID:
* 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.7.4
@ -341,19 +340,14 @@ public class OteUploadCom extends PluginForHost {
}
/**
* 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.
* 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.
* 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)
@ -683,6 +677,7 @@ public class OteUploadCom extends PluginForHost {
return;
}
}
br.setFollowRedirects(true);
getPage(COOKIE_HOST + "/login.html");
final Form loginform = br.getFormbyProperty("name", "FL");
if (loginform == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);

View File

@ -17,8 +17,11 @@
package jd.plugins.hoster;
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.plugins.DownloadLink;
import jd.plugins.DownloadLink.AvailableStatus;
import jd.plugins.HostPlugin;
@ -27,9 +30,7 @@ import jd.plugins.PluginException;
import jd.plugins.PluginForHost;
import jd.utils.locale.JDL;
import org.appwork.utils.formatter.SizeFormatter;
@HostPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "soundcloud.com" }, urls = { "http://(www\\.)?soundclouddecrypted\\.com/[a-z\\-_0-9]+/[a-z\\-_0-9]+" }, flags = { 0 })
@HostPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "soundcloud.com" }, urls = { "https://(www\\.)?soundclouddecrypted\\.com/[a-z\\-_0-9]+/[a-z\\-_0-9]+" }, flags = { 0 })
public class SoundcloudCom extends PluginForHost {
private String url;
@ -38,6 +39,8 @@ public class SoundcloudCom extends PluginForHost {
super(wrapper);
}
public final static String CLIENTID = "b45b1aa10f1ac2941910a7f0d10f8e28";
public void correctDownloadLink(DownloadLink link) {
link.setUrlDownload(link.getDownloadURL().replace("soundclouddecrypted", "soundcloud"));
}
@ -53,50 +56,93 @@ public class SoundcloudCom extends PluginForHost {
}
@Override
public void handleFree(DownloadLink link) throws Exception {
public void handleFree(final DownloadLink link) throws Exception {
requestFileInformation(link);
dl = jd.plugins.BrowserAdapter.openDownload(br, link, url, 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();
}
@Override
public AvailableStatus requestFileInformation(DownloadLink parameter) throws Exception {
public AvailableStatus requestFileInformation(final DownloadLink parameter) throws Exception {
this.setBrowserExclusive();
br.getPage(parameter.getDownloadURL());
if (br.containsHTML("Oops, looks like we can\\'t find that page")) throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
String filename = br.getRegex("<em>(.*?)</em>").getMatch(0);
br.setFollowRedirects(true);
if (filename == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
String username = br.getRegex("\"username\":\"(.*?)\"").getMatch(0);
filename = Encoding.htmlDecode(filename.trim());
String type = br.getRegex("title=\"Uploaded format\">(.*?)<").getMatch(0);
if (type == null) {
type = br.getRegex("class=\"file\\-type\">(.*?)</span>").getMatch(0);
if (type == null) type = "mp3";
url = parameter.getStringProperty("directlink");
if (url != null) {
checkDirectLink(parameter, url);
if (url != null) return AvailableStatus.TRUE;
}
br.getPage("https://api.sndcdn.com/resolve?url=" + Encoding.urlEncode(parameter.getDownloadURL()) + "&_status_code_map%5B302%5D=200&_status_format=json&client_id=" + CLIENTID);
if (br.containsHTML("\"404 \\- Not Found\"")) throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
AvailableStatus status = checkStatus(parameter, this.br.toString());
if (status.equals(AvailableStatus.FALSE)) throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
if (url == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
checkDirectLink(parameter, url);
return AvailableStatus.TRUE;
}
public AvailableStatus checkStatus(final DownloadLink parameter, final String source) {
String filename = getXML("title", source);
if (filename == null) {
parameter.getLinkStatus().setStatusText(JDL.L("plugins.hoster.SoundCloudCom.status.pluginBroken", "The host plugin is broken!"));
return AvailableStatus.FALSE;
}
final String filesize = getXML("original-content-size", source);
if (filesize != null) parameter.setDownloadSize(Integer.parseInt(filesize));
final String description = getXML("description", source);
if (description != null) parameter.setComment(description);
String username = getXML("username", source);
filename = Encoding.htmlDecode(filename.trim());
String type = getXML("original-format", source);
if (type == null) type = "mp3";
username = username.trim();
if (username != null && !filename.contains(username)) filename += " - " + username;
filename += "." + type;
if (!br.containsHTML("class=\"download pl\\-button\"")) {
String[] data = br.getRegex("\"uid\":\"(.*?)\".*?\"token\":\"(.*?)\"").getRow(0);
url = "http://media.soundcloud.com/stream/" + data[0] + "?stream_token=" + data[1];
URLConnectionAdapter con = br.openGetConnection(url);
if (!con.getContentType().contains("html"))
parameter.setDownloadSize(con.getLongContentLength());
else
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
con.disconnect();
parameter.getLinkStatus().setStatusText(JDL.L("plugins.hoster.SoundCloudCom.status.previewavailable", "Preview is downloadable"));
} else {
String filesize = br.getRegex("The file you're about to download has a size of (.*?)\"").getMatch(0);
if (filesize != null) parameter.setDownloadSize(SizeFormatter.getSize(filesize));
url = parameter.getDownloadURL() + "/download";
url = getXML("download-url", source);
if (url != null) {
parameter.getLinkStatus().setStatusText(JDL.L("plugins.hoster.SoundCloudCom.status.downloadavailable", "Original file is downloadable"));
} else {
url = getXML("stream-url", source);
parameter.getLinkStatus().setStatusText(JDL.L("plugins.hoster.SoundCloudCom.status.previewavailable", "Preview (Stream) is downloadable"));
}
if (url == null) {
parameter.getLinkStatus().setStatusText(JDL.L("plugins.hoster.SoundCloudCom.status.pluginBroken", "The host plugin is broken!"));
return AvailableStatus.FALSE;
}
parameter.setFinalFileName(filename);
parameter.setProperty("directlink", url + "?client_id=" + CLIENTID);
return AvailableStatus.TRUE;
}
private void checkDirectLink(final DownloadLink downloadLink, final String property) {
try {
Browser br2 = br.cloneBrowser();
URLConnectionAdapter con = br2.openGetConnection(url);
if (con.getContentType().contains("html") || con.getLongContentLength() == -1) {
downloadLink.setProperty(property, Property.NULL);
url = null;
return;
}
downloadLink.setDownloadSize(con.getLongContentLength());
con.disconnect();
} catch (Exception e) {
downloadLink.setProperty(property, Property.NULL);
url = null;
}
}
private String getJson(final String parameter) {
return br.getRegex("\"" + parameter + "\":\"([^<>\"]*?)\"").getMatch(0);
}
public String getXML(final String parameter, final String source) {
return new Regex(source, "<" + parameter + "( type=\"[^<>\"/]*?\")?>([^<>\"]*?)</" + parameter + ">").getMatch(1);
}
@Override
public void reset() {
}

View File

@ -21,6 +21,8 @@ import java.util.HashMap;
import java.util.Map;
import jd.PluginWrapper;
import jd.config.ConfigContainer;
import jd.config.ConfigEntry;
import jd.config.Property;
import jd.controlling.AccountController;
import jd.http.Browser;
@ -38,18 +40,21 @@ import jd.plugins.HostPlugin;
import jd.plugins.LinkStatus;
import jd.plugins.PluginException;
import jd.plugins.PluginForHost;
import jd.utils.locale.JDL;
//Links are coming from a decrypter
@HostPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "vkontakte.ru" }, urls = { "http://vkontaktedecrypted\\.ru/picturelink/(\\-)?\\d+_\\d+(\\?tag=\\d+)?" }, flags = { 2 })
public class VKontakteRuHoster extends PluginForHost {
private static final String DOMAIN = "http://vk.com";
private static Object LOCK = new Object();
private String FINALLINK = null;
private static final String DOMAIN = "http://vk.com";
private static Object LOCK = new Object();
private String FINALLINK = null;
private final String USECOOKIELOGIN = "USECOOKIELOGIN";
public VKontakteRuHoster(PluginWrapper wrapper) {
super(wrapper);
this.enablePremium();
setConfigElements();
}
@Override
@ -160,7 +165,11 @@ public class VKontakteRuHoster extends PluginForHost {
public AccountInfo fetchAccountInfo(final Account account) throws Exception {
AccountInfo ai = new AccountInfo();
try {
login(br, account, true);
if (this.getPluginConfig().getBooleanProperty(USECOOKIELOGIN, false)) {
login(br, account, false);
} else {
login(br, account, true);
}
} catch (PluginException e) {
account.setValid(false);
return ai;
@ -239,6 +248,10 @@ public class VKontakteRuHoster extends PluginForHost {
}
}
public void setConfigElements() {
getConfig().addEntry(new ConfigEntry(ConfigContainer.TYPE_CHECKBOX, getPluginConfig(), USECOOKIELOGIN, JDL.L("plugins.hoster.vkontakteruhoster.alwaysUseCookiesForLogin", "Always use cookies for login (this can cause out of date errors)")).setDefaultValue(false));
}
@Override
public int getMaxSimultanPremiumDownloadNum() {
return -1;