Created
November 28, 2010 14:25
-
-
Save youpy/718970 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.Account; | |
import jd.plugins.AccountInfo; | |
import jd.plugins.DownloadLink; | |
import jd.plugins.HostPlugin; | |
import jd.plugins.LinkStatus; | |
import jd.plugins.PluginException; | |
import jd.plugins.PluginForHost; | |
import jd.plugins.DownloadLink.AvailableStatus; | |
@HostPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "firestorage.jp" }, urls = { "http://[\\w\\.]*?(firestorage\\.jp/download|xfs\\.jp)/.*" }, flags = { 2 }) | |
public class FireStorageJp extends PluginForHost { | |
public FireStorageJp(PluginWrapper wrapper) { | |
super(wrapper); | |
} | |
@Override | |
public String getAGBLink() { | |
return "http://firestorage.jp/jpdoc/agreement.html"; | |
} | |
public boolean nopremium = true; | |
@Override | |
public AvailableStatus requestFileInformation(DownloadLink downloadLink) throws IOException, PluginException { | |
this.setBrowserExclusive(); | |
br.setFollowRedirects(true); | |
br.getPage(downloadLink.getDownloadURL()); | |
if(br.containsHTML("xfsCommit")) { | |
br.getPage(br.getRegex(">(http://firestorage\\.jp/download/[0-9a-z]+)<").getMatch(0)); | |
} | |
if (br.containsHTML("/images/delete.gif")) throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND); | |
String filename = br.getRegex("id=\"downloadlink\">(.+?)</a>").getMatch(0); | |
String filesize = br.getRegex("</a> ([0-9]+)").getMatch(0); | |
if (filename == null || filesize == null || filename.trim().equals("")) throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND); | |
downloadLink.setName(filename); | |
downloadLink.setDownloadSize(Regex.getSize(filesize.replaceAll(",", ""))); | |
return AvailableStatus.TRUE; | |
} | |
@Override | |
public void handleFree(DownloadLink downloadLink) throws Exception { | |
requestFileInformation(downloadLink); | |
br.getPage(downloadLink.getDownloadURL()); | |
if(br.containsHTML("xfsCommit")) { | |
br.getPage(br.getRegex(">(http://firestorage\\.jp/download/[0-9a-z]+)<").getMatch(0)); | |
} | |
String dlUrl = br.getRegex("([^\"]+)\" id=\"downloadlink\"").getMatch(0); | |
dl = jd.plugins.BrowserAdapter.openDownload(br, downloadLink, dlUrl, true, 1); | |
// Möglicherweise serverfehler... | |
if (!dl.getConnection().isContentDisposition() || dl.getConnection().getContentType().contains("html")) { | |
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND); | |
} | |
dl.startDownload(); | |
} | |
@Override | |
public int getMaxSimultanFreeDownloadNum() { | |
return -1; | |
} | |
@Override | |
public void reset() { | |
} | |
@Override | |
public void resetPluginGlobals() { | |
} | |
@Override | |
public void resetDownloadlink(DownloadLink link) { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment