View Single Post
  #3  
Old 13.12.2011, 21:41
fcpt
Guest
 
Posts: n/a
Default

Thanks for the help,
This is my working code I will like to share. Change it as you see fit.

decrypter:(src/jd/plugins/decrypter/MltpldCm.java)
REPLACE:
Code:
        String directMultiuploadLink = br.getRegex("<div id=\"downloadbutton_\" style=\".*?><a href=\"(.*?)\"").getMatch(0);
        if (directMultiuploadLink == null) directMultiuploadLink = br.getRegex("\"(http://[a-z0-9]+\\.multiupload\\.com:[0-9]+/files/[A-Za-z0-9]{40,}/.*?)\"").getMatch(0);
        if (directMultiuploadLink != null) decryptedLinks.add(createDownloadlink("direct**External links are only visible to Support Staff** + directMultiuploadLink));
WITH:
Code:
		if (br.containsHTML("<div[^>]+id=\"downloadbutton_\""))
			decryptedLinks.add(createDownloadlink(parameter.replaceFirst("http", "httpMltpldCm")));

hoster:(src/jd/plugins/hoster/MltpldCm.java)
Code:
package jd.plugins.hoster;

import java.io.IOException;

import jd.PluginWrapper;
import jd.http.URLConnectionAdapter;
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 org.appwork.utils.formatter.SizeFormatter;

@HostPlugin(revision = "$Revision: 0 $", interfaceVersion = 2, names = { "multiupload.com" }, urls = { "httpMltpldCm://[\\w\\.]*?multiupload\\.com/([A-Z0-9]{2}_[A-Z0-9]+|[0-9A-Z]+)" }, flags = { 0 })
public class MltpldCm extends PluginForHost {

	public MltpldCm(PluginWrapper wrapper) {
		super(wrapper);
	}

	@Override
	public String getAGBLink() {
		return "**External links are only visible to Support Staff**;
	}

	@Override
	public void correctDownloadLink(final DownloadLink link) throws Exception {
		link.setUrlDownload(link.getDownloadURL().replaceFirst("httpMltpldCm", "http"));
	}

	@Override
	public AvailableStatus requestFileInformation(DownloadLink link) throws IOException, PluginException {
		this.setBrowserExclusive();
		br.getPage(link.getDownloadURL());
		if (!br.containsHTML("<div[^>]+id=\"downloadbutton_\""))
			throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
		Regex match = br.getRegex("<font[^>]+>\\(([\\d\\.]+\\s+[kmg]?b)\\)<.*?\\('dlbutton'\\)\\.href='[^']+/files/[0-9A-F]+/([^']+)'");
		if (match.count() > 0) {
			link.setDownloadSize(SizeFormatter.getSize(match.getMatch(0)));
			link.setFinalFileName(match.getMatch(1).trim());
		} else
			throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
		return AvailableStatus.TRUE;
	}

	@Override
	public void handleFree(DownloadLink link) throws Exception {
		requestFileInformation(link);
		String url = br.getRegex("\\('dlbutton'\\)\\.href='([^']+)'").getMatch(0);
		br.setFollowRedirects(true);
		dl = jd.plugins.BrowserAdapter.openDownload(br, link, url, true, 1);
		URLConnectionAdapter urlConnection = dl.getConnection();
		if (!urlConnection.isContentDisposition() && urlConnection.getHeaderField("Cache-Control") != null) {
			urlConnection.disconnect();
			throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, 10 * 60 * 1000l);
		}
		this.dl.startDownload();
	}

	@Override
	public void reset() {
	}

	@Override
	public void resetDownloadlink(DownloadLink link) {
	}

}

Last edited by fcpt; 13.12.2011 at 21:44.
Reply With Quote