*Plugins: Fixes/Changes/Maintenance*

- MangahomeComCrawler: fixed RE forum 88676
- VoeSxCrawler: added new domain RE forum 90585
- VKontakteRuHoster: linkOk: nullify of DownloadInterface caused download failure when invalid directurl was refreshed just before RE forum 96008
- CivitaiCom: added Packagizer property suggested by user RE forum 96338
- PornportalCom: getMaxSimultanPremiumDownloadNum: set this to 1 to counter rate limit problems RE forum 96341
- UploadrarCom: fixed bad filenames RE forum 96350
- PrtctdScdvntCm: minor changes
- [XFS] TurbovidCo: added errorhandling for "Video not available at the moment" RE forum 96337
- SourceForgeNet: some refactoring RE forum 96335
- BatoToCrawlerV3: fixed crawler not finding all chapters of an album RE forum 90169
- DiskYandexNet: implemented DiskYandexNetConfig

git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@49674 ebf7c1c2-ba36-0410-9fe8-c592906822b4

Former-commit-id: 283d4f8324b7c1a4c238b0eca3597eeb846b558f
This commit is contained in:
psp 2024-08-27 14:38:59 +00:00
parent 0d00120df3
commit 115c93a5c7
11 changed files with 197 additions and 228 deletions

View File

@ -29,6 +29,8 @@ import jd.PluginWrapper;
import jd.controlling.AccountController;
import jd.controlling.ProgressController;
import jd.nutils.encoding.Encoding;
import jd.parser.Regex;
import jd.parser.html.HTMLParser;
import jd.parser.html.HTMLSearch;
import jd.plugins.Account;
import jd.plugins.CryptedLink;
@ -76,10 +78,13 @@ public class BatoToCrawlerV3 extends PluginForDecrypt {
return buildAnnotationUrls(getPluginDomains());
}
private static final Pattern PATTERN_ALBUM = Pattern.compile("/title/(\\d+)-([a-z0-9\\-]+)$");
private static final Pattern PATTERN_CHAPTER = Pattern.compile("/title/(\\d+)-([a-z0-9\\-]+)/\\d+-(vol_\\d+-)?ch_\\d+");
public static String[] buildAnnotationUrls(final List<String[]> pluginDomains) {
final List<String> ret = new ArrayList<String>();
for (final String[] domains : pluginDomains) {
ret.add("https?://(?:www\\.)?" + buildHostsPatternPart(domains) + "/title/\\d+-[a-z0-9\\-]+(/\\d+-(vol_\\d+-)?ch_\\d+)?");
ret.add("https?://(?:www\\.)?" + buildHostsPatternPart(domains) + "(" + PATTERN_ALBUM.pattern() + "|" + PATTERN_CHAPTER.pattern() + ")");
}
return ret.toArray(new String[0]);
}
@ -101,7 +106,9 @@ public class BatoToCrawlerV3 extends PluginForDecrypt {
if (acc != null) {
((jd.plugins.hoster.BatoTo) hostPlugin).login(acc, false);
}
br.getPage(param.getCryptedUrl());
final String contenturl = param.getCryptedUrl();
final String albumID = new Regex(contenturl, PATTERN_ALBUM).getMatch(0);
br.getPage(contenturl);
if (br.getHttpConnection().getResponseCode() == 404) {
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
}
@ -152,14 +159,23 @@ public class BatoToCrawlerV3 extends PluginForDecrypt {
}
}
logger.info("Failed to find images of a single chapter");
/* No results were found so check if we got a series of which we want to find the URLs to all chapters */
final String[] chapterurls = br.getRegex("(" + Pattern.quote(urlpath) + "/\\d+-(vol_\\d+-)?ch_\\d+)").getColumn(0);
if (chapterurls == null || chapterurls.length == 0) {
final String[] urls = HTMLParser.getHttpLinks(br.getRequest().getHtmlCode(), br.getURL());
for (final String url : urls) {
if (new Regex(url, PATTERN_CHAPTER).patternFind() && url.contains("title/" + albumID)) {
ret.add(this.createDownloadlink(url));
}
}
if (ret.isEmpty()) {
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
}
for (final String chapterurl : chapterurls) {
ret.add(this.createDownloadlink(br.getURL(chapterurl).toExternalForm()));
}
// /* No results were found so check if we got a series of which we want to find the URLs to all chapters */
// final String[] chapterurls = br.getRegex("(" + Pattern.quote(urlpath) + "/\\d+-(vol_\\d+-)?ch_\\d+)").getColumn(0);
// if (chapterurls == null || chapterurls.length == 0) {
// throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
// }
// for (final String chapterurl : chapterurls) {
// ret.add(this.createDownloadlink(br.getURL(chapterurl).toExternalForm()));
// }
return ret;
}

View File

@ -17,11 +17,13 @@ package jd.plugins.decrypter;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashSet;
import org.jdownloader.plugins.components.antiDDoSForDecrypt;
import jd.PluginWrapper;
import jd.controlling.ProgressController;
import jd.http.Browser;
import jd.parser.Regex;
import jd.plugins.CryptedLink;
import jd.plugins.DecrypterPlugin;
@ -29,6 +31,7 @@ import jd.plugins.DownloadLink;
import jd.plugins.FilePackage;
import jd.plugins.LinkStatus;
import jd.plugins.PluginException;
import jd.plugins.hoster.DirectHTTP;
@DecrypterPlugin(revision = "$Revision$", interfaceVersion = 3, names = { "mangahome.com" }, urls = { "https?://(?:www\\.)?(mangakoi|mangahome)\\.com/manga/[A-Za-z0-9\\-_]+(?:/v\\d+)?/c\\d+(?:\\.\\d+)?" })
public class MangahomeComCrawler extends antiDDoSForDecrypt {
@ -36,15 +39,21 @@ public class MangahomeComCrawler extends antiDDoSForDecrypt {
super(wrapper);
}
public ArrayList<DownloadLink> decryptIt(final CryptedLink param, ProgressController progress) throws Exception {
final ArrayList<DownloadLink> ret = new ArrayList<DownloadLink>();
final String url = param.toString().replaceFirst("mangakoi\\.com", "mangahome.com");
@Override
public Browser createNewBrowserInstance() {
final Browser br = super.createNewBrowserInstance();
br.setFollowRedirects(true);
getPage(url);
return br;
}
public ArrayList<DownloadLink> decryptIt(final CryptedLink param, ProgressController progress) throws Exception {
/* Domain mangakoi.com is down / not owned by original owner anymore. */
final String contenturl = param.toString().replaceFirst("mangakoi\\.com", "mangahome.com");
getPage(contenturl);
if (br.getHttpConnection().getResponseCode() == 404) {
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
}
final Regex urlinfo = new Regex(url, "https?://[^/]+/manga/([A-Za-z0-9\\-_]+)(?:/v\\d+)?/c(\\d+(?:\\.\\d+)?)");
final Regex urlinfo = new Regex(contenturl, "https?://[^/]+/manga/([A-Za-z0-9\\-_]+)(?:/v\\d+)?/c(\\d+(?:\\.\\d+)?)");
final String chapter_str = urlinfo.getMatch(1);
final String chapter_str_main;
String chapter_str_extra = "";
@ -64,28 +73,25 @@ public class MangahomeComCrawler extends antiDDoSForDecrypt {
if (ext == null) {
ext = ".jpg";
}
short page_max = 0;
final String[] pages = this.br.getRegex("<option[^>]*>(\\d+)</option>").getColumn(0);
for (final String page_temp_str : pages) {
final short page_temp = Short.parseShort(page_temp_str);
if (page_temp > page_max) {
page_max = page_temp;
final String[] urls = this.br.getRegex("class=\"image\" src=\"([^\"]+)").getColumn(0);
if (urls == null || urls.length == 0) {
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
}
final HashSet<String> dupes = new HashSet<String>();
final ArrayList<DownloadLink> ret = new ArrayList<DownloadLink>();
for (short page = 1; page < urls.length; page++) {
String url = urls[page];
url = br.getURL(url).toExternalForm();
if (!dupes.add(url)) {
/* Skip dupes */
continue;
}
}
if (page_max == 0) {
logger.info("Failed to find any downloadable content");
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
}
for (short page = 1; page <= page_max; page++) {
final String chapter_formatted = df_chapter.format(chapter_main);
final String page_formatted = df_page.format(page);
// final String finallink = "directhttp://" + server_urlpart + chapter_formatted + chapter_str_extra + "-" + page_formatted +
final String singleImageContentURL = this.br.getBaseURL() + "c" + chapter_str + "/" + page + ".html";
final DownloadLink dl = this.createDownloadlink(singleImageContentURL);
final DownloadLink dl = this.createDownloadlink(DirectHTTP.createURLForThisPlugin(url));
final String filename = url_name + "_" + chapter_formatted + chapter_str_extra + "_" + page_formatted + ext;
dl.setName(filename);
dl.setProperty("filename", filename);
dl.setLinkID(filename);
dl.setAvailable(true);
ret.add(dl);
}

View File

@ -42,18 +42,17 @@ public class PrtctdScdvntCm extends antiDDoSForDecrypt {
}
/*
* At the moment this decrypter only decrypts: turbobit.net, hotfile.com links as "protected.socadvnet.com" only allows crypting links
* of this host!
* At the moment this crawler only crawls: turbobit.net, hotfile.com links as "protected.socadvnet.com" only allows crypting links of
* this host!
*/
@Override
public ArrayList<DownloadLink> decryptIt(final CryptedLink param, final ProgressController progress) throws Exception {
final ArrayList<DownloadLink> decryptedLinks = new ArrayList<DownloadLink>();
final String parameter = param.toString();
final String parameter = param.getCryptedUrl();
br.setFollowRedirects(true);
br.getHeaders().put("User-Agent", UserAgents.stringUserAgent());
final String postvar = new Regex(parameter, "protected\\.socadvnet\\.com/\\?(.+)").getMatch(0);
if (postvar == null) {
return null;
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
}
getPage(parameter);
if (!this.canHandle(br.getURL())) {
@ -80,7 +79,7 @@ public class PrtctdScdvntCm extends antiDDoSForDecrypt {
linksCount = xhr.getRequest().getHtmlCode().split("\\|");
}
if (linksCount == null || linksCount.length == 0) {
return null;
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
}
final int linkCounter = linksCount.length;
if (cpPage != null) {
@ -107,11 +106,12 @@ public class PrtctdScdvntCm extends antiDDoSForDecrypt {
throw new PluginException(LinkStatus.ERROR_CAPTCHA);
}
}
final ArrayList<DownloadLink> ret = new ArrayList<DownloadLink>();
br.setFollowRedirects(false);
for (int i = 0; i <= linkCounter - 1; i++) {
logger.info("Crawling item " + (i + 1) + "/" + linkCounter);
final Browser br = this.br.cloneBrowser();
final String actualPage = getList + "?out_name=" + postvar + "&&link_id=" + i;
logger.info("Crawling item " + (i + 1) + "/" + linkCounter + " | " + actualPage);
getPage(br, actualPage);
if (br.containsHTML("(?i)This file is either removed due to copyright claim or is deleted by the uploader")) {
logger.info("Found one offline link for link " + parameter + " linkid:" + i);
@ -142,13 +142,13 @@ public class PrtctdScdvntCm extends antiDDoSForDecrypt {
if (fp != null) {
fp.add(link);
}
decryptedLinks.add(link);
ret.add(link);
distribute(link);
if (this.isAbort()) {
break;
}
}
return decryptedLinks;
return ret;
}
private Browser xhrPostPage(String page, String param) throws Exception {
@ -157,7 +157,7 @@ public class PrtctdScdvntCm extends antiDDoSForDecrypt {
return xhr;
}
/* NO OVERRIDE!! */
@Override
public boolean hasCaptcha(CryptedLink link, jd.plugins.Account acc) {
return true;
}

View File

@ -44,7 +44,7 @@ public class VoeSxCrawler extends PluginForDecrypt {
final List<String[]> ret = new ArrayList<String[]>();
ret.add(new String[] { "voe.sx", "voe-unblock.com", "voe-unblock.net", "voeunblock.com", "voeunblk.com", "voeunblck.com", "voe-un-block.com", "un-block-voe.net", "voeunbl0ck.com", "voeunblock1.com", "voeunblock2.com", "voeunblock3.com", "voeunblock4.com", "voeunblock5.com", "voeunblock6.com", "voeun-block.net", "v-o-e-unblock.com", "audaciousdefaulthouse.com", "launchreliantcleaverriver.com", "reputationsheriffkennethsand.com", "fittingcentermondaysunday.com", "housecardsummerbutton.com", "fraudclatterflyingcar.com", "bigclatterhomesguideservice.com", "uptodatefinishconferenceroom.com", "realfinanceblogcenter.com", "tinycat-voe-fashion.com", "20demidistance9elongations.com", "telyn610zoanthropy.com", "toxitabellaeatrebates306.com", "greaseball6eventual20.com", "745mingiestblissfully.com", "19turanosephantasia.com", "30sensualizeexpression.com", "321naturelikefurfuroid.com",
"449unceremoniousnasoseptal.com", "cyamidpulverulence530.com", "boonlessbestselling244.com", "antecoxalbobbing1010.com", "matriculant401merited.com", "scatch176duplicities.com", "35volitantplimsoles5.com", "tummulerviolableness.com", "tubelessceliolymph.com", "availedsmallest.com", "counterclockwisejacky.com", "monorhinouscassaba.com", "tummulerviolableness.com", "urochsunloath.com", "simpulumlamerop.com", "wolfdyslectic.com", "metagnathtuggers.com", "gamoneinterrupted.com", "chromotypic.com", "crownmakermacaronicism.com", "generatesnitrosate.com", "yodelswartlike.com", "figeterpiazine.com", "cigarlessarefy.com", "valeronevijao.com", "apinchcaseation.com", "nectareousoverelate.com", "phenomenalityuniform.com", "nonesnanking.com", "troyyourlead.com", "stevenimaginelittle.com", "edwardarriveoften.com", "lukecomparetwo.com", "bradleyviewdoctor.com", "jamiesamewalk.com",
"seanshowcould.com", "sandrataxeight.com", "jayservicestuff.com", "graceaddresscommunity.com", "loriwithinfamily.com", "roberteachfinal.com", "erikcoldperson.com", "jasminetesttry.com", "heatherdiscussionwhen.com", "robertplacespace.com", "alleneconomicmatter.com", "josephseveralconcern.com", "donaldlineelse.com" });
"seanshowcould.com", "sandrataxeight.com", "jayservicestuff.com", "graceaddresscommunity.com", "loriwithinfamily.com", "roberteachfinal.com", "erikcoldperson.com", "jasminetesttry.com", "heatherdiscussionwhen.com", "robertplacespace.com", "alleneconomicmatter.com", "josephseveralconcern.com", "donaldlineelse.com", "bethshouldercan.com" });
return ret;
}

View File

@ -95,6 +95,7 @@ public class CivitaiCom extends PluginForHost {
private static final Pattern PATTERN_IMAGE = Pattern.compile("/images/(\\d+).*", Pattern.CASE_INSENSITIVE);
private static final Pattern PATTERN_DOWNLOAD_MODELS = Pattern.compile("/api/download/models/(\\d+).*", Pattern.CASE_INSENSITIVE);
private final String PROPERTY_DIRECTURL = "directurl";
private static final String PROPERTY_DATE = "date";
@Override
public String getLinkID(final DownloadLink link) {
@ -212,6 +213,11 @@ public class CivitaiCom extends PluginForHost {
final String directurl = baseURL + imagemap.get("url") + "/width=" + metadata.get("width") + "/" + Encoding.urlEncode(filename);
link.setProperty(PROPERTY_DIRECTURL, directurl);
}
/* Set Packagizer properties */
final String createdAtStr = (String) imagemap.get("createdAt");
if (!StringUtils.isEmpty(createdAtStr)) {
link.setProperty(PROPERTY_DATE, createdAtStr);
}
} else {
if (isDownload) {
/* Do nothing - download handling will take care. */

View File

@ -36,12 +36,14 @@ import org.appwork.utils.parser.UrlQuery;
import org.jdownloader.downloader.hls.HLSDownloader;
import org.jdownloader.downloader.text.TextDownloader;
import org.jdownloader.gui.translate._GUI;
import org.jdownloader.plugins.components.config.DiskYandexNetConfig;
import org.jdownloader.plugins.components.config.DiskYandexNetConfig.ActionForMovedFiles;
import org.jdownloader.plugins.components.config.DiskYandexNetConfig.ActionForQuotaLimitedFiles;
import org.jdownloader.plugins.config.PluginJsonConfig;
import org.jdownloader.plugins.controller.LazyPlugin;
import org.jdownloader.scripting.JavaScriptEngineFactory;
import jd.PluginWrapper;
import jd.config.ConfigContainer;
import jd.config.ConfigEntry;
import jd.http.Browser;
import jd.http.Cookie;
import jd.http.Cookies;
@ -71,7 +73,6 @@ public class DiskYandexNet extends PluginForHost {
public DiskYandexNet(PluginWrapper wrapper) {
super(wrapper);
this.enablePremium("https://passport.yandex.ru/registration?mode=register&from=cloud");
setConfigElements();
}
@Override
@ -103,42 +104,35 @@ public class DiskYandexNet extends PluginForHost {
return "disk.yandex.com";
}
/* Settings values */
private final String MOVE_QUOTA_LIMITED_FILES_TO_ACCOUNT = "move_quota_limited_files_to_account";
private final String DELETE_MOVED_FILE_FROM_ACCOUNT_AFTER_QUOTA_LIMITED_DOWNLOAD = "delete_moved_file_from_account_after_quota_limited_download";
private final String EMPTY_TRASH_AFTER_QUOTA_LIMITED_DOWNLOAD = "empty_trash_after_quota_limited_download";
private final boolean MOVE_QUOTA_LIMITED_FILES_TO_ACCOUNT_default = true;
private final boolean DELETE_MOVED_FILE_FROM_ACCOUNT_AFTER_QUOTA_LIMITED_DOWNLOAD_default = true;
private final boolean EMPTY_TRASH_AFTER_DOWNLOAD_default = false;
/* Some constants which they used in browser */
public static final String CLIENT_ID = "12139679121706110849432";
public static final String CLIENT_ID = "12139679121706110849432";
/* Domains & other login stuff */
private final String[] cookie_domains = new String[] { "https://yandex.ru", "https://yandex.com", "https://disk.yandex.ru/", "https://disk.yandex.com/", "https://disk.yandex.net/", "https://disk.yandex.com.tr/", "https://disk.yandex.kz/" };
public static final String[] sk_domains = new String[] { "disk.yandex.com", "disk.yandex.ru", "disk.yandex.com.tr", "disk.yandex.ua", "disk.yandex.az", "disk.yandex.com.am", "disk.yandex.com.ge", "disk.yandex.co.il", "disk.yandex.kg", "disk.yandex.lt", "disk.yandex.lv", "disk.yandex.md", "disk.yandex.tj", "disk.yandex.tm", "disk.yandex.uz", "disk.yandex.fr", "disk.yandex.ee", "disk.yandex.kz", "disk.yandex.by" };
private final String[] cookie_domains = new String[] { "https://yandex.ru", "https://yandex.com", "https://disk.yandex.ru/", "https://disk.yandex.com/", "https://disk.yandex.net/", "https://disk.yandex.com.tr/", "https://disk.yandex.kz/" };
public static final String[] sk_domains = new String[] { "disk.yandex.com", "disk.yandex.ru", "disk.yandex.com.tr", "disk.yandex.ua", "disk.yandex.az", "disk.yandex.com.am", "disk.yandex.com.ge", "disk.yandex.co.il", "disk.yandex.kg", "disk.yandex.lt", "disk.yandex.lv", "disk.yandex.md", "disk.yandex.tj", "disk.yandex.tm", "disk.yandex.uz", "disk.yandex.fr", "disk.yandex.ee", "disk.yandex.kz", "disk.yandex.by" };
/* Properties */
public static final String PROPERTY_HASH = "hash_main";
public static final String PROPERTY_QUOTA_REACHED = "quoty_reached";
public static final String PROPERTY_CRAWLED_FILENAME = "plain_filename";
public static final String PROPERTY_PATH_INTERNAL = "path_internal";
public static final String PROPERTY_LAST_AUTH_SK = "last_auth_sk";
public static final String PROPERTY_LAST_LONG_SK = "last_long_sk";
public static final String PROPERTY_MEDIA_TYPE = "media_type";
public static final String PROPERTY_MIME_TYPE = "mine_type";
public static final String PROPERTY_PREVIEW_URL_ORIGINAL = "preview_url_original";
public static final String PROPERTY_PREVIEW_URL_DEFAULT = "preview_url_default";
public static final String PROPERTY_META_READ_ONLY = "meta_read_only";
public static final String PROPERTY_PASSWORD_TOKEN = "password_token";
public static final String PROPERTY_ACCOUNT_ENFORCE_COOKIE_LOGIN = "enforce_cookie_login";
private final String PROPERTY_ACCOUNT_USERID = "account_userid";
private static final String PROPERTY_NORESUME = "NORESUME";
public static final String COOKIE_KEY_PASSWORD_TOKEN = "passToken";
public static final String APIV1_BASE = "https://cloud-api.yandex.com/v1";
public static final String PROPERTY_HASH = "hash_main";
public static final String PROPERTY_QUOTA_REACHED = "quoty_reached";
public static final String PROPERTY_CRAWLED_FILENAME = "plain_filename";
public static final String PROPERTY_PATH_INTERNAL = "path_internal";
public static final String PROPERTY_LAST_AUTH_SK = "last_auth_sk";
public static final String PROPERTY_LAST_LONG_SK = "last_long_sk";
public static final String PROPERTY_MEDIA_TYPE = "media_type";
public static final String PROPERTY_MIME_TYPE = "mine_type";
public static final String PROPERTY_PREVIEW_URL_ORIGINAL = "preview_url_original";
public static final String PROPERTY_PREVIEW_URL_DEFAULT = "preview_url_default";
public static final String PROPERTY_META_READ_ONLY = "meta_read_only";
public static final String PROPERTY_PASSWORD_TOKEN = "password_token";
public static final String PROPERTY_ACCOUNT_ENFORCE_COOKIE_LOGIN = "enforce_cookie_login";
private final String PROPERTY_ACCOUNT_USERID = "account_userid";
private static final String PROPERTY_NORESUME = "NORESUME";
public static final String COOKIE_KEY_PASSWORD_TOKEN = "passToken";
public static final String APIV1_BASE = "https://cloud-api.yandex.com/v1";
/*
* https://tech.yandex.com/disk/api/reference/public-docpage/ 2018-08-09: API(s) seem to work fine again - in case of failure, please
* disable use_api_file_free_availablecheck ONLY!!
*/
private static final boolean allow_use_api_file_free_availablecheck = true;
private static final boolean allow_use_api_file_free_download = true;
private static final boolean allow_use_api_file_free_availablecheck = true;
private static final boolean allow_use_api_file_free_download = true;
@Override
public boolean isResumeable(final DownloadLink link, final Account account) {
@ -549,9 +543,8 @@ public class DiskYandexNet extends PluginForHost {
}
final String internal_file_path = getInternalFilePath(link, account);
InternalFileTrashHandlingThread thread = null;
final boolean deleteMovedFile = getPluginConfig().getBooleanProperty(DELETE_MOVED_FILE_FROM_ACCOUNT_AFTER_QUOTA_LIMITED_DOWNLOAD, DELETE_MOVED_FILE_FROM_ACCOUNT_AFTER_QUOTA_LIMITED_DOWNLOAD_default);
final boolean emptyWholeTrashCan = getPluginConfig().getBooleanProperty(EMPTY_TRASH_AFTER_QUOTA_LIMITED_DOWNLOAD, EMPTY_TRASH_AFTER_DOWNLOAD_default);
if (internal_file_path != null && brc != null && (deleteMovedFile || emptyWholeTrashCan)) {
final ActionForMovedFiles action = PluginJsonConfig.get(DiskYandexNetConfig.class).getActionForMovedFiles();
if (internal_file_path != null && brc != null && (action == ActionForMovedFiles.DELETE_FROM_ACCOUNT || action == ActionForMovedFiles.DELETE_FROM_ACCOUNT_AND_EMPTY_TRASH)) {
thread = new InternalFileTrashHandlingThread(this, brc, link, account);
thread.start();
}
@ -595,7 +588,7 @@ public class DiskYandexNet extends PluginForHost {
logger.warning("Important value is missing! authSk=" + authSk + " | longSK=" + longSK + " | internal_file_path=" + internal_file_path + " | userID=" + userID);
return;
}
final boolean emptyWholeTrashCan = this.plg.getPluginConfig().getBooleanProperty(EMPTY_TRASH_AFTER_QUOTA_LIMITED_DOWNLOAD, EMPTY_TRASH_AFTER_DOWNLOAD_default);
final boolean emptyWholeTrashCan = PluginJsonConfig.get(DiskYandexNetConfig.class).getActionForMovedFiles() == ActionForMovedFiles.DELETE_FROM_ACCOUNT_AND_EMPTY_TRASH;
plg.logger.info("Trying to move previously copied file to trash: " + internal_file_path);
final String connection_id = CLIENT_ID;
String pathToFileInTrash = null;
@ -774,14 +767,14 @@ public class DiskYandexNet extends PluginForHost {
* If no account is given or if the user does not allow us to move such files into his account, this handling will throw an exception.
*/
private String generateDirecturlQuotaLimitedFile(final Browser br3, final DownloadLink link, final Account account) throws Exception {
String dllink = null;
final ActionForQuotaLimitedFiles action = PluginJsonConfig.get(DiskYandexNetConfig.class).getActionForQuotaLimitedFiles();
final boolean fileDownloadQuotaReached = isFileDownloadQuotaReached(link);
if (!fileDownloadQuotaReached) {
logger.warning("!Developer mistake! Only call this function for quota reached items!");
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
} else if (account == null) {
throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "File has reached quota limit: Add account to be able to download it or try again later", 1 * 60 * 60 * 1000l);
} else if (!getPluginConfig().getBooleanProperty(MOVE_QUOTA_LIMITED_FILES_TO_ACCOUNT, MOVE_QUOTA_LIMITED_FILES_TO_ACCOUNT_default)) {
} else if (action == ActionForQuotaLimitedFiles.WAIT_AND_RETRY_LATER) {
/* User has disabled this handling. */
throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "File has reached quota limit: Enable auto move to account or wait and retry later", 1 * 60 * 60 * 1000l);
}
@ -928,7 +921,7 @@ public class DiskYandexNet extends PluginForHost {
checkErrorsWebsite(br2, link, account);
final Map<String, Object> entries = this.checkErrorsWebAPI(br2, link, account);
final Map<String, Object> downloadMap = (Map<String, Object>) JavaScriptEngineFactory.walkJson(entries, "models/{0}/data");
dllink = downloadMap.get("file").toString();
final String dllink = downloadMap.get("file").toString();
if (StringUtils.isEmpty(dllink)) {
/* This should never happen */
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
@ -1554,19 +1547,6 @@ public class DiskYandexNet extends PluginForHost {
return PluginJSonUtils.getJsonValue(br, "sk");
}
@Override
public String getDescription() {
return "JDownloader's disk.yandex.com Plugin helps downloading files from disk.yandex.com. It provides some settings for downloads via account.";
}
private void setConfigElements() {
getConfig().addEntry(new ConfigEntry(ConfigContainer.TYPE_LABEL, "Account settings:"));
final ConfigEntry moveFilesToAcc = new ConfigEntry(ConfigContainer.TYPE_CHECKBOX, getPluginConfig(), MOVE_QUOTA_LIMITED_FILES_TO_ACCOUNT, "<html>Account mode: Move </b>quota limited</b> files to account before downloading them to get higher download speeds?</html>").setDefaultValue(MOVE_QUOTA_LIMITED_FILES_TO_ACCOUNT_default);
getConfig().addEntry(moveFilesToAcc);
getConfig().addEntry(new ConfigEntry(ConfigContainer.TYPE_CHECKBOX, getPluginConfig(), DELETE_MOVED_FILE_FROM_ACCOUNT_AFTER_QUOTA_LIMITED_DOWNLOAD, "Account mode: Delete moved files from account?").setEnabledCondidtion(moveFilesToAcc, true).setDefaultValue(DELETE_MOVED_FILE_FROM_ACCOUNT_AFTER_QUOTA_LIMITED_DOWNLOAD_default));
getConfig().addEntry(new ConfigEntry(ConfigContainer.TYPE_CHECKBOX, getPluginConfig(), EMPTY_TRASH_AFTER_QUOTA_LIMITED_DOWNLOAD, "Account mode: Empty trash after each quota limited download?").setEnabledCondidtion(moveFilesToAcc, true).setDefaultValue(EMPTY_TRASH_AFTER_DOWNLOAD_default));
}
@Override
public void reset() {
}
@ -1583,4 +1563,9 @@ public class DiskYandexNet extends PluginForHost {
}
link.removeProperty(DiskYandexNet.PROPERTY_NORESUME);
}
@Override
public Class<? extends DiskYandexNetConfig> getConfigInterface() {
return DiskYandexNetConfig.class;
}
}

View File

@ -1263,7 +1263,12 @@ public class PornportalCom extends PluginForHost {
@Override
public int getMaxSimultanPremiumDownloadNum() {
return Integer.MAX_VALUE;
/**
* 2024-08-27: They've added rate-limiting for HLS streams. Allowing only max 1 downloads is my simple attempt for this moment.
* </br>
* See also: https://board.jdownloader.org/showthread.php?t=96341
*/
return 1;
}
@Override

View File

@ -15,14 +15,13 @@
//along with this program. If not, see <http://www.gnu.org/licenses/>.
package jd.plugins.hoster;
import java.io.IOException;
import java.util.regex.Pattern;
import jd.PluginWrapper;
import jd.config.Property;
import jd.http.Browser;
import jd.http.URLConnectionAdapter;
import jd.nutils.encoding.Encoding;
import jd.parser.Regex;
import jd.plugins.Account;
import jd.plugins.DownloadLink;
import jd.plugins.DownloadLink.AvailableStatus;
import jd.plugins.HostPlugin;
@ -38,123 +37,91 @@ public class SourceForgeNet extends PluginForHost {
this.setStartIntervall(2000l);
}
@SuppressWarnings("deprecation")
public void correctDownloadLink(final DownloadLink link) {
link.setPluginPatternMatcher(link.getPluginPatternMatcher().replace("sourceforgedecrypted.net/", "sourceforge.net/"));
}
/* DEV NOTES */
// other:
/* Connection stuff */
private static final boolean free_resume = true;
private static final int free_maxchunks = -2;
private static final int free_maxdownloads = -1;
private String dllink = null;
@Override
public String getAGBLink() {
return "https://slashdotmedia.com/terms-of-use/";
}
@Override
public AvailableStatus requestFileInformation(final DownloadLink link) throws IOException, PluginException, InterruptedException {
public boolean isResumeable(final DownloadLink link, final Account account) {
return true;
}
public int getMaxChunks(final DownloadLink link, final Account account) {
return -2;
}
@Override
public AvailableStatus requestFileInformation(final DownloadLink link) throws Exception {
return requestFileInformation(link, false);
}
private AvailableStatus requestFileInformation(final DownloadLink link, final boolean isDownload) throws IOException, PluginException, InterruptedException {
private AvailableStatus requestFileInformation(final DownloadLink link, final boolean isDownload) throws Exception {
/* 2020-07-08: Don't do that! */
// final String urlname = new Regex(link.getPluginPatternMatcher(), "/projects/(.*?)/?$").getMatch(0);
// if (!link.isNameSet() && urlname != null) {
// link.setName(urlname);
// }
URLConnectionAdapter con = null;
dllink = checkDirectLink(link, "directlink");
this.setBrowserExclusive();
br.setFollowRedirects(true);
if (dllink == null) {
br.getPage(link.getPluginPatternMatcher());
if (br.containsHTML("(Error 404|The page you were looking for cannot be found|could not be found or is not available)") || br.getHttpConnection().getResponseCode() == 403 || br.getHttpConnection().getResponseCode() == 404) {
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
br.getPage(link.getPluginPatternMatcher());
if (br.containsHTML("(Error 404|The page you were looking for cannot be found|could not be found or is not available)") || br.getHttpConnection().getResponseCode() == 403 || br.getHttpConnection().getResponseCode() == 404) {
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
}
final String altDlink = br.getRegex("<b>Download</b>\\s*<small title=\"(/[^<>\"]*?)\"").getMatch(0);
String dlurl = null;
if (br.getURL().contains("/files/extras/") || br.getURL().contains("prdownloads.sourceforge.net") || br.getURL().contains("/download")) {
dlurl = getDllink(this.br);
} else {
final Pattern projectspattern = Pattern.compile("sourceforge\\.net/projects/(.*?)/", Pattern.CASE_INSENSITIVE);
String project = new Regex(link.getPluginPatternMatcher(), projectspattern).getMatch(0);
if (project == null) {
project = new Regex(br.getURL(), projectspattern).getMatch(0);
}
final String altDlink = br.getRegex("<b>Download</b>\\s*<small title=\"(/[^<>\"]*?)\"").getMatch(0);
String dlurl = null;
if (br.getURL().contains("/files/extras/") || br.getURL().contains("prdownloads.sourceforge.net") || br.getURL().contains("/download")) {
dlurl = getDllink(this.br);
if (altDlink != null) {
// Avoid ad-installers, see here: http://userscripts.org/scripts/show/174951
dlurl = "http://master.dl.sourceforge.net/project/" + project + altDlink;
} else {
String project = new Regex(link.getPluginPatternMatcher(), "sourceforge\\.net/projects/(.*?)/").getMatch(0);
if (project == null) {
project = new Regex(br.getURL(), "sourceforge\\.net/projects/(.*?)/").getMatch(0);
final String continuelink = br.getRegex("\"(/projects/" + project + "/files/latest/download[^<>\"/]*?)\"").getMatch(0);
if (continuelink == null) {
logger.info("Found no downloadable link for: " + link.getPluginPatternMatcher());
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
}
if (altDlink != null) {
// Avoid ad-installers, see here: http://userscripts.org/scripts/show/174951
dlurl = "http://master.dl.sourceforge.net/project/" + project + altDlink;
} else {
final String continuelink = br.getRegex("\"(/projects/" + project + "/files/latest/download[^<>\"/]*?)\"").getMatch(0);
if (continuelink == null) {
logger.info("Found no downloadable link for: " + link.getPluginPatternMatcher());
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
}
br.getPage(continuelink);
/* In very rare cases, files are not downloadable. */
if (br.getHttpConnection().getResponseCode() == 404 || !br.getURL().contains("/download") || br.containsHTML("(<h1>Error encountered</h1>|>We apologize\\. It appears an error has occurred\\.)")) {
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
}
dlurl = new Regex(Encoding.htmlDecode(br.toString()), "Please use this([\t\n\r ]+)?<a href=\"(https?://.*?)\"").getMatch(1);
br.getPage(continuelink);
/* In very rare cases, files are not downloadable. */
if (br.getHttpConnection().getResponseCode() == 404 || !br.getURL().contains("/download") || br.containsHTML("(<h1>Error encountered</h1>|>We apologize\\. It appears an error has occurred\\.)")) {
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
}
dlurl = new Regex(Encoding.htmlDecode(br.toString()), "Please use this([\t\n\r ]+)?<a href=\"(https?://.*?)\"").getMatch(1);
}
if (dlurl == null) {
}
if (dlurl == null) {
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
}
if (isDownload) {
dlurl = Encoding.htmlOnlyDecode(dlurl);
final String urlPart = new Regex(dlurl, "(https?://downloads\\.sourceforge\\.net/project/.*?)(https?://sourceforge\\.net/|\\?r=)").getMatch(0);
final String secondUrlPart = new Regex(dlurl, "(\\&ts=\\d+\\&use_mirror=.+)").getMatch(0);
/* Either we already got the final link or we have to build it */
if (urlPart != null && secondUrlPart != null) {
dlurl = urlPart + "?r=" + secondUrlPart;
}
final String finallink = getDllink(br);
if (finallink == null) {
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
}
if (isDownload) {
dlurl = Encoding.htmlDecode(dlurl);
final String urlPart = new Regex(dlurl, "(https?://downloads\\.sourceforge\\.net/project/.*?)(https?://sourceforge\\.net/|\\?r=)").getMatch(0);
final String secondUrlPart = new Regex(dlurl, "(\\&ts=\\d+\\&use_mirror=.+)").getMatch(0);
/* Either we already got the final link or we have to build it */
if (urlPart != null && secondUrlPart != null) {
dlurl = urlPart + "?r=" + secondUrlPart;
}
final Browser brc = br.cloneBrowser();
brc.setFollowRedirects(false);
String finallink = null;
try {
for (int i = 0; i <= 5; i++) {
if (i == 0) {
/* 2020-07-08: Hardcoded pre-download-waittime */
this.sleep(5 * 1001l, link);
finallink = dlurl;
} else if (brc.getRedirectLocation() != null) {
finallink = brc.getRedirectLocation();
} else {
finallink = getDllink(brc);
}
if (finallink == null) {
return null;
}
con = brc.openHeadConnection(finallink);
if (con.getContentType().contains("text")) {
logger.info("finallink is no file, continuing...");
brc.followConnection(true);
continue;
} else if (con.getResponseCode() == 200) {
dllink = finallink;
link.setDownloadSize(con.getCompleteContentLength());
break;
} else {
brc.followConnection(true);
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
}
}
} finally {
try {
con.disconnect();
} catch (final Throwable e) {
}
}
if (dllink == null) {
throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Failed to find any usable mirror", 1 * 60 * 1000l);
}
link.setProperty("finallink", dllink);
/* 2024-08-27: Pre download wait is skippable */
// this.sleep(5 * 1001l, link);
dl = jd.plugins.BrowserAdapter.openDownload(br, link, finallink, this.isResumeable(link, null), this.getMaxChunks(link, null));
if (!this.looksLikeDownloadableContent(dl.getConnection())) {
br.followConnection();
throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Failed to find any usable mirror", 1 * 60 * 1000l);
}
link.setProperty("finallink", finallink);
}
return AvailableStatus.TRUE;
}
@ -173,15 +140,12 @@ public class SourceForgeNet extends PluginForHost {
@Override
public void handleFree(final DownloadLink link) throws Exception {
this.dllink = checkDirectLink(link, "finallink");
if (this.dllink == null) {
requestFileInformation(link, true);
}
if (dllink == null) {
requestFileInformation(link, true);
final String dllink = link.getStringProperty("finallink");
if (this.dl == null) {
throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Failed to find any usable mirror", 5 * 60 * 1000l);
// throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
}
dl = jd.plugins.BrowserAdapter.openDownload(br, link, dllink, free_resume, free_maxchunks);
dl = jd.plugins.BrowserAdapter.openDownload(br, link, dllink, this.isResumeable(link, null), this.getMaxChunks(link, null));
if (!looksLikeDownloadableContent(dl.getConnection())) {
br.followConnection(true);
if (dl.getConnection().getResponseCode() == 403) {
@ -195,35 +159,9 @@ public class SourceForgeNet extends PluginForHost {
dl.startDownload();
}
private String checkDirectLink(final DownloadLink link, final String property) {
final String dllink = link.getStringProperty(property);
if (dllink != null) {
URLConnectionAdapter con = null;
try {
final Browser br2 = br.cloneBrowser();
br2.setFollowRedirects(true);
con = br2.openHeadConnection(dllink);
if (!looksLikeDownloadableContent(con)) {
throw new IOException();
} else {
return dllink;
}
} catch (final Exception e) {
logger.log(e);
link.setProperty(property, Property.NULL);
} finally {
try {
con.disconnect();
} catch (final Throwable e) {
}
}
}
return null;
}
@Override
public int getMaxSimultanFreeDownloadNum() {
return free_maxdownloads;
return Integer.MAX_VALUE;
}
@Override

View File

@ -21,10 +21,13 @@ import java.util.List;
import org.jdownloader.plugins.components.XFileSharingProBasic;
import jd.PluginWrapper;
import jd.http.Browser;
import jd.plugins.Account;
import jd.plugins.Account.AccountType;
import jd.plugins.DownloadLink;
import jd.plugins.HostPlugin;
import jd.plugins.LinkStatus;
import jd.plugins.PluginException;
@HostPlugin(revision = "$Revision$", interfaceVersion = 3, names = {}, urls = {})
public class TurbovidCo extends XFileSharingProBasic {
@ -104,4 +107,12 @@ public class TurbovidCo extends XFileSharingProBasic {
public int getMaxSimultanPremiumDownloadNum() {
return -1;
}
@Override
protected void checkErrors(final Browser br, final String html, final DownloadLink link, final Account account, final boolean checkAll) throws NumberFormatException, PluginException {
if (br.containsHTML("Video no available at the moment\\s*<")) {
throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Video not available at the moment");
}
super.checkErrors(br, html, link, account, checkAll);
}
}

View File

@ -62,9 +62,9 @@ public class UploadrarCom extends XFileSharingProBasic {
@Override
public String[] scanInfo(String[] fileInfo) {
super.scanInfo(fileInfo);
if (StringUtils.isEmpty(fileInfo[0])) {
fileInfo[0] = br.getRegex("div\\s*class\\s*=\\s*\"desc\"\\s*>\\s*<span>\\s*(.*?)\\s*</span>").getMatch(0);
}
// if (StringUtils.isEmpty(fileInfo[0])) {
// fileInfo[0] = br.getRegex("div\\s*class\\s*=\\s*\"desc\"\\s*>\\s*<span>\\s*(.*?)\\s*</span>").getMatch(0);
// }
if (StringUtils.isEmpty(fileInfo[1])) {
fileInfo[1] = br.getRegex("<p>\\s*size\\s*:\\s*([0-9\\.]+(?:\\s+|\\&nbsp;)?(KB|MB|GB))").getMatch(0);
}
@ -201,7 +201,7 @@ public class UploadrarCom extends XFileSharingProBasic {
@Override
public String regexFilenameAbuse(final Browser br) {
final String filename_src = br.getRegex("name=\"file_name\"[^<]*value=\"([^\"]+)\"").getMatch(-1);
final String filename_src = br.getRegex("name=\"file_name\"[^>]*value=\"([^\"]+)\"").getMatch(0);
if (filename_src != null) {
return filename_src;
} else {

View File

@ -244,6 +244,7 @@ public class VKontakteRuHoster extends PluginForHost {
public AvailableStatus requestFileInformation(final DownloadLink link, final Account account, final boolean isDownload) throws Exception {
String finalurl = null;
if (link.getPluginPatternMatcher().matches(TYPE_DIRECT)) {
/* Direct link -> No account needed to download it. */
finalurl = link.getPluginPatternMatcher();
/* Prefer filename inside url */
final String filename = extractFileNameFromURL(finalurl);
@ -980,7 +981,7 @@ public class VKontakteRuHoster extends PluginForHost {
link.setLivePlugin(this);
}
URLConnectionAdapter con = null;
boolean closeConnection = true;
boolean success = false;
try {
if (isDownload && !isHLS(link, finalUrl)) {
finalUrl = modifyFinalDownloadurl(finalUrl);
@ -1003,9 +1004,7 @@ public class VKontakteRuHoster extends PluginForHost {
}
}
}
if (isDownload) {
closeConnection = false;
}
success = true;
return 1;
} else {
// request range fucked
@ -1025,7 +1024,10 @@ public class VKontakteRuHoster extends PluginForHost {
} catch (final Exception e) {
return 0;
} finally {
if (closeConnection) {
if (!success) {
dl = null;
}
if (!isDownload) {
try {
if (con != null) {
con.disconnect();