mirror of
https://github.com/mirror/jdownloader.git
synced 2024-11-23 03:59:51 +00:00
*Plugins: Fixes/Changes/Maintenance*
- JoinPeerTubeOrg: do not allow multihosts to handle this host as that doesn't make any sense - pornportal plugins: BangbrosComCrawler and BangbrosCom: moved mygfcom to PornportalCom - pornportal plugins: BangbrosComCrawler and BangbrosCom: they've fully migrated to pornportal so these legacy plugins are not needed anymore RE forum 94570 - BaixarPremiumNet: minor changes - DownmagazNet: fixed multiple urls crawler RE ticket #WZAX1829-CNNY-2561AWCV - LinkgenVip: added first working version of this plugin RE ticket #PAGZ8212-WZFM-0593WIPZ RE forum 86741 closes #90013 git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@49770 ebf7c1c2-ba36-0410-9fe8-c592906822b4 Former-commit-id: 8ec4260b619445eb9e21ced6d3a70dcca62d71a2
This commit is contained in:
parent
168ed65a36
commit
18a41f8c3e
@ -1,335 +0,0 @@
|
||||
//jDownloader - Downloadmanager
|
||||
//Copyright (C) 2013 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.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
import jd.PluginWrapper;
|
||||
import jd.config.SubConfiguration;
|
||||
import jd.controlling.AccountController;
|
||||
import jd.controlling.ProgressController;
|
||||
import jd.http.Browser;
|
||||
import jd.nutils.encoding.Encoding;
|
||||
import jd.parser.Regex;
|
||||
import jd.plugins.Account;
|
||||
import jd.plugins.AccountRequiredException;
|
||||
import jd.plugins.CryptedLink;
|
||||
import jd.plugins.DecrypterPlugin;
|
||||
import jd.plugins.DownloadLink;
|
||||
import jd.plugins.FilePackage;
|
||||
import jd.plugins.LinkStatus;
|
||||
import jd.plugins.Plugin;
|
||||
import jd.plugins.PluginException;
|
||||
import jd.plugins.PluginForDecrypt;
|
||||
import jd.plugins.hoster.BangbrosCom;
|
||||
|
||||
import org.appwork.storage.TypeRef;
|
||||
import org.appwork.utils.StringUtils;
|
||||
import org.appwork.utils.parser.UrlQuery;
|
||||
import org.jdownloader.plugins.controller.LazyPlugin;
|
||||
|
||||
@DecrypterPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "bangbrosold.com", "mygf.com" }, urls = { "https?://members\\.bangbros\\.com/product/\\d+/movie/\\d+|https?://(?:bangbrothers\\.(?:com|net)|bangbros\\.com)/video\\d+/[a-z0-9\\-]+", "https?://members\\.mygf\\.com/product/\\d+/movie/\\d+" })
|
||||
public class BangbrosComCrawler extends PluginForDecrypt {
|
||||
public BangbrosComCrawler(PluginWrapper wrapper) {
|
||||
super(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LazyPlugin.FEATURE[] getFeatures() {
|
||||
return new LazyPlugin.FEATURE[] { LazyPlugin.FEATURE.XXX };
|
||||
}
|
||||
|
||||
public static final String type_userinput_video_couldbe_trailer = ".+/video\\d+/[a-z0-9\\-]+";
|
||||
public static final String type_decrypted_zip = ".+\\.zip.*?";
|
||||
|
||||
/**
|
||||
* 2023-06-26: old.bangbros.com was added as they've moved to a new system ("pornportal") which is incompatible with the old stuff thus
|
||||
* the "old." domain is used JDownloader-plugin-internally.
|
||||
*/
|
||||
protected DownloadLink createDownloadlink(String url, final String fid, final String productid, final String quality) {
|
||||
final String hostpart = BangbrosCom.getHostInternal(this.getHost()).split("\\.")[0];
|
||||
url = url.replaceAll("https?://", hostpart + "decrypted://");
|
||||
final DownloadLink dl = super.createDownloadlink(url, true);
|
||||
dl.setProperty(BangbrosCom.PROPERTY_FID, fid);
|
||||
if (quality != null) {
|
||||
dl.setProperty(BangbrosCom.PROPERTY_QUALITY, quality);
|
||||
}
|
||||
if (productid != null) {
|
||||
dl.setProperty(BangbrosCom.PROPERTY_PRODUCT_ID, productid);
|
||||
}
|
||||
dl.setProperty(BangbrosCom.PROPERTY_MAINLINK, br.getURL());
|
||||
return dl;
|
||||
}
|
||||
|
||||
protected DownloadLink createDownloadlink(String url, final String fid) {
|
||||
return createDownloadlink(url, fid, null, null);
|
||||
}
|
||||
|
||||
public ArrayList<DownloadLink> decryptIt(final CryptedLink param, ProgressController progress) throws Exception {
|
||||
final Account account = AccountController.getInstance().getValidAccount(this.getHost());
|
||||
return decryptIt(param, account, SubConfiguration.getConfig(this.getHost()));
|
||||
}
|
||||
|
||||
public ArrayList<DownloadLink> decryptIt(final CryptedLink param, final Account account, final SubConfiguration cfg) throws Exception {
|
||||
ArrayList<DownloadLink> ret = new ArrayList<DownloadLink>();
|
||||
final String parameter = param.getCryptedUrl().replaceFirst("bangbrothers\\.com/", "bangbros.com/");
|
||||
final boolean loginRequired = requiresAccount(parameter);
|
||||
if (loginRequired && account == null) {
|
||||
throw new AccountRequiredException();
|
||||
}
|
||||
final BangbrosCom hostPlugin = (BangbrosCom) this.getNewPluginForHostInstance(this.getHost());
|
||||
if (account != null) {
|
||||
hostPlugin.login(this.br, account, false);
|
||||
}
|
||||
final boolean preferServersideOriginalFilenames = hostPlugin.getPluginConfig().getBooleanProperty("PREFER_ORIGINAL_FILENAMES", false);
|
||||
br.getPage(parameter);
|
||||
if (isOffline(this.br, parameter)) {
|
||||
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
|
||||
}
|
||||
String title = null;
|
||||
String cast_comma_separated = null;
|
||||
String description = null;
|
||||
final String cast_html = br.getRegex("<span class=\"tag\">Cast:(.*?)</span>").getMatch(0);
|
||||
if (cast_html != null) {
|
||||
final String[] castMembers = new Regex(cast_html, "class=\"tagB\">([^<]*)<").getColumn(0);
|
||||
if (castMembers.length > 0) {
|
||||
cast_comma_separated = "";
|
||||
for (String castMember : castMembers) {
|
||||
castMember = castMember.trim();
|
||||
if (cast_comma_separated.length() > 0) {
|
||||
cast_comma_separated += ",";
|
||||
}
|
||||
cast_comma_separated += castMember;
|
||||
}
|
||||
}
|
||||
}
|
||||
final Regex finfo = new Regex(parameter, "product/(\\d+)/movie/(\\d+)");
|
||||
final String productid = finfo.getMatch(0);
|
||||
String fid = finfo.getMatch(1);
|
||||
final String directurl_photos = regexZipUrl(this.br, "pictures");
|
||||
String directurl_screencaps = regexZipUrl(this.br, "screencaps");
|
||||
if (directurl_screencaps != null) {
|
||||
/* Protocol might sometimes be missing! */
|
||||
directurl_screencaps = br.getURL(directurl_screencaps).toString();
|
||||
}
|
||||
title = this.br.getRegex("class=\"vdo\\-hdd1\">([^<>\"]+)<").getMatch(0);
|
||||
if (title == null) {
|
||||
title = this.br.getRegex("class=\"desTxt\\-hed\">([^<>\"]+)<").getMatch(0);
|
||||
}
|
||||
String titleForPlugin = null;
|
||||
final String trailerJsonEncoded = br.getRegex("class=\"pBtn overlay-trailer-opener\" data-shoot=\"(\\{[^\"]+)").getMatch(0);
|
||||
DownloadLink trailer = null;
|
||||
if (trailerJsonEncoded != null) {
|
||||
final Map<String, Object> entries = restoreFromString(Encoding.htmlDecode(trailerJsonEncoded), TypeRef.MAP);
|
||||
trailer = this.createDownloadlink(entries.get("trailer").toString());
|
||||
if (title == null) {
|
||||
title = entries.get("title").toString();
|
||||
}
|
||||
description = (String) entries.get("description");
|
||||
}
|
||||
if (title != null) {
|
||||
title = Encoding.htmlDecode(title);
|
||||
titleForPlugin = title;
|
||||
if (cast_comma_separated != null) {
|
||||
titleForPlugin = cast_comma_separated + "_" + titleForPlugin;
|
||||
}
|
||||
} else {
|
||||
/* Fallback to id from inside url */
|
||||
title = fid;
|
||||
titleForPlugin = title;
|
||||
}
|
||||
/* 2019-01-29: Content-Servers are very slow */
|
||||
final boolean fast_linkcheck = true;
|
||||
final String[] videourls = br.getRegex("(/product/\\d+/movie/\\d+/\\d+p)").getColumn(0);
|
||||
int numberOfAddedVideos = 0;
|
||||
if (videourls != null && videourls.length > 0) {
|
||||
int heightMax = -1;
|
||||
DownloadLink best = null;
|
||||
for (String videourl : videourls) {
|
||||
videourl = br.getURL(videourl).toString();
|
||||
final String qualityHeightStr = new Regex(videourl, "(\\d+)p").getMatch(0);
|
||||
final int qualityHeight = Integer.parseInt(qualityHeightStr);
|
||||
final String qualityIdentifier = qualityHeightStr + "p";
|
||||
final String streamingURL = regexStreamingURL(br, qualityIdentifier);
|
||||
final String ext = ".mp4";
|
||||
final DownloadLink video = this.createDownloadlink(videourl, fid, productid, qualityIdentifier);
|
||||
if (streamingURL != null) {
|
||||
video.setProperty(BangbrosCom.PROPERTY_STREAMING_DIRECTURL, streamingURL);
|
||||
}
|
||||
final String pluginFilename = titleForPlugin + "_" + qualityIdentifier + ext;
|
||||
if (preferServersideOriginalFilenames) {
|
||||
String originalFilename = null;
|
||||
if (streamingURL != null) {
|
||||
originalFilename = Plugin.getFileNameFromURL(new URL(streamingURL));
|
||||
}
|
||||
if (originalFilename != null) {
|
||||
video.setFinalFileName(originalFilename);
|
||||
} else {
|
||||
/* Fallback */
|
||||
video.setName(pluginFilename);
|
||||
}
|
||||
} else {
|
||||
video.setFinalFileName(pluginFilename);
|
||||
}
|
||||
if (fast_linkcheck) {
|
||||
video.setAvailable(true);
|
||||
}
|
||||
/* Collect best */
|
||||
if (best == null || qualityHeight > heightMax) {
|
||||
heightMax = qualityHeight;
|
||||
best = video;
|
||||
}
|
||||
if (cfg != null && !cfg.getBooleanProperty("GRAB_" + qualityIdentifier, true)) {
|
||||
continue;
|
||||
}
|
||||
ret.add(video);
|
||||
}
|
||||
if (cfg != null && cfg.getBooleanProperty(BangbrosCom.SETTING_BEST_ONLY, BangbrosCom.default_SETTING_BEST_ONLY)) {
|
||||
ret.clear();
|
||||
ret.add(best);
|
||||
}
|
||||
numberOfAddedVideos = ret.size();
|
||||
}
|
||||
if ((cfg == null || cfg.getBooleanProperty("GRAB_photos", false)) && directurl_photos != null) {
|
||||
final String quality = "pictures";
|
||||
final DownloadLink dl = this.createDownloadlink(directurl_photos, fid, productid, quality);
|
||||
final String pluginFilename = titleForPlugin + "_" + quality + ".zip";
|
||||
if (preferServersideOriginalFilenames) {
|
||||
String originalFilename = UrlQuery.parse(directurl_photos).get("filename");
|
||||
if (originalFilename == null) {
|
||||
originalFilename = Plugin.getFileNameFromURL(new URL(directurl_photos));
|
||||
}
|
||||
if (originalFilename != null) {
|
||||
dl.setFinalFileName(originalFilename);
|
||||
} else {
|
||||
/* Fallback */
|
||||
dl.setName(pluginFilename);
|
||||
}
|
||||
} else {
|
||||
dl.setFinalFileName(pluginFilename);
|
||||
}
|
||||
if (fast_linkcheck) {
|
||||
dl.setAvailable(true);
|
||||
}
|
||||
ret.add(dl);
|
||||
}
|
||||
if ((cfg == null || cfg.getBooleanProperty("GRAB_screencaps", false)) && directurl_screencaps != null) {
|
||||
final String quality = "screencaps";
|
||||
final DownloadLink dl = this.createDownloadlink(directurl_screencaps, fid, productid, quality);
|
||||
final String pluginFilename = titleForPlugin + "_" + quality + ".zip";
|
||||
if (preferServersideOriginalFilenames) {
|
||||
String originalFilename = UrlQuery.parse(directurl_screencaps).get("filename");
|
||||
if (originalFilename == null) {
|
||||
originalFilename = Plugin.getFileNameFromURL(new URL(directurl_screencaps));
|
||||
}
|
||||
if (originalFilename != null) {
|
||||
dl.setFinalFileName(originalFilename);
|
||||
} else {
|
||||
/* Fallback */
|
||||
dl.setName(pluginFilename);
|
||||
}
|
||||
} else {
|
||||
dl.setFinalFileName(pluginFilename);
|
||||
}
|
||||
if (fast_linkcheck) {
|
||||
dl.setAvailable(true);
|
||||
}
|
||||
ret.add(dl);
|
||||
}
|
||||
if (ret.isEmpty()) {
|
||||
/* Nothing found -> Check why or return trailer. */
|
||||
if (trailer == null) {
|
||||
/* Dead end */
|
||||
if (br.containsHTML("(?i)<div>\\s*Unlock Video Now")) {
|
||||
/* This can even happen with premium account. Some items need to be bought separately. */
|
||||
throw new AccountRequiredException();
|
||||
} else {
|
||||
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
|
||||
}
|
||||
} else {
|
||||
if (account == null) {
|
||||
logger.info("Returning trailer because: No account available");
|
||||
} else {
|
||||
logger.info("Returning trailer because: Failed to find any other items");
|
||||
}
|
||||
ret.add(trailer);
|
||||
}
|
||||
} else if (numberOfAddedVideos == 0 && trailer != null) {
|
||||
/* No video items found so far -> Return trailer. */
|
||||
logger.info("Returning trailer because: Failed to find any other video items");
|
||||
ret.add(trailer);
|
||||
}
|
||||
/* Set additional properties */
|
||||
for (final DownloadLink result : ret) {
|
||||
result.setProperty(BangbrosCom.PROPERTY_TITLE, title);
|
||||
result.setProperty(BangbrosCom.PROPERTY_CAST_COMMA_SEPARATED, cast_comma_separated);
|
||||
}
|
||||
final FilePackage fp = FilePackage.getInstance();
|
||||
fp.setName(titleForPlugin);
|
||||
if (!StringUtils.isEmpty(description)) {
|
||||
fp.setComment(description);
|
||||
}
|
||||
fp.addLinks(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static String regexStreamingURL(final Browser br, final String qualityIdentifier) {
|
||||
String url = br.getRegex("<source src=\"(https?://[^\"]+" + qualityIdentifier + "\\.mp4[^\"]*)\"[^>]*type=.video/mp4").getMatch(0);
|
||||
if (url == null) {
|
||||
/* 2023-08-31: Wider RegEx */
|
||||
url = br.getRegex("href=\"(https?://[^\"]+" + qualityIdentifier + "\\.mp4[^\"]*)\"[^>]*>" + qualityIdentifier).getMatch(0);
|
||||
}
|
||||
if (url != null) {
|
||||
return Encoding.htmlOnlyDecode(url);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String regexZipUrl(final Browser br, final String key) {
|
||||
String zipurl = br.getRegex("([^<>\"\\']+/" + key + "/[^<>\"\\']+\\.zip[^<>\"\\']+)").getMatch(0);
|
||||
if (zipurl != null) {
|
||||
zipurl = Encoding.htmlDecode(zipurl);
|
||||
}
|
||||
return zipurl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isProxyRotationEnabledForLinkCrawler() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean requiresAccount(final String url) {
|
||||
return url != null && !(url.matches(type_userinput_video_couldbe_trailer) || url.matches(type_decrypted_zip));
|
||||
}
|
||||
|
||||
public static boolean isOffline(final Browser br, final String url_source) {
|
||||
final boolean isOffline;
|
||||
if (url_source != null && url_source.matches(type_userinput_video_couldbe_trailer)) {
|
||||
isOffline = br.getHttpConnection().getResponseCode() == 503 || !br.getURL().contains("/video");
|
||||
} else {
|
||||
isOffline = !br.getURL().contains("/movie/") || br.getURL().contains("/library");
|
||||
}
|
||||
return isOffline;
|
||||
}
|
||||
|
||||
/* NO OVERRIDE!! */
|
||||
public boolean hasCaptcha(CryptedLink link, jd.plugins.Account acc) {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -92,29 +92,30 @@ public class DownmagazNet extends PluginForDecrypt {
|
||||
final String url = "/out.php?f=" + mirrorID + "&down=" + downValue;
|
||||
ret.add(this.createDownloadlink(br.getURL(url).toString()));
|
||||
}
|
||||
}
|
||||
/* New 2023-09-05 */
|
||||
final String[] b64Strings = br.getRegex("url=([a-zA-Z0-9_/\\+\\=\\-%]+)").getColumn(0);
|
||||
if (b64Strings != null && b64Strings.length > 0) {
|
||||
for (final String b64String : b64Strings) {
|
||||
final String url = Encoding.Base64Decode(Encoding.htmlDecode(b64String));
|
||||
ret.add(this.createDownloadlink(url));
|
||||
}
|
||||
} else {
|
||||
/* New 2023-09-05 */
|
||||
final String[] b64Strings = br.getRegex("url=([a-zA-Z0-9_/\\+\\=\\-%]+)").getColumn(0);
|
||||
if (b64Strings != null && b64Strings.length > 0) {
|
||||
for (final String b64String : b64Strings) {
|
||||
final String url = Encoding.Base64Decode(Encoding.htmlDecode(b64String));
|
||||
ret.add(this.createDownloadlink(url));
|
||||
}
|
||||
} else {
|
||||
/* 2023-12-19 */
|
||||
final String htmlWithPlaintextLinks = br.getRegex(">\\s*Download Links:\\s*</div><br/>(.*?)<br/></div>").getMatch(0);
|
||||
if (htmlWithPlaintextLinks == null) {
|
||||
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
|
||||
}
|
||||
final String[] urls = new Regex(htmlWithPlaintextLinks, "<a href=\"(http?://[^\"]+)").getColumn(0);
|
||||
if (urls == null || urls.length == 0) {
|
||||
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
|
||||
}
|
||||
/* 2023-12-19 */
|
||||
String htmlWithPlaintextLinks = br.getRegex(">\\s*Download Links:\\s*</div><br/>(.*?)<br/></div>").getMatch(0);
|
||||
if (htmlWithPlaintextLinks == null) {
|
||||
htmlWithPlaintextLinks = br.getRequest().getHtmlCode();
|
||||
}
|
||||
final String[] urls = new Regex(htmlWithPlaintextLinks, "<a href=\"(https?://[^\"]+)\"[^>]*target=\"_blank\"").getColumn(0);
|
||||
if (urls != null && urls.length > 0) {
|
||||
for (final String url : urls) {
|
||||
ret.add(this.createDownloadlink(url));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ret.isEmpty()) {
|
||||
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
|
||||
}
|
||||
} else {
|
||||
br.setFollowRedirects(false);
|
||||
br.getPage(param.getCryptedUrl());
|
||||
|
@ -19,7 +19,6 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.jdownloader.plugins.controller.LazyPlugin;
|
||||
|
||||
@ -42,7 +41,6 @@ import jd.utils.JDUtilities;
|
||||
@HostPlugin(revision = "$Revision$", interfaceVersion = 3, names = { "baixarpremium.net" }, urls = { "" })
|
||||
public class BaixarPremiumNet extends PluginForHost {
|
||||
private static HashMap<Account, HashMap<String, Long>> hostUnavailableMap = new HashMap<Account, HashMap<String, Long>>();
|
||||
private static AtomicInteger maxPrem = new AtomicInteger(20);
|
||||
private static final String NICE_HOST = "baixarpremium.net";
|
||||
private static final String NICE_HOSTproperty = NICE_HOST.replaceAll("(\\.|\\-)", "");
|
||||
private Account currAcc = null;
|
||||
@ -51,17 +49,17 @@ public class BaixarPremiumNet extends PluginForHost {
|
||||
@SuppressWarnings("deprecation")
|
||||
public BaixarPremiumNet(PluginWrapper wrapper) {
|
||||
super(wrapper);
|
||||
this.enablePremium("http://baixarpremium.net/");
|
||||
this.enablePremium("http://" + getHost() + "/");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAGBLink() {
|
||||
return "http://baixarpremium.net/contato/";
|
||||
return "http://" + getHost() + "/contato/";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxSimultanDownload(DownloadLink link, Account account) {
|
||||
return maxPrem.get();
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
private void setConstants(final Account acc, final DownloadLink dl) {
|
||||
@ -115,8 +113,6 @@ public class BaixarPremiumNet extends PluginForHost {
|
||||
crippledhost = crippledhost.toLowerCase(Locale.ENGLISH);
|
||||
if (crippledhost.equals("icerbox")) {
|
||||
supportedHosts.add("icerbox.com");
|
||||
} else if (crippledhost.equals("bangbros")) {
|
||||
supportedHosts.add("bangbros.com");
|
||||
} else {
|
||||
supportedHosts.add(crippledhost);
|
||||
}
|
||||
|
@ -1,460 +0,0 @@
|
||||
//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.hoster;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import org.appwork.utils.StringUtils;
|
||||
import org.jdownloader.captcha.v2.challenge.recaptcha.v2.CaptchaHelperHostPluginRecaptchaV2;
|
||||
import org.jdownloader.plugins.controller.LazyPlugin;
|
||||
|
||||
import jd.PluginWrapper;
|
||||
import jd.config.ConfigContainer;
|
||||
import jd.config.ConfigEntry;
|
||||
import jd.controlling.AccountController;
|
||||
import jd.http.Browser;
|
||||
import jd.http.Cookies;
|
||||
import jd.http.URLConnectionAdapter;
|
||||
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.CryptedLink;
|
||||
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 jd.plugins.decrypter.BangbrosComCrawler;
|
||||
|
||||
@HostPlugin(revision = "$Revision$", interfaceVersion = 2, names = { "bangbrosold.com", "mygf.com" }, urls = { "bangbrosdecrypted://.+", "mygfdecrypted://.+" })
|
||||
public class BangbrosCom extends PluginForHost {
|
||||
public BangbrosCom(PluginWrapper wrapper) {
|
||||
super(wrapper);
|
||||
this.enablePremium("https://www.bangbrosnetwork.com/bangbrothers/join");
|
||||
setConfigElements();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LazyPlugin.FEATURE[] getFeatures() {
|
||||
if (getHost().equals("mygf.com")) {
|
||||
return new LazyPlugin.FEATURE[] { LazyPlugin.FEATURE.XXX, LazyPlugin.FEATURE.COOKIE_LOGIN_ONLY };
|
||||
} else {
|
||||
return new LazyPlugin.FEATURE[] { LazyPlugin.FEATURE.XXX, LazyPlugin.FEATURE.COOKIE_LOGIN_OPTIONAL };
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAGBLink() {
|
||||
return "https://www.bangbros.com/terms.htm";
|
||||
}
|
||||
|
||||
/* Connection stuff */
|
||||
private static final boolean FREE_RESUME = false;
|
||||
private static final int FREE_MAXCHUNKS = 1;
|
||||
private static final int FREE_MAXDOWNLOADS = 1;
|
||||
private static final boolean ACCOUNT_PREMIUM_RESUME = true;
|
||||
private static final int ACCOUNT_PREMIUM_MAXCHUNKS = 0;
|
||||
private static final int ACCOUNT_PREMIUM_MAXDOWNLOADS = 20;
|
||||
public static final String PROPERTY_FID = "fid";
|
||||
public static final String PROPERTY_PRODUCT_ID = "product_id";
|
||||
public static final String PROPERTY_TITLE = "title";
|
||||
public static final String PROPERTY_CAST_COMMA_SEPARATED = "cast_comma_separated";
|
||||
public static final String PROPERTY_QUALITY = "quality";
|
||||
public static final String PROPERTY_MAINLINK = "mainlink";
|
||||
public static final String PROPERTY_STREAMING_DIRECTURL = "streaming_directurl";
|
||||
private final String DOMAIN_PREFIX_PREMIUM = "members.";
|
||||
private String dllink = null;
|
||||
private boolean logged_in = false;
|
||||
public static final String SETTING_BEST_ONLY = "GRAB_best_only";
|
||||
|
||||
public static Browser prepBR(final Browser br) {
|
||||
/* This may happen after logging in but usually login process will be okay anways. */
|
||||
br.setAllowedResponseCodes(500);
|
||||
br.setFollowRedirects(true);
|
||||
return br;
|
||||
}
|
||||
|
||||
public void correctDownloadLink(final DownloadLink link) {
|
||||
link.setPluginPatternMatcher(link.getPluginPatternMatcher().replaceAll("[a-z0-9]+decrypted://", "https://"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public AvailableStatus requestFileInformation(final DownloadLink link) throws Exception {
|
||||
final Account account = AccountController.getInstance().getValidAccount(this);
|
||||
return requestFileInformation(link, account);
|
||||
}
|
||||
|
||||
private AvailableStatus requestFileInformation(final DownloadLink link, final Account account) throws Exception {
|
||||
dllink = null;
|
||||
this.setBrowserExclusive();
|
||||
br.setFollowRedirects(true);
|
||||
String final_filename = link.getStringProperty("decryptername", null);
|
||||
final boolean loginRequired = BangbrosComCrawler.requiresAccount(this.getMainlink(link));
|
||||
if (account != null) {
|
||||
this.login(this.br, account, false);
|
||||
logged_in = true;
|
||||
} else {
|
||||
logged_in = false;
|
||||
}
|
||||
if (!this.logged_in && loginRequired) {
|
||||
link.getLinkStatus().setStatusText("Cannot check this link type without valid premium account");
|
||||
return AvailableStatus.UNCHECKABLE;
|
||||
}
|
||||
final String mainlink = this.getMainlink(link);
|
||||
boolean allowRefreshDirecturl = true;
|
||||
if (mainlink.matches(BangbrosComCrawler.type_userinput_video_couldbe_trailer)) {
|
||||
br.getPage(mainlink);
|
||||
if (BangbrosComCrawler.isOffline(this.br, mainlink)) {
|
||||
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
|
||||
}
|
||||
dllink = br.getRegex("var\\s*?videoLink\\s*?=\\s*?\\'(http[^<>\"\\']+)\\';").getMatch(0);
|
||||
if (dllink == null) {
|
||||
/* 2019-01-14: New */
|
||||
dllink = br.getRegex("<source src=\"(?:https?:)?(//[^<>\"]+/trailerx/[^<>\"]+)\" type=\\'video/mp4\\' />").getMatch(0);
|
||||
}
|
||||
allowRefreshDirecturl = false;
|
||||
} else {
|
||||
final String qualityIdentifier = link.getStringProperty(PROPERTY_QUALITY);
|
||||
if (qualityIdentifier != null && qualityIdentifier.matches("\\d+p")) {
|
||||
dllink = link.getStringProperty(PROPERTY_STREAMING_DIRECTURL);
|
||||
if (dllink == null) {
|
||||
logger.info("Looking for streaming URL...");
|
||||
final String fid = this.getFID(link);
|
||||
final String productid = link.getStringProperty(PROPERTY_PRODUCT_ID);
|
||||
if (fid == null || productid == null) {
|
||||
/* This should never happen! */
|
||||
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
|
||||
}
|
||||
this.br.getPage("https://" + DOMAIN_PREFIX_PREMIUM + getHostInternal(this.getHost()) + "/product/" + productid + "/movie/" + fid + "/" + qualityIdentifier);
|
||||
if (BangbrosComCrawler.isOffline(this.br, mainlink)) {
|
||||
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
|
||||
}
|
||||
dllink = BangbrosComCrawler.regexStreamingURL(br, qualityIdentifier);
|
||||
if (dllink == null) {
|
||||
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
|
||||
}
|
||||
allowRefreshDirecturl = false;
|
||||
}
|
||||
} else {
|
||||
dllink = link.getPluginPatternMatcher();
|
||||
}
|
||||
}
|
||||
if (!StringUtils.isEmpty(dllink)) {
|
||||
URLConnectionAdapter con = null;
|
||||
try {
|
||||
con = br.openHeadConnection(dllink);
|
||||
if (!this.looksLikeDownloadableContent(con)) {
|
||||
if (!allowRefreshDirecturl) {
|
||||
throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Broken media file?");
|
||||
}
|
||||
logger.info("Refreshing directurl");
|
||||
refreshDirecturl(link, account);
|
||||
dllink = link.getStringProperty(PROPERTY_STREAMING_DIRECTURL);
|
||||
con = br.openHeadConnection(dllink);
|
||||
if (!this.looksLikeDownloadableContent(con)) {
|
||||
throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Broken media file?");
|
||||
}
|
||||
}
|
||||
link.setVerifiedFileSize(con.getCompleteContentLength());
|
||||
if (final_filename == null) {
|
||||
final String filenameFromHeader = getFileNameFromConnection(con);
|
||||
if (filenameFromHeader != null) {
|
||||
final_filename = Encoding.htmlDecode(filenameFromHeader);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
con.disconnect();
|
||||
} catch (final Throwable e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (final_filename != null) {
|
||||
link.setFinalFileName(final_filename);
|
||||
}
|
||||
return AvailableStatus.TRUE;
|
||||
}
|
||||
|
||||
private void refreshDirecturl(final DownloadLink link, final Account account) throws Exception {
|
||||
logger.info("Trying to refresh expired directurl");
|
||||
final String fid = getFID(link);
|
||||
final String quality = link.getStringProperty(PROPERTY_QUALITY);
|
||||
// String product_id = link.getStringProperty("productid");
|
||||
// if (product_id == null) {
|
||||
// /* Fallback to most popular product 'bangbros'. */
|
||||
// product_id = "1";
|
||||
// }
|
||||
final String mainlink = link.getStringProperty(PROPERTY_MAINLINK);
|
||||
if (fid == null || quality == null || mainlink == null) {
|
||||
/* This should never happen */
|
||||
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
|
||||
}
|
||||
final BangbrosComCrawler crawlerplugin = (BangbrosComCrawler) this.getNewPluginForDecryptInstance(this.getHost());
|
||||
final ArrayList<DownloadLink> results = crawlerplugin.decryptIt(new CryptedLink(mainlink), account, null);
|
||||
DownloadLink freshLink = null;
|
||||
for (final DownloadLink result : results) {
|
||||
if (quality.equals(result.getStringProperty(PROPERTY_QUALITY))) {
|
||||
freshLink = result;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (freshLink == null) {
|
||||
/* This should never happen! */
|
||||
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
|
||||
}
|
||||
correctDownloadLink(freshLink);
|
||||
this.dllink = freshLink.getPluginPatternMatcher();
|
||||
link.setPluginPatternMatcher(freshLink.getPluginPatternMatcher());
|
||||
link.setProperties(freshLink.getProperties());
|
||||
}
|
||||
|
||||
private String getFID(final DownloadLink dl) {
|
||||
return dl.getStringProperty(PROPERTY_FID);
|
||||
}
|
||||
|
||||
private String getMainlink(final DownloadLink dl) {
|
||||
return dl.getStringProperty(PROPERTY_MAINLINK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleFree(final DownloadLink link) throws Exception, PluginException {
|
||||
requestFileInformation(link, null);
|
||||
doFree(link, FREE_RESUME, FREE_MAXCHUNKS, "free_directlink");
|
||||
}
|
||||
|
||||
private void doFree(final DownloadLink link, final boolean resumable, final int maxchunks, final String directlinkproperty) throws Exception, PluginException {
|
||||
if (StringUtils.isEmpty(dllink)) {
|
||||
throw new PluginException(LinkStatus.ERROR_PREMIUM, PluginException.VALUE_ID_PREMIUM_ONLY);
|
||||
}
|
||||
dl = jd.plugins.BrowserAdapter.openDownload(br, link, dllink, ACCOUNT_PREMIUM_RESUME, ACCOUNT_PREMIUM_MAXCHUNKS);
|
||||
if (!this.looksLikeDownloadableContent(dl.getConnection())) {
|
||||
logger.warning("The final dllink seems not to be a file!");
|
||||
br.followConnection(true);
|
||||
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
|
||||
}
|
||||
link.setProperty("free_directlink", this.dllink);
|
||||
dl.startDownload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxSimultanFreeDownloadNum() {
|
||||
return FREE_MAXDOWNLOADS;
|
||||
}
|
||||
|
||||
public static String getHostInternal(final String host) {
|
||||
/*
|
||||
* 2023-06-26: Workaround as bangbros.com changed their login system and is currently running the old and new systems in parallel.
|
||||
*/
|
||||
return host.replace("bangbrosold.com", "bangbros.com");
|
||||
}
|
||||
|
||||
public void login(final Browser br, final Account account, final boolean force) throws Exception {
|
||||
synchronized (account) {
|
||||
try {
|
||||
br.setCookiesExclusive(true);
|
||||
prepBR(br);
|
||||
final Cookies userCookies = account.loadUserCookies();
|
||||
if (userCookies != null && !userCookies.isEmpty()) {
|
||||
logger.info("Performing user-cookie login");
|
||||
br.setCookies(getHostInternal(this.getHost()), userCookies);
|
||||
if (!force) {
|
||||
logger.info("Trust cookies without check");
|
||||
return;
|
||||
}
|
||||
if (checkLogin(br)) {
|
||||
logger.info("User cookie login successful");
|
||||
return;
|
||||
} else {
|
||||
logger.info("User cookie login failed");
|
||||
if (account.hasEverBeenValid()) {
|
||||
throw new AccountInvalidException("Cookies expired");
|
||||
} else {
|
||||
throw new AccountInvalidException("Cookies invalid");
|
||||
}
|
||||
}
|
||||
}
|
||||
final Cookies cookies = account.loadCookies("");
|
||||
if (cookies != null && !cookies.isEmpty()) {
|
||||
/*
|
||||
* Try to avoid login captcha at all cost! Important: ALWAYS check this as their cookies can easily become invalid e.g.
|
||||
* when the user logs in via browser.
|
||||
*/
|
||||
br.setCookies(getHostInternal(this.getHost()), cookies);
|
||||
if (!force) {
|
||||
logger.info("Trust cookies without check");
|
||||
return;
|
||||
}
|
||||
if (checkLogin(br)) {
|
||||
logger.info("Cookie login successful");
|
||||
account.saveCookies(br.getCookies(getHostInternal(this.getHost())), "");
|
||||
return;
|
||||
} else {
|
||||
logger.info("Cookie login failed");
|
||||
br.clearCookies(null);
|
||||
prepBR(br);
|
||||
}
|
||||
}
|
||||
logger.info("Performing full login");
|
||||
/* 2020-08-24: Cookie login is NEEDED for mygf.com and can be used for bangbros.com too but is not needed! */
|
||||
if (account.getHoster().equals("mygf.com") && userCookies == null) {
|
||||
if (!account.hasEverBeenValid()) {
|
||||
showCookieLoginInfo();
|
||||
}
|
||||
throw new AccountInvalidException("Enter cookies to login");
|
||||
}
|
||||
logger.info("Performing full login");
|
||||
/*
|
||||
* 2020-08-21: Not all websites support https e.g. mygf.com doesn't so we rather use http here and let them redirect us to
|
||||
* https if available.
|
||||
*/
|
||||
br.getPage("https://" + DOMAIN_PREFIX_PREMIUM + getHostInternal(this.getHost()) + "/login");
|
||||
final Form loginform = br.getForm(0);
|
||||
if (loginform == null) {
|
||||
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
|
||||
}
|
||||
loginform.put("login%5Busername%5D", Encoding.urlEncode(account.getUser()));
|
||||
loginform.put("login%5Bpassword%5D", Encoding.urlEncode(account.getPass()));
|
||||
loginform.put("profiler_input", Integer.toString(new Random().nextInt(1000)));
|
||||
if (loginform.containsHTML("g-recaptcha")) {
|
||||
final String recaptchaV2Response = new CaptchaHelperHostPluginRecaptchaV2(this, br).getToken();
|
||||
loginform.put("g-recaptcha-response", Encoding.urlEncode(recaptchaV2Response));
|
||||
}
|
||||
br.submitForm(loginform);
|
||||
if (!br.getURL().contains("/library")) {
|
||||
br.getPage("/library");
|
||||
}
|
||||
if (!isLoggedin(br) || !br.getURL().contains("/library")) {
|
||||
throw new AccountInvalidException();
|
||||
}
|
||||
account.saveCookies(br.getCookies(br.getHost()), "");
|
||||
} catch (final PluginException e) {
|
||||
account.clearCookies("");
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkLogin(final Browser br) throws IOException {
|
||||
br.getPage("https://" + DOMAIN_PREFIX_PREMIUM + getHostInternal(this.getHost()) + "/library");
|
||||
if (isLoggedin(br)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isLoggedin(final Browser br) {
|
||||
// final String logincookie = br.getCookie(account.getHoster(), "bangbros_remember_me");
|
||||
// final String logincookie2 = br.getCookie(account.getHoster(), "st_login");
|
||||
// final boolean isLoggedin = (logincookie != null && !"deleted".equalsIgnoreCase(logincookie)) || (logincookie2 != null &&
|
||||
// !"deleted".equalsIgnoreCase(logincookie2));
|
||||
return br.containsHTML("all_purchased_switcher") || br.getCookie(getHostInternal(this.getHost()), "bangbros_remember_me", Cookies.NOTDELETEDPATTERN) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccountInfo fetchAccountInfo(final Account account) throws Exception {
|
||||
final AccountInfo ai = new AccountInfo();
|
||||
login(this.br, account, true);
|
||||
ai.setUnlimitedTraffic();
|
||||
/* 2020-08-12: Assume that all valid accounts are premium accounts */
|
||||
account.setType(AccountType.PREMIUM);
|
||||
account.setMaxSimultanDownloads(ACCOUNT_PREMIUM_MAXDOWNLOADS);
|
||||
account.setConcurrentUsePossible(true);
|
||||
return ai;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlePremium(final DownloadLink link, final Account account) throws Exception {
|
||||
requestFileInformation(link, account);
|
||||
if (StringUtils.isEmpty(dllink)) {
|
||||
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
|
||||
}
|
||||
dl = jd.plugins.BrowserAdapter.openDownload(br, link, dllink, ACCOUNT_PREMIUM_RESUME, ACCOUNT_PREMIUM_MAXCHUNKS);
|
||||
if (!this.looksLikeDownloadableContent(dl.getConnection())) {
|
||||
logger.warning("The final dllink seems not to be a file!");
|
||||
br.followConnection(true);
|
||||
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
|
||||
}
|
||||
link.setProperty("premium_directlink", dllink);
|
||||
dl.startDownload();
|
||||
}
|
||||
|
||||
public boolean allowHandle(final DownloadLink link, final PluginForHost plugin) {
|
||||
final boolean is_this_plugin = link.getHost().equalsIgnoreCase(plugin.getHost());
|
||||
if (is_this_plugin) {
|
||||
/* The original plugin is always allowed to download. */
|
||||
return true;
|
||||
} else if (!link.isEnabled() && "".equals(link.getPluginPatternMatcher())) {
|
||||
/*
|
||||
* setMultiHostSupport uses a dummy DownloadLink, with isEnabled == false. we must set to true for the host to be added to the
|
||||
* supported host array.
|
||||
*/
|
||||
return true;
|
||||
} else if (getMainlink(link) != null && getMainlink(link).matches(BangbrosComCrawler.type_userinput_video_couldbe_trailer)) {
|
||||
/* Multihost download only possible for specified linktype. */
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String buildExternalDownloadURL(final DownloadLink downloadLink, final PluginForHost buildForThisPlugin) {
|
||||
if (buildForThisPlugin != null && !StringUtils.equals(this.getHost(), buildForThisPlugin.getHost())) {
|
||||
return getMainlink(downloadLink);
|
||||
} else {
|
||||
return super.buildExternalDownloadURL(downloadLink, buildForThisPlugin);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Download videos- and pictures with the bangbros.com plugin.";
|
||||
}
|
||||
|
||||
public static final boolean default_SETTING_BEST_ONLY = false;
|
||||
|
||||
private void setConfigElements() {
|
||||
final ConfigEntry best = new ConfigEntry(ConfigContainer.TYPE_CHECKBOX, getPluginConfig(), SETTING_BEST_ONLY, "Best only?").setDefaultValue(default_SETTING_BEST_ONLY);
|
||||
getConfig().addEntry(best);
|
||||
getConfig().addEntry(new ConfigEntry(ConfigContainer.TYPE_CHECKBOX, getPluginConfig(), "GRAB_480p", "Grab 480p (mp4)?").setDefaultValue(true).setEnabledCondidtion(best, false));
|
||||
getConfig().addEntry(new ConfigEntry(ConfigContainer.TYPE_CHECKBOX, getPluginConfig(), "GRAB_720p", "Grab 720p (mp4)?").setDefaultValue(true).setEnabledCondidtion(best, false));
|
||||
getConfig().addEntry(new ConfigEntry(ConfigContainer.TYPE_CHECKBOX, getPluginConfig(), "GRAB_1080p", "Grab 1080p (mp4)?").setDefaultValue(true).setEnabledCondidtion(best, false));
|
||||
getConfig().addEntry(new ConfigEntry(ConfigContainer.TYPE_CHECKBOX, getPluginConfig(), "GRAB_2160p", "Grab 2160p (mp4)?").setDefaultValue(true).setEnabledCondidtion(best, false));
|
||||
getConfig().addEntry(new ConfigEntry(ConfigContainer.TYPE_CHECKBOX, getPluginConfig(), "GRAB_photos", "Grab photos (.zip containing images)?").setDefaultValue(false));
|
||||
getConfig().addEntry(new ConfigEntry(ConfigContainer.TYPE_CHECKBOX, getPluginConfig(), "GRAB_screencaps", "Grab screencaps (.zip containing images)?").setDefaultValue(false));
|
||||
getConfig().addEntry(new ConfigEntry(ConfigContainer.TYPE_CHECKBOX, getPluginConfig(), "PREFER_ORIGINAL_FILENAMES", "Use original/serverside filenames?").setDefaultValue(false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxSimultanPremiumDownloadNum() {
|
||||
return ACCOUNT_PREMIUM_MAXDOWNLOADS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetDownloadlink(DownloadLink link) {
|
||||
}
|
||||
}
|
@ -68,12 +68,12 @@ public class BoxbitApp extends PluginForHost {
|
||||
@SuppressWarnings("deprecation")
|
||||
public BoxbitApp(PluginWrapper wrapper) {
|
||||
super(wrapper);
|
||||
this.enablePremium("https://boxbit.app/!/register");
|
||||
this.enablePremium("https://" + getHost() + "/!/register");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAGBLink() {
|
||||
return "https://boxbit.app/";
|
||||
return "https://" + getHost() + "/";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -39,6 +39,7 @@ import jd.plugins.DownloadLink.AvailableStatus;
|
||||
import jd.plugins.HostPlugin;
|
||||
import jd.plugins.LinkStatus;
|
||||
import jd.plugins.PluginException;
|
||||
import jd.plugins.PluginForHost;
|
||||
import jd.plugins.components.SiteType.SiteTemplate;
|
||||
|
||||
@HostPlugin(revision = "$Revision$", interfaceVersion = 3, names = {}, urls = {})
|
||||
@ -55,7 +56,6 @@ public class JoinPeerTubeOrg extends antiDDoSForHost {
|
||||
/* Connection stuff */
|
||||
private static final boolean free_resume = true;
|
||||
private static final int free_maxchunks = 0;
|
||||
private static final int free_maxdownloads = -1;
|
||||
private String mp4dllink = null;
|
||||
private String m3u8dllink = null;
|
||||
private boolean server_issues = false;
|
||||
@ -355,7 +355,7 @@ public class JoinPeerTubeOrg extends antiDDoSForHost {
|
||||
|
||||
@Override
|
||||
public int getMaxSimultanFreeDownloadNum() {
|
||||
return free_maxdownloads;
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -386,6 +386,12 @@ public class JoinPeerTubeOrg extends antiDDoSForHost {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean allowHandle(final DownloadLink link, final PluginForHost plugin) {
|
||||
/* Allow only downloads with original plugin. */
|
||||
return link.getHost().equalsIgnoreCase(plugin.getHost());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends JoinPeerTubeOrgConfig> getConfigInterface() {
|
||||
return JoinPeerTubeOrgConfig.class;
|
||||
|
@ -16,11 +16,9 @@
|
||||
package jd.plugins.hoster;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.appwork.utils.StringUtils;
|
||||
import org.appwork.utils.formatter.TimeFormatter;
|
||||
import org.appwork.utils.formatter.SizeFormatter;
|
||||
import org.jdownloader.captcha.v2.challenge.recaptcha.v2.CaptchaHelperHostPluginRecaptchaV2;
|
||||
import org.jdownloader.plugins.controller.LazyPlugin;
|
||||
|
||||
@ -28,7 +26,9 @@ import jd.PluginWrapper;
|
||||
import jd.http.Browser;
|
||||
import jd.http.Cookies;
|
||||
import jd.nutils.encoding.Encoding;
|
||||
import jd.parser.Regex;
|
||||
import jd.parser.html.Form;
|
||||
import jd.parser.html.Form.MethodType;
|
||||
import jd.plugins.Account;
|
||||
import jd.plugins.Account.AccountType;
|
||||
import jd.plugins.AccountInfo;
|
||||
@ -45,18 +45,16 @@ import jd.plugins.components.MultiHosterManagement;
|
||||
@HostPlugin(revision = "$Revision$", interfaceVersion = 3, names = { "linkgen.vip" }, urls = { "" })
|
||||
public class LinkgenVip extends PluginForHost {
|
||||
/* Connection limits */
|
||||
private final boolean ACCOUNT_PREMIUM_RESUME = true;
|
||||
private final int ACCOUNT_PREMIUM_MAXCHUNKS = 0;
|
||||
private static MultiHosterManagement mhm = new MultiHosterManagement("linkgen.vip");
|
||||
private static MultiHosterManagement mhm = new MultiHosterManagement("linkgen.vip");
|
||||
|
||||
public LinkgenVip(PluginWrapper wrapper) {
|
||||
super(wrapper);
|
||||
this.enablePremium("https://linkgen.vip/premium.php");
|
||||
this.enablePremium("https://" + getHost() + "/premium.php");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAGBLink() {
|
||||
return "https://linkgen.vip/legal.php";
|
||||
return "https://" + getHost() + "/legal.php";
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -97,91 +95,204 @@ public class LinkgenVip extends PluginForHost {
|
||||
return new LazyPlugin.FEATURE[] { LazyPlugin.FEATURE.MULTIHOST };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isResumeable(final DownloadLink link, final Account account) {
|
||||
final AccountType type = account != null ? account.getType() : null;
|
||||
if (AccountType.FREE.equals(type)) {
|
||||
/* Free Account */
|
||||
return true;
|
||||
} else if (AccountType.PREMIUM.equals(type) || AccountType.LIFETIME.equals(type)) {
|
||||
/* Premium account */
|
||||
return true;
|
||||
} else {
|
||||
/* Free(anonymous) and unknown account type */
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int getMaxChunks(final DownloadLink link, final Account account) {
|
||||
final AccountType type = account != null ? account.getType() : null;
|
||||
if (AccountType.FREE.equals(type)) {
|
||||
/* Free Account */
|
||||
return 1;
|
||||
} else if (AccountType.PREMIUM.equals(type) || AccountType.LIFETIME.equals(type)) {
|
||||
/* Premium account */
|
||||
return 0;
|
||||
} else {
|
||||
/* Free(anonymous) and unknown account type */
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMultiHost(final DownloadLink link, final Account account) throws Exception {
|
||||
mhm.runCheck(account, link);
|
||||
login(account, false);
|
||||
String dllink = null;
|
||||
if (StringUtils.isEmpty(dllink)) {
|
||||
mhm.handleErrorGeneric(account, link, "Failed to find final downloadlink", 20, 5 * 60 * 1000l);
|
||||
final String directlinkproperty = this.getHost() + "_directlink";
|
||||
final String storedDirecturl = link.getStringProperty(directlinkproperty);
|
||||
final String dllink;
|
||||
if (storedDirecturl != null) {
|
||||
logger.info("Attempting to re-use stored directurl: " + storedDirecturl);
|
||||
dllink = storedDirecturl;
|
||||
} else {
|
||||
login(account, true);
|
||||
final String url = link.getDefaultPlugin().buildExternalDownloadURL(link, this);
|
||||
final Form dlform = new Form();
|
||||
dlform.setMethod(MethodType.POST);
|
||||
dlform.setAction("/downloader.php?rand=0." + System.currentTimeMillis());
|
||||
dlform.put("urllist", Encoding.urlEncode(url));
|
||||
dlform.put("captcha", "none");
|
||||
br.submitForm(dlform);
|
||||
dllink = br.getRegex("<a href=.(https?://[^<>\"']+)' target=.\\d+").getMatch(0);
|
||||
if (StringUtils.isEmpty(dllink)) {
|
||||
String errormessage = br.getRegex("<font color=red[^>]*>([^<]+)</font>").getMatch(0);
|
||||
if (errormessage != null) {
|
||||
/* E.g. <b> <font color=red face=Arial size=2> Error On Generating. Please Retry Later !!!</font></b><BR> */
|
||||
errormessage = Encoding.htmlDecode(errormessage).trim();
|
||||
mhm.handleErrorGeneric(account, link, errormessage, 20, 5 * 60 * 1000l);
|
||||
} else {
|
||||
mhm.handleErrorGeneric(account, link, "Failed to find final downloadlink", 20, 5 * 60 * 1000l);
|
||||
}
|
||||
}
|
||||
}
|
||||
dl = jd.plugins.BrowserAdapter.openDownload(br, link, dllink, ACCOUNT_PREMIUM_RESUME, ACCOUNT_PREMIUM_MAXCHUNKS);
|
||||
dl = jd.plugins.BrowserAdapter.openDownload(br, link, dllink, this.isResumeable(link, account), this.getMaxChunks(link, account));
|
||||
if (!this.looksLikeDownloadableContent(dl.getConnection())) {
|
||||
br.followConnection(true);
|
||||
mhm.handleErrorGeneric(account, link, "Final downloadurl did not lead to file", 2, 5 * 60 * 1000l);
|
||||
mhm.handleErrorGeneric(account, link, "Final downloadurl did not lead to file", 10, 3 * 60 * 1000l);
|
||||
}
|
||||
try {
|
||||
dl = jd.plugins.BrowserAdapter.openDownload(br, link, dllink, this.isResumeable(link, account), this.getMaxChunks(link, account));
|
||||
if (!this.looksLikeDownloadableContent(dl.getConnection())) {
|
||||
br.followConnection(true);
|
||||
mhm.handleErrorGeneric(account, link, "Final downloadurl did not lead to file", 10, 3 * 60 * 1000l);
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
if (storedDirecturl != null) {
|
||||
link.removeProperty(directlinkproperty);
|
||||
throw new PluginException(LinkStatus.ERROR_RETRY, "Stored directurl expired", e);
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
if (storedDirecturl == null) {
|
||||
link.setProperty(directlinkproperty, dllink);
|
||||
}
|
||||
this.dl.startDownload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AccountInfo fetchAccountInfo(final Account account) throws Exception {
|
||||
final AccountInfo ai = new AccountInfo();
|
||||
login(account, true);
|
||||
br.getPage("https://" + this.getHost() + "/");
|
||||
ArrayList<String> supportedHosts = new ArrayList<String>();
|
||||
final AccountInfo ai = new AccountInfo();
|
||||
final Regex expireRegex = br.getRegex("(\\d+) Days?\\s*(\\d+) Hours?");
|
||||
final Regex linksUsedDailyRegex = br.getRegex("Links Today:\\s*<[^>]*>(\\d+)\\s*/\\s*(\\d+)");
|
||||
final Regex trafficUsedDailyRegex = br.getRegex("Used Today:\\s*<[^>]*>([^/<]+)/([^<]+)</font>");
|
||||
if (!expireRegex.patternFind()) {
|
||||
/* No expire time found -> Assume that this is an expired account or it has never been a premium account. */
|
||||
ai.setExpired(true);
|
||||
return ai;
|
||||
} else if (!linksUsedDailyRegex.patternFind()) {
|
||||
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT, "Failed to find daily links limits");
|
||||
} else if (!trafficUsedDailyRegex.patternFind()) {
|
||||
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT, "Failed to find daily traffic limits");
|
||||
}
|
||||
account.setType(AccountType.PREMIUM);
|
||||
final String expire = br.getRegex("TODO_fixme").getMatch(0);
|
||||
if (expire != null) {
|
||||
ai.setValidUntil(TimeFormatter.getMilliSeconds(expire, "MM/dd/yyyy hh:mm a", Locale.US), br);
|
||||
final int dailyLinksUsed = Integer.parseInt(linksUsedDailyRegex.getMatch(0));
|
||||
final int dailyLinksMax = Integer.parseInt(linksUsedDailyRegex.getMatch(1));
|
||||
if (dailyLinksUsed >= dailyLinksMax) {
|
||||
throw new AccountUnavailableException("Reached max daily links limit", 5 * 60 * 1000);
|
||||
}
|
||||
br.getPage("/todo_fixme.php");
|
||||
final String[] hostlist = br.getRegex("TODO").getColumn(0);
|
||||
if (hostlist != null) {
|
||||
supportedHosts = new ArrayList<String>(Arrays.asList(hostlist));
|
||||
final int days = Integer.parseInt(expireRegex.getMatch(0));
|
||||
final int hours = Integer.parseInt(expireRegex.getMatch(1));
|
||||
final long validMilliseconds = (days * 24 * 60 * 60 * 1000) + (hours * 60 * 1000);
|
||||
String statusText = account.getType().getLabel();
|
||||
statusText += " | Daily links used: " + dailyLinksUsed + "/" + dailyLinksMax;
|
||||
final long trafficUsed = SizeFormatter.getSize(trafficUsedDailyRegex.getMatch(0));
|
||||
final long trafficMax = SizeFormatter.getSize(trafficUsedDailyRegex.getMatch(1));
|
||||
ai.setTrafficLeft(trafficMax - trafficUsed);
|
||||
ai.setTrafficMax(trafficMax);
|
||||
ai.setValidUntil(System.currentTimeMillis() + validMilliseconds, br);
|
||||
ai.setStatus(statusText);
|
||||
br.getPage("/host.php");
|
||||
final ArrayList<String> supportedHosts = new ArrayList<String>();
|
||||
final String[] htmls = br.getRegex("<tr class=\"text-center\">(.*?)</tr>").getColumn(0);
|
||||
if (htmls == null || htmls.length == 0) {
|
||||
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT, "Failed to find list of supported hosts");
|
||||
}
|
||||
for (final String html : htmls) {
|
||||
String host = new Regex(html, "fhimg/[^>]*>([^<]+)<").getMatch(0);
|
||||
if (host == null) {
|
||||
logger.info("Skipping invalid entry: " + html);
|
||||
continue;
|
||||
}
|
||||
host = host.trim();
|
||||
// TODO: Find- and set individual host limits
|
||||
// final String[] allRows = new Regex(html, "<td>([^<]+)</td>").getColumn(0);
|
||||
// final boolean isOnline = new Regex(html, "Online\\s*<").patternFind();
|
||||
final boolean isOffline = new Regex(html, "Offline\\s*<").patternFind();
|
||||
// final boolean isUnstable = new Regex(html, "Unstable\\s*<").patternFind();
|
||||
if (isOffline) {
|
||||
logger.info("Skipping offline entry: " + host);
|
||||
continue;
|
||||
}
|
||||
supportedHosts.add(host);
|
||||
}
|
||||
if (supportedHosts.size() == 0) {
|
||||
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT, "Failed to find list of supported hosts");
|
||||
}
|
||||
ai.setUnlimitedTraffic();
|
||||
ai.setMultiHostSupport(this, supportedHosts);
|
||||
return ai;
|
||||
}
|
||||
|
||||
private void login(final Account account, final boolean force) throws Exception {
|
||||
synchronized (account) {
|
||||
try {
|
||||
final Cookies cookies = account.loadCookies("");
|
||||
if (cookies != null) {
|
||||
this.br.setCookies(this.getHost(), cookies);
|
||||
if (!force) {
|
||||
/* Do not check cookies */
|
||||
return;
|
||||
}
|
||||
br.getPage("https://" + this.getHost() + "/");
|
||||
if (isLoggedin(br)) {
|
||||
logger.info("Cookie login successful");
|
||||
account.saveCookies(this.br.getCookies(br.getHost()), "");
|
||||
return;
|
||||
} else {
|
||||
logger.info("Cookie login failed");
|
||||
br.clearCookies(null);
|
||||
}
|
||||
final Cookies cookies = account.loadCookies("");
|
||||
final String targetPath = "/downloader.php";
|
||||
if (cookies != null) {
|
||||
this.br.setCookies(this.getHost(), cookies);
|
||||
if (!force) {
|
||||
/* Do not check cookies */
|
||||
return;
|
||||
}
|
||||
br.getPage("https://" + this.getHost() + "/login.php");
|
||||
final Form loginform = br.getFormbyProperty("name", "UsernameLoginForm");
|
||||
loginform.put("username", Encoding.urlEncode(account.getUser()));
|
||||
loginform.put("password", Encoding.urlEncode(account.getPass()));
|
||||
final String recaptchaV2Response = new CaptchaHelperHostPluginRecaptchaV2(this, br).getToken();
|
||||
loginform.put("g-recaptcha-response", Encoding.urlEncode(recaptchaV2Response));
|
||||
br.submitForm(loginform);
|
||||
if (!isLoggedin(br)) {
|
||||
final String loginErrormessage = br.getRegex("class=\"error\"[^>]*>\\s*<p><b>([^<]+)</b></p>").getMatch(0);
|
||||
if (loginErrormessage != null) {
|
||||
throw new AccountInvalidException(Encoding.htmlDecode(loginErrormessage).trim());
|
||||
} else {
|
||||
throw new AccountInvalidException();
|
||||
}
|
||||
br.getPage("https://" + this.getHost() + targetPath);
|
||||
if (isLoggedin(br)) {
|
||||
logger.info("Cookie login successful");
|
||||
account.saveCookies(this.br.getCookies(br.getHost()), "");
|
||||
return;
|
||||
} else {
|
||||
logger.info("Cookie login failed");
|
||||
br.clearCookies(null);
|
||||
account.clearCookies("");
|
||||
}
|
||||
account.saveCookies(this.br.getCookies(br.getHost()), "");
|
||||
if (true) {
|
||||
throw new AccountUnavailableException("Unfinished plugin: Contact JDownloader support", 3 * 60 * 1000l);
|
||||
}
|
||||
} catch (final PluginException e) {
|
||||
account.clearCookies("");
|
||||
throw e;
|
||||
}
|
||||
br.getPage("https://" + this.getHost() + "/login.php");
|
||||
final Form loginform = br.getFormbyProperty("name", "UsernameLoginForm");
|
||||
loginform.put("username", Encoding.urlEncode(account.getUser()));
|
||||
loginform.put("password", Encoding.urlEncode(account.getPass()));
|
||||
final String recaptchaV2Response = new CaptchaHelperHostPluginRecaptchaV2(this, br).getToken();
|
||||
loginform.put("g-recaptcha-response", Encoding.urlEncode(recaptchaV2Response));
|
||||
br.submitForm(loginform);
|
||||
final Form loginform2 = br.getFormbyActionRegex("signin.php");
|
||||
if (loginform2 != null) {
|
||||
/* Strange 2nd step - "Please Enter Username To Login" */
|
||||
logger.info("Performing 2nd login step");
|
||||
loginform2.put("secure", Encoding.urlEncode(account.getUser()));
|
||||
br.submitForm(loginform2);
|
||||
}
|
||||
if (!isLoggedin(br)) {
|
||||
final String loginErrormessage = br.getRegex("class=\"error\"[^>]*>\\s*<p><b>([^<]+)</b></p>").getMatch(0);
|
||||
if (loginErrormessage != null) {
|
||||
throw new AccountInvalidException(Encoding.htmlDecode(loginErrormessage).trim());
|
||||
} else {
|
||||
throw new AccountInvalidException();
|
||||
}
|
||||
}
|
||||
br.getPage(targetPath);
|
||||
account.saveCookies(br.getCookies(br.getHost()), "");
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isLoggedin(final Browser br) {
|
||||
return br.containsHTML("/logout");
|
||||
return br.containsHTML("logout.php");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -119,6 +119,7 @@ public class PornportalCom extends PluginForHost {
|
||||
ret.add(new String[] { "seancody.com" });
|
||||
ret.add(new String[] { "dancingbear.com" });
|
||||
ret.add(new String[] { "adultmobile.com" });
|
||||
ret.add(new String[] { "mygf.com" });
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,6 @@ public interface ArdConfigInterface extends PluginConfigInterface {
|
||||
public String getOnlyBestVideoQualityOfSelectedQualitiesEnabled_label() {
|
||||
return _JDT.T.lit_add_only_the_best_video_quality_within_user_selected_formats();
|
||||
}
|
||||
|
||||
// public String getAddUnknownQualitiesEnabled_label() {
|
||||
// return _JDT.T.lit_add_unknown_formats();
|
||||
// }
|
||||
@ -273,7 +272,7 @@ public interface ArdConfigInterface extends PluginConfigInterface {
|
||||
ALWAYS_WHEN_HLS_IS_SELECTED {
|
||||
@Override
|
||||
public String getLabel() {
|
||||
return "Return HLS streams if any are selected";
|
||||
return "Always return HLS streams if selected";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user