*Plugins: New plugins*

- YourfilestoreCom RE forum 95753 closes #90458
- Fsiblog2ComCrawler: set added URL as contentURL since directURL cannot be accessed without special referer RE forum 94290
- opensubtitlesorg: minor changes

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

Former-commit-id: 9c44902fa08661cdbddb5dc8118eca280d34a409
This commit is contained in:
psp 2024-08-13 12:07:13 +00:00
parent d289e01b94
commit a01f5e396f
3 changed files with 169 additions and 3 deletions

View File

@ -67,7 +67,8 @@ public class Fsiblog2ComCrawler extends PluginForDecrypt {
public ArrayList<DownloadLink> decryptIt(final CryptedLink param, ProgressController progress) throws Exception {
br.setFollowRedirects(true);
br.getPage(param.getCryptedUrl());
final String addedlink = param.getCryptedUrl().replaceFirst("(?i)^http://", "https://");
br.getPage(addedlink);
if (br.getHttpConnection().getResponseCode() == 404) {
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
}
@ -91,6 +92,12 @@ public class Fsiblog2ComCrawler extends PluginForDecrypt {
}
}
for (final DownloadLink result : ret) {
/* Direct link cannot be used without correct referer so let's set a contentURL which the user can actually open in browser. */
result.setContentUrl(addedlink);
/*
* Direct-URL cannot be used without correct referer -> Set that here so that DirectHTTP plugin is able to download the file
* later on.
*/
result.setReferrerUrl(br.getURL());
}
final FilePackage fp = FilePackage.getInstance();

View File

@ -61,11 +61,11 @@ public class OpenSubtitlesOrg extends PluginForHost {
@Override
public String getAGBLink() {
return "http://2pu.net/v/opensubtitles";
return "https://www." + getHost() + "/en/disclaimer";
}
private String getContentURL(final DownloadLink link) {
return "https://www.opensubtitles.org/en/subtitles/" + getFID(link);
return "https://www." + getHost() + "/en/subtitles/" + getFID(link);
}
@Override

View File

@ -0,0 +1,159 @@
//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.List;
import jd.PluginWrapper;
import jd.http.Browser;
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;
import jd.plugins.LinkStatus;
import jd.plugins.PluginException;
import jd.plugins.PluginForHost;
@HostPlugin(revision = "$Revision$", interfaceVersion = 3, names = {}, urls = {})
public class YourfilestoreCom extends PluginForHost {
public YourfilestoreCom(PluginWrapper wrapper) {
super(wrapper);
}
@Override
public Browser createNewBrowserInstance() {
final Browser br = super.createNewBrowserInstance();
br.setFollowRedirects(true);
return br;
}
@Override
public String getAGBLink() {
return "https://" + getHost() + "/terms-of-service.html";
}
private static List<String[]> getPluginDomains() {
final List<String[]> ret = new ArrayList<String[]>();
ret.add(new String[] { "yourfilestore.com" });
return ret;
}
public static String[] getAnnotationNames() {
return buildAnnotationNames(getPluginDomains());
}
@Override
public String[] siteSupportedNames() {
return buildSupportedNames(getPluginDomains());
}
public static String[] getAnnotationUrls() {
final List<String> ret = new ArrayList<String>();
for (final String[] domains : getPluginDomains()) {
ret.add("https?://(?:www\\.)?" + buildHostsPatternPart(domains) + "/download/(\\d+)/([^/#\\?]+)\\.html");
}
return ret.toArray(new String[0]);
}
@Override
public String getLinkID(final DownloadLink link) {
final String fid = getFID(link);
if (fid != null) {
return this.getHost() + "://" + fid;
} else {
return super.getLinkID(link);
}
}
private String getFID(final DownloadLink link) {
return new Regex(link.getPluginPatternMatcher(), this.getSupportedLinks()).getMatch(0);
}
@Override
public boolean isResumeable(final DownloadLink link, final Account account) {
return false;
}
public int getMaxChunks(final DownloadLink link, final Account account) {
return 1;
}
@Override
public AvailableStatus requestFileInformation(final DownloadLink link) throws IOException, PluginException {
if (!link.isNameSet()) {
/* Fallback */
final String filenameFromURL = new Regex(link.getPluginPatternMatcher(), this.getSupportedLinks()).getMatch(1);
link.setName(Encoding.htmlDecode(filenameFromURL).trim());
}
this.setBrowserExclusive();
br.getPage(link.getPluginPatternMatcher());
if (br.getHttpConnection().getResponseCode() == 404) {
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
} else if (br.containsHTML(">\\s*I cannot find what you|<h1>\\s*Sorry!\\s*</h1>")) {
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
}
String filename = br.getRegex("have requested\\s*<strong>([^<]+)</strong>").getMatch(0);
if (filename != null) {
filename = Encoding.htmlDecode(filename).trim();
/* Due to encoding issues, escape characters can be inside this string -> Remove them. */
filename = filename.replace("\\", "");
link.setName(filename);
}
return AvailableStatus.TRUE;
}
@Override
public void handleFree(final DownloadLink link) throws Exception, PluginException {
handleDownload(link);
}
private void handleDownload(final DownloadLink link) throws Exception, PluginException {
requestFileInformation(link);
dl = jd.plugins.BrowserAdapter.openDownload(br, link, "/get/file", this.isResumeable(link, null), this.getMaxChunks(link, null));
if (!this.looksLikeDownloadableContent(dl.getConnection())) {
br.followConnection(true);
if (dl.getConnection().getResponseCode() == 403) {
throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Server error 403", 5 * 60 * 1000l);
} else if (dl.getConnection().getResponseCode() == 404) {
throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Server error 404", 5 * 60 * 1000l);
}
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
}
dl.startDownload();
}
@Override
public boolean hasCaptcha(DownloadLink link, jd.plugins.Account acc) {
return false;
}
@Override
public int getMaxSimultanFreeDownloadNum() {
return Integer.MAX_VALUE;
}
@Override
public void reset() {
}
@Override
public void resetDownloadlink(DownloadLink link) {
}
}