mirror of
https://github.com/mirror/jdownloader.git
synced 2024-11-24 04:29:54 +00:00
Plugin: getFileNameFromDispositionHeader TokenEncoding Support für Base64 added (zb Zippyshare)
Zippyshare: little redesign git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@4146 ebf7c1c2-ba36-0410-9fe8-c592906822b4
This commit is contained in:
parent
65415d3cea
commit
71a6519719
@ -62,12 +62,12 @@ public class header {
|
||||
// System.out.println("Right Java Version");
|
||||
// }
|
||||
// }
|
||||
if (false) {
|
||||
if (true) {
|
||||
// System.out.println(new Regex(
|
||||
// "<p style=\"color:red;\">You have reached the download limit for free-users. Would you like more?</p>"
|
||||
// , ".*download.{0,3}limit.{1,50}free.{0,3}users.*").matches() +
|
||||
// "");
|
||||
String l[] = { "filename==?UTF-8?B?WmZyIFByb2plY3QgLSBBZGRpY3RlZCBNZiAoT3JpZ2luYWwgTWl4KS0tLXd3dy50ZWNobm9yb2NrZXIuaW5mby5tcDM=?=" };
|
||||
String l[] = {"filename= \"=?UTF-8?B?WmZyIFByb2plY3QgLSBBZGRpY3RlZCBNZiAoT3JpZ2luYWwgTWl4KS0tLXd3dy50ZWNobm9yb2NrZXIuaW5mby5tcDM=?=\"","filename==?UTF-8?B?YWlhZGNhZGlnMWR4bi5wYXJ0Mi5yYXI=?=" };
|
||||
// String l[] = {
|
||||
// "filename==?UTF-8?B?WmZyIFByb2plY3QgLSBBZGRpY3RlZCBNZiAoT3JpZ2luYWwgTWl4KS0tLXd3dy50ZWNobm9yb2NrZXIuaW5mby5tcDM=?="
|
||||
// ,
|
||||
@ -104,13 +104,16 @@ public class header {
|
||||
System.out.println(Plugin.getFileNameFromDispositionHeader(kk));
|
||||
}
|
||||
}
|
||||
// String k = "Test : ö & üä ! \" § $ & / ( ) = ? ~ ^ ° ¬æ " + Encoding.urlEncode("%");
|
||||
// System.out.println(k);
|
||||
// System.out.println((k = Encoding.urlEncode_light(k)));
|
||||
// System.out.println((k = Encoding.urlEncode_light(k)));
|
||||
// System.out.println(Encoding.urlDecode(k, false));
|
||||
System.out.println(new Regex("http://ftp.fernuni-hagen.de/ftp-dir/pub/mirrors/www.openoffice.org/localized/de/3.0.0/OOo_3.0.0_Win32Intel_install_de.exe","httpviajd://[\\w\\.:-]*/.*?\\.(3gp|7z|aif|aiff|aifc|au|avi|bin|bz2|ccf|cue|divx|dlc|doc|docx|dot|exe|flv|gif|gz|iso|java|jpg|jpeg|mkv|mp2|mp3|mp4|mov|movie|mpe|mpeg|mpg|png|pdf|ppt|pptx|pps|ppz|pot|qt|rar|rsdf|rtf|snd|tar|tif|tiff|viv|vivo|wav|wmv|xla|xls|zip)").getMatch(-1));
|
||||
System.out.println(HTMLParser.getHttpLinkList("httpviajd://ftp.fernuni-hagen.de/ftp-dir/pub/mirrors/www.openoffice.org/localized/de/3.0.0/OOo_3.0.0_Win32Intel_install_de.exe"));
|
||||
// String k = "Test : ö & üä ! \" § $ & / ( ) = ? ~ ^ ° ¬æ " +
|
||||
// Encoding.urlEncode("%");
|
||||
// System.out.println(k);
|
||||
// System.out.println((k = Encoding.urlEncode_light(k)));
|
||||
// System.out.println((k = Encoding.urlEncode_light(k)));
|
||||
// System.out.println(Encoding.urlDecode(k, false));
|
||||
if (false) {
|
||||
System.out.println(new Regex("http://ftp.fernuni-hagen.de/ftp-dir/pub/mirrors/www.openoffice.org/localized/de/3.0.0/OOo_3.0.0_Win32Intel_install_de.exe", "httpviajd://[\\w\\.:-]*/.*?\\.(3gp|7z|aif|aiff|aifc|au|avi|bin|bz2|ccf|cue|divx|dlc|doc|docx|dot|exe|flv|gif|gz|iso|java|jpg|jpeg|mkv|mp2|mp3|mp4|mov|movie|mpe|mpeg|mpg|png|pdf|ppt|pptx|pps|ppz|pot|qt|rar|rsdf|rtf|snd|tar|tif|tiff|viv|vivo|wav|wmv|xla|xls|zip)").getMatch(-1));
|
||||
System.out.println(HTMLParser.getHttpLinkList("httpviajd://ftp.fernuni-hagen.de/ftp-dir/pub/mirrors/www.openoffice.org/localized/de/3.0.0/OOo_3.0.0_Win32Intel_install_de.exe"));
|
||||
}
|
||||
//
|
||||
// System.out.println(Encoding.urlEncode(
|
||||
// "http://srv2.shragle.com/dl/free/UjdV0050/Der König der Löwen.part1.rar?v=1"
|
||||
|
@ -22,7 +22,6 @@ import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URL;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.ArrayList;
|
||||
@ -348,7 +347,7 @@ public abstract class Plugin implements ActionListener {
|
||||
String filename = null;
|
||||
for (int i = 0; i < 2; i++) {
|
||||
if (contentdisposition.contains("filename*")) {
|
||||
/* Codierung */
|
||||
/* Codierung default */
|
||||
contentdisposition = contentdisposition.replaceAll("filename\\*", "filename");
|
||||
String format = new Regex(contentdisposition, ".*?=[ \"']*(.+)''").getMatch(0);
|
||||
if (format == null) {
|
||||
@ -366,7 +365,23 @@ public abstract class Plugin implements ActionListener {
|
||||
} else {
|
||||
try {
|
||||
filename = URLDecoder.decode(filename, format);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
} catch (Exception e) {
|
||||
logger.severe("Content-Disposition: could not decode filename: " + header);
|
||||
filename = null;
|
||||
return filename;
|
||||
}
|
||||
}
|
||||
} else if (new Regex(contentdisposition, "=\\?.*?\\?.*?\\?.*?\\?=").matches()) {
|
||||
/*
|
||||
* Codierung Encoded Words, TODO: Q-Encoding und mehrfach
|
||||
* tokens, aber noch nicht in freier Wildbahn gesehen
|
||||
*/
|
||||
String tokens[][] = new Regex(contentdisposition, "=\\?(.*?)\\?(.*?)\\?(.*?)\\?=").getMatches();
|
||||
if (tokens.length == 1 && tokens[0].length == 3 && tokens[0][1].trim().equalsIgnoreCase("B")) {
|
||||
/* Base64 Encoded */
|
||||
try {
|
||||
filename = URLDecoder.decode(Encoding.Base64Decode(tokens[0][2].trim()), tokens[0][0].trim());
|
||||
} catch (Exception e) {
|
||||
logger.severe("Content-Disposition: could not decode filename: " + header);
|
||||
filename = null;
|
||||
return filename;
|
||||
|
@ -24,13 +24,14 @@ import jd.http.Encoding;
|
||||
import jd.parser.Regex;
|
||||
import jd.plugins.DownloadLink;
|
||||
import jd.plugins.LinkStatus;
|
||||
import jd.plugins.PluginException;
|
||||
import jd.plugins.PluginForHost;
|
||||
import jd.plugins.download.RAFDownload;
|
||||
|
||||
public class Zippysharecom extends PluginForHost {
|
||||
|
||||
public Zippysharecom(PluginWrapper wrapper) {
|
||||
super(wrapper);
|
||||
this.setStartIntervall(5000l);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -39,43 +40,30 @@ public class Zippysharecom extends PluginForHost {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getFileInformation(DownloadLink downloadLink) throws IOException, InterruptedException {
|
||||
public boolean getFileInformation(DownloadLink downloadLink) throws IOException, InterruptedException, PluginException {
|
||||
this.setBrowserExclusive();
|
||||
String url = downloadLink.getDownloadURL();
|
||||
for (int i = 1; i < 3; i++) {
|
||||
|
||||
br.getPage(url);
|
||||
if (!br.containsHTML("File does not exist")) {
|
||||
downloadLink.setName(Encoding.htmlDecode(br.getRegex(Pattern.compile("<strong>Name: </strong>(.*?)</font>", Pattern.CASE_INSENSITIVE)).getMatch(0)));
|
||||
downloadLink.setDownloadSize((int) Math.round(Double.parseDouble(br.getRegex(Pattern.compile("<strong>Size: </strong>(.*?)MB</font>", Pattern.CASE_INSENSITIVE)).getMatch(0).replaceAll(",", "\\.")) * 1024 * 1024));
|
||||
return true;
|
||||
}
|
||||
Thread.sleep(250);
|
||||
}
|
||||
br.getPage(downloadLink.getDownloadURL());
|
||||
if (br.containsHTML("<title>Zippyshare.com - File does not exist</title>")) throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
|
||||
String filename = Encoding.htmlDecode(br.getRegex(Pattern.compile("<strong>Name: </strong>(.*?)</font>", Pattern.CASE_INSENSITIVE)).getMatch(0));
|
||||
String filesize = br.getRegex(Pattern.compile("<strong>Size: </strong>(.*?)MB</font>", Pattern.CASE_INSENSITIVE)).getMatch(0);
|
||||
if (filename == null || filesize == null) throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
|
||||
downloadLink.setName(filename);
|
||||
downloadLink.setDownloadSize(Regex.getSize(filesize.replaceAll(",", "\\.")));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
|
||||
return getVersion("$Revision$");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleFree(DownloadLink downloadLink) throws Exception {
|
||||
LinkStatus linkStatus = downloadLink.getLinkStatus();
|
||||
|
||||
/* Nochmals das File überprüfen */
|
||||
if (!getFileInformation(downloadLink)) {
|
||||
linkStatus.addStatus(LinkStatus.ERROR_FILE_NOT_FOUND);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Link holen */
|
||||
getFileInformation(downloadLink);
|
||||
String linkurl = Encoding.htmlDecode(new Regex(br, Pattern.compile("downloadlink = unescape\\(\\'(.*?)\\'\\);", Pattern.CASE_INSENSITIVE)).getMatch(0));
|
||||
/* Datei herunterladen */
|
||||
dl = RAFDownload.download(downloadLink, br.createRequest(linkurl));
|
||||
|
||||
if (linkurl == null) throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFEKT);
|
||||
br.setFollowRedirects(true);
|
||||
dl = br.openDownload(downloadLink, linkurl);
|
||||
dl.startDownload();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user