-Added a new decrypter closes #3952

-Added support for saveufile closes #3893

git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@15402 ebf7c1c2-ba36-0410-9fe8-c592906822b4
This commit is contained in:
psp 2011-12-02 12:55:16 +00:00
parent 26203fa9ec
commit dbaf81175a
3 changed files with 166 additions and 1 deletions

View File

@ -1,4 +1,4 @@
<jDownloader>
<method name="filesavr.com" author="DwD" services="linkprotect.in;filedropper.com;hides.at"/>
<method name="filesavr.com" author="DwD" services="linkprotect.in;filedropper.com;hides.at;saveufile.in.th"/>
<format type="png" letterNum="4" />
</jDownloader>

View File

@ -0,0 +1,57 @@
//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;
@DecrypterPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "imgbox.com" }, urls = { "http://(www\\.)?imgbox\\.com/g/[A-Za-z0-9]+" }, flags = { 0 })
public class ImgBoxCom extends PluginForDecrypt {
public ImgBoxCom(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);
final String fpName = br.getRegex("<h1 style=\"padding\\-left:15px;\">(.*?)</h1>").getMatch(0);
final String[] links = br.getRegex("\"(http://t\\.imgbox\\.com/.*?)\"").getColumn(0);
if (links == null || links.length == 0) {
logger.warning("Decrypter broken for link: " + parameter);
return null;
}
for (String singleLink : links)
decryptedLinks.add(createDownloadlink("directhttp://" + singleLink.replace("t.imgbox.com/", "o.imgbox.com/")));
if (fpName != null) {
FilePackage fp = FilePackage.getInstance();
fp.setName(Encoding.htmlDecode(fpName.trim()));
fp.addLinks(decryptedLinks);
}
return decryptedLinks;
}
}

View File

@ -0,0 +1,108 @@
//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.Regex;
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 = { "saveufile.in.th" }, urls = { "http://(www\\.)?saveufile\\.(in\\.th|com)/car\\.php\\?file=[a-z0-9]+" }, flags = { 0 })
public class SaveuFileInTh extends PluginForHost {
public SaveuFileInTh(PluginWrapper wrapper) {
super(wrapper);
}
@Override
public String getAGBLink() {
return "http://www.saveufile.com/service.php";
}
/**
* Important: Hoster is (sometimes) only accessible in Thailand (ur using a
* working proxy)
*/
@Override
public AvailableStatus requestFileInformation(DownloadLink link) throws IOException, PluginException {
this.setBrowserExclusive();
br.setFollowRedirects(true);
br.getPage(link.getDownloadURL());
if (br.containsHTML("(File not found\\.|<title>ฝากไฟล์ , อัพโหลด โดย </title>)")) throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
Regex fInfo = br.getRegex("<title>ฝากไฟล์ (.*?), อัพโหลด (.*?) โดย ");
if (fInfo.getMatch(0) == null || fInfo.getMatch(1) == null) fInfo = br.getRegex("<h3 style=\"font\\-size: 14px; margin\\-bottom: 10px;\">ฝากไฟล์ (.*?), อัพโหลด (.*?) โดย ");
String filename = fInfo.getMatch(0);
String filesize = fInfo.getMatch(1);
if (filename == null || filesize == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
/** Set final filename here because server sometimes sends bad names */
link.setFinalFileName(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);
Form dlForm = br.getFormbyProperty("id", "form_download");
if (dlForm == null) dlForm = br.getForm(0);
String captchalink = br.getRegex("</h3><div><img src=\"(s.*?)\"").getMatch(0);
if (captchalink == null) captchalink = br.getRegex("\"(securimage/securimage_show\\.php\\?sid=[a-z0-9]+)\"").getMatch(0);
if (dlForm == null || captchalink == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
int wait = 0;
String waittime = br.getRegex("var bnyme = (\\d+);").getMatch(0);
if (waittime != null) wait = Integer.parseInt(waittime);
sleep(wait * 1001l, downloadLink);
final String code = getCaptchaCode(captchalink, downloadLink);
dlForm.put("code", code);
br.submitForm(dlForm);
if (br.containsHTML("IP นี้เป็นของต่างประเทศ ไม่สามารถดาวน์โหลดไฟล์ได้ ติดต่อสอบถามได้ทาง")) throw new PluginException(LinkStatus.ERROR_FATAL, "Download only possible through tai IP adress.");
String dllink = br.getRedirectLocation();
if (dllink == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
if (dllink.contains("saveufile.in.th/car.php?file=")) throw new PluginException(LinkStatus.ERROR_CAPTCHA);
dl = jd.plugins.BrowserAdapter.openDownload(br, downloadLink, dllink, 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 5;
}
@Override
public void resetDownloadlink(DownloadLink link) {
}
}