mirror of
https://github.com/mirror/jdownloader.git
synced 2024-11-27 05:50:51 +00:00
PornHub:
-updated getFirstPageWithAccount, fixed synchronized deadlock StahomatCzSuperloadCz: -fixed npe git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@48045 ebf7c1c2-ba36-0410-9fe8-c592906822b4 Former-commit-id: 0641eceadc8e088058ebfac91a632e27050b321a
This commit is contained in:
parent
856beb3bb2
commit
d30ab8675f
@ -108,15 +108,15 @@ public class PornHubCom extends PluginForHost {
|
||||
/* Note: Video bitrates and resolutions are not exact, they can vary. */
|
||||
/* Quality, { videoCodec, videoBitrate, videoResolution, audioCodec, audioBitrate } */
|
||||
public static LinkedHashMap<String, String[]> formats = new LinkedHashMap<String, String[]>(new LinkedHashMap<String, String[]>() {
|
||||
{
|
||||
put("240", new String[] { "AVC", "400", "420x240", "AAC LC", "54" });
|
||||
put("480", new String[] { "AVC", "600", "850x480", "AAC LC", "54" });
|
||||
put("720", new String[] { "AVC", "1500", "1280x720", "AAC LC", "54" });
|
||||
put("1080", new String[] { "AVC", "4000", "1920x1080", "AAC LC", "96" });
|
||||
put("1440", new String[] { "AVC", "6000", " 2560x1440", "AAC LC", "96" });
|
||||
put("2160", new String[] { "AVC", "8000", "3840x2160", "AAC LC", "128" });
|
||||
}
|
||||
});
|
||||
{
|
||||
put("240", new String[] { "AVC", "400", "420x240", "AAC LC", "54" });
|
||||
put("480", new String[] { "AVC", "600", "850x480", "AAC LC", "54" });
|
||||
put("720", new String[] { "AVC", "1500", "1280x720", "AAC LC", "54" });
|
||||
put("1080", new String[] { "AVC", "4000", "1920x1080", "AAC LC", "96" });
|
||||
put("1440", new String[] { "AVC", "6000", " 2560x1440", "AAC LC", "96" });
|
||||
put("2160", new String[] { "AVC", "8000", "3840x2160", "AAC LC", "128" });
|
||||
}
|
||||
});
|
||||
public static final String BEST_ONLY = "BEST_ONLY";
|
||||
public static final String BEST_SELECTION_ONLY = "BEST_SELECTION_ONLY";
|
||||
public static final String CRAWL_VIDEO_HLS = "CRAWL_VIDEO_HLS";
|
||||
@ -359,34 +359,42 @@ public class PornHubCom extends PluginForHost {
|
||||
return getPage(br, br.createGetRequest(url));
|
||||
}
|
||||
|
||||
public static Object NO_ACCOUNT_LOCK_OBJECT = new Object();
|
||||
|
||||
public static Request getFirstPageWithAccount(final PornHubCom plg, final Account account, final String url) throws Exception {
|
||||
synchronized (DEFAULT_COOKIES) {
|
||||
final Browser br = plg.getBrowser();
|
||||
if (account == null) {
|
||||
final Browser br = plg.getBrowser();
|
||||
if (account == null) {
|
||||
synchronized (NO_ACCOUNT_LOCK_OBJECT) {
|
||||
while (true) {
|
||||
final Request request = getPage(br, url);
|
||||
final String accessAgeCookie[] = new Regex(request.getHtmlCode(), "setCookieAdvanced\\s*\\(\\s*'(accessAge[^']+)'\\s*,\\s*([^,]+),").getRow(0);
|
||||
if (accessAgeCookie != null) {
|
||||
if (!DEFAULT_COOKIES.containsKey(accessAgeCookie[0])) {
|
||||
plg.getLogger().info("Auto-Learn new accessAge cookie:" + Arrays.toString(accessAgeCookie));
|
||||
DEFAULT_COOKIES.put(accessAgeCookie[0], accessAgeCookie[1].trim());
|
||||
setDefaultCookies(br, br.getBaseURL());
|
||||
continue;
|
||||
synchronized (DEFAULT_COOKIES) {
|
||||
if (!DEFAULT_COOKIES.containsKey(accessAgeCookie[0])) {
|
||||
plg.getLogger().info("Auto-Learn new accessAge cookie:" + Arrays.toString(accessAgeCookie));
|
||||
DEFAULT_COOKIES.put(accessAgeCookie[0], accessAgeCookie[1].trim());
|
||||
setDefaultCookies(br, br.getBaseURL());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
return request;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
synchronized (account) {
|
||||
while (true) {
|
||||
final boolean verifiedLogin = plg.login(account, false);
|
||||
final Request request = getPage(br, url);
|
||||
final String accessAgeCookie[] = new Regex(request.getHtmlCode(), "setCookieAdvanced\\s*\\(\\s*'(accessAge[^']+)'\\s*,\\s*([^,]+),").getRow(0);
|
||||
if (accessAgeCookie != null) {
|
||||
if (!DEFAULT_COOKIES.containsKey(accessAgeCookie[0])) {
|
||||
plg.getLogger().info("Auto-Learn new accessAge cookie:" + Arrays.toString(accessAgeCookie));
|
||||
DEFAULT_COOKIES.put(accessAgeCookie[0], accessAgeCookie[1].trim());
|
||||
setDefaultCookies(br, br.getBaseURL());
|
||||
continue;
|
||||
synchronized (DEFAULT_COOKIES) {
|
||||
if (!DEFAULT_COOKIES.containsKey(accessAgeCookie[0])) {
|
||||
plg.getLogger().info("Auto-Learn new accessAge cookie:" + Arrays.toString(accessAgeCookie));
|
||||
DEFAULT_COOKIES.put(accessAgeCookie[0], accessAgeCookie[1].trim());
|
||||
setDefaultCookies(br, br.getBaseURL());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isLoggedInHtml(br)) {
|
||||
|
@ -19,12 +19,6 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.appwork.utils.StringUtils;
|
||||
import org.appwork.utils.formatter.SizeFormatter;
|
||||
import org.jdownloader.plugins.components.antiDDoSForHost;
|
||||
import org.jdownloader.plugins.controller.LazyPlugin;
|
||||
import org.jdownloader.plugins.controller.LazyPlugin.FEATURE;
|
||||
|
||||
import jd.PluginWrapper;
|
||||
import jd.config.Property;
|
||||
import jd.http.Browser;
|
||||
@ -42,6 +36,11 @@ import jd.plugins.LinkStatus;
|
||||
import jd.plugins.PluginException;
|
||||
import jd.plugins.components.PluginJSonUtils;
|
||||
|
||||
import org.appwork.utils.StringUtils;
|
||||
import org.appwork.utils.formatter.SizeFormatter;
|
||||
import org.jdownloader.plugins.components.antiDDoSForHost;
|
||||
import org.jdownloader.plugins.controller.LazyPlugin;
|
||||
|
||||
@HostPlugin(revision = "$Revision$", interfaceVersion = 3, names = { "stahomat.cz", "superload.cz" }, urls = { "https?://(?:www\\.)?stahomat\\.(?:cz|sk)/(stahnout|download)/[a-zA-Z0-9%-]+", "https?://(?:www\\.)?(superload\\.cz|superload\\.eu|superload\\.sk|superloading\\.com|stahovatelka\\.cz)/(stahnout|download)/[a-zA-Z0-9%-]+" })
|
||||
public class StahomatCzSuperloadCz extends antiDDoSForHost {
|
||||
/* IMPORTANT: superload.cz and stahomat.cz use the same api */
|
||||
@ -349,7 +348,8 @@ public class StahomatCzSuperloadCz extends antiDDoSForHost {
|
||||
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
|
||||
}
|
||||
postPage(br, get_api_base() + "/get-status-bar", "token=" + loginToken);
|
||||
final Integer credits = Integer.parseInt(PluginJSonUtils.getJson(br, "credits"));
|
||||
final String creditsString = PluginJSonUtils.getJson(br, "credits");
|
||||
final Integer credits = (creditsString != null && creditsString.matches("\\d+")) ? Integer.parseInt(creditsString) : null;
|
||||
if (credits != null) {
|
||||
// 1000 credits = 1 GB, convert back into 1024 (Bytes)
|
||||
// String expression = "(" + credits + " / 1000) * 1073741824";
|
||||
@ -377,7 +377,7 @@ public class StahomatCzSuperloadCz extends antiDDoSForHost {
|
||||
try {
|
||||
postPage(br, page, postData + getLoginToken(account));
|
||||
} catch (final BrowserException e) {
|
||||
if (br.getRequest().getHttpConnection().getResponseCode() == 401) {
|
||||
if (br.getRequest() != null && br.getRequest().getHttpConnection().getResponseCode() == 401) {
|
||||
logger.info("Request failed (401) -> Re-newing token and trying again");
|
||||
try {
|
||||
this.login(account);
|
||||
|
@ -25,6 +25,24 @@ import java.util.Map;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JLabel;
|
||||
|
||||
import jd.PluginWrapper;
|
||||
import jd.gui.swing.components.linkbutton.JLink;
|
||||
import jd.http.Browser;
|
||||
import jd.nutils.encoding.Encoding;
|
||||
import jd.parser.html.Form;
|
||||
import jd.plugins.Account;
|
||||
import jd.plugins.Account.AccountType;
|
||||
import jd.plugins.AccountInfo;
|
||||
import jd.plugins.AccountInvalidException;
|
||||
import jd.plugins.AccountRequiredException;
|
||||
import jd.plugins.AccountUnavailableException;
|
||||
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.storage.JSonMapperException;
|
||||
import org.appwork.storage.TypeRef;
|
||||
import org.appwork.swing.MigPanel;
|
||||
@ -45,24 +63,6 @@ import org.jdownloader.plugins.config.PluginJsonConfig;
|
||||
import org.jdownloader.plugins.controller.LazyPlugin.FEATURE;
|
||||
import org.jdownloader.scripting.JavaScriptEngineFactory;
|
||||
|
||||
import jd.PluginWrapper;
|
||||
import jd.gui.swing.components.linkbutton.JLink;
|
||||
import jd.http.Browser;
|
||||
import jd.nutils.encoding.Encoding;
|
||||
import jd.parser.html.Form;
|
||||
import jd.plugins.Account;
|
||||
import jd.plugins.Account.AccountType;
|
||||
import jd.plugins.AccountInfo;
|
||||
import jd.plugins.AccountInvalidException;
|
||||
import jd.plugins.AccountRequiredException;
|
||||
import jd.plugins.AccountUnavailableException;
|
||||
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;
|
||||
|
||||
@HostPlugin(revision = "$Revision$", interfaceVersion = 3, names = {}, urls = {})
|
||||
public class UpToBoxCom extends PluginForHost {
|
||||
public UpToBoxCom(PluginWrapper wrapper) {
|
||||
@ -619,7 +619,7 @@ public class UpToBoxCom extends PluginForHost {
|
||||
}
|
||||
|
||||
private int regexPreDownloadWaittimeSecondsWebsite(final Browser br) {
|
||||
final String waittimeSecondsStr = br.getRegex("data-remaining-time=(?:'|\")(\\d+)").getMatch(0);
|
||||
final String waittimeSecondsStr = br.getRegex("data-remaining-time\\s*=\\s*(?:'|\")(\\d+)").getMatch(0);
|
||||
if (waittimeSecondsStr != null) {
|
||||
return Integer.parseInt(waittimeSecondsStr);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user