mirror of
https://github.com/mirror/jdownloader.git
synced 2024-11-27 05:50:51 +00:00
*Plugins: Fixes/Changes/Maintenance*
- Plugins: minor refactoring refs #83699 Facebook: RE forum 91498 - added support for videos without thumbnail (looks like only very old videos have no thumbnail like from 2015) - re-added support for old "mobile devices" subdomain *Plugins: New plugins* - QiwiGg: added folder crawler RE ticket UWX-228-26246 git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@48087 ebf7c1c2-ba36-0410-9fe8-c592906822b4 Former-commit-id: b7c800fa0aaf95e97ab9706cc4c13c53ac98e9b6
This commit is contained in:
parent
cab6c1640d
commit
3f7050b075
@ -56,6 +56,22 @@ public class FaceBookComGallery extends PluginForDecrypt {
|
||||
super(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Browser createNewBrowserInstance() {
|
||||
final Browser br = new Browser();
|
||||
prepBR(br);
|
||||
return br;
|
||||
}
|
||||
|
||||
public static void prepBR(final Browser br) {
|
||||
br.getHeaders().put("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
|
||||
br.getHeaders().put("Accept-Language", "en-gb, en;q=0.9");
|
||||
br.getHeaders().put("Accept-Encoding", "gzip, deflate");
|
||||
br.getHeaders().put("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7");
|
||||
br.setCookie(getAnnotationNames()[0], "locale", "en_GB");
|
||||
br.setFollowRedirects(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LazyPlugin.FEATURE[] getFeatures() {
|
||||
return new LazyPlugin.FEATURE[] { LazyPlugin.FEATURE.IMAGE_GALLERY };
|
||||
@ -71,7 +87,7 @@ public class FaceBookComGallery extends PluginForDecrypt {
|
||||
}
|
||||
|
||||
public static String[] getAnnotationUrls() {
|
||||
return new String[] { "https?://(?:www\\.)?facebook\\.com/.+" };
|
||||
return new String[] { "https?://(?:(m|www)\\.)?facebook\\.com/.+" };
|
||||
}
|
||||
|
||||
private final String COMPONENT_USERNAME = "(?:[\\%a-zA-Z0-9\\-]+)";
|
||||
@ -113,17 +129,18 @@ public class FaceBookComGallery extends PluginForDecrypt {
|
||||
FaceBookComVideos hosterplugin = null;
|
||||
|
||||
public ArrayList<DownloadLink> crawl(final CryptedLink param, final Account account) throws Exception {
|
||||
br.setFollowRedirects(true);
|
||||
hosterplugin = (FaceBookComVideos) this.getNewPluginForHostInstance(this.getHost());
|
||||
if (account != null) {
|
||||
hosterplugin.login(account, false);
|
||||
}
|
||||
String url = param.getCryptedUrl();
|
||||
final Regex embeddedVideoRegex = new Regex(url, "(?i)https?://[^/]+/video/embed\\?video_id=(\\d+)");
|
||||
/* Do some minor corrections of added link. */
|
||||
/* Remove m.facebook.com as our crawler can't cope with those (old?) facebook website versions for mobile devices. */
|
||||
String url = param.getCryptedUrl().replaceFirst("(?i)http://", "https://").replace("https://m.", "https://www.");
|
||||
final String videoIDFRomEmbedURL = new Regex(url, "(?i)https?://[^/]+/video/embed\\?video_id=(\\d+)").getMatch(0);
|
||||
// final String mobileSubdomain = new Regex(url, "(?i)https?:/(m\\.[^/]+)/.+").getMatch(0);
|
||||
if (embeddedVideoRegex.matches()) {
|
||||
if (videoIDFRomEmbedURL != null) {
|
||||
/* Small workaround for embedded videourls */
|
||||
url = "https://www." + this.getHost() + "/watch/?v=" + embeddedVideoRegex.getMatch(0);
|
||||
url = "https://www." + this.getHost() + "/watch/?v=" + videoIDFRomEmbedURL;
|
||||
}
|
||||
// if (mobileSubdomain != null) {
|
||||
// /* Remove mobile sobdomain */
|
||||
@ -173,6 +190,9 @@ public class FaceBookComGallery extends PluginForDecrypt {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (processedJsonStrings.isEmpty()) {
|
||||
logger.warning("Failed to find any jsons to process");
|
||||
}
|
||||
if (ret.isEmpty() && this.skippedLivestreams > 0) {
|
||||
logger.info("Livestreams are not supported");
|
||||
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
|
||||
@ -418,19 +438,16 @@ public class FaceBookComGallery extends PluginForDecrypt {
|
||||
final String key = entry.getKey();
|
||||
final Object value = entry.getValue();
|
||||
final String ifThisisAVideoThisIsTheVideoID = value instanceof String ? value.toString() : null;
|
||||
if (key.equals("id") && map.containsKey("is_live_streaming") && map.containsKey("dash_manifest")) {
|
||||
final boolean isLivestream = ((Boolean) map.get("is_live_streaming")).booleanValue();
|
||||
if (isLivestream) {
|
||||
final Boolean is_live_streaming = (Boolean) map.get("is_live_streaming");
|
||||
if (key.equals("id") && is_live_streaming != null && map.containsKey("dash_manifest")) {
|
||||
if (Boolean.TRUE.equals(is_live_streaming)) {
|
||||
/* Livestreams are not supported */
|
||||
logger.info("Skipping livestream: " + ifThisisAVideoThisIsTheVideoID);
|
||||
skippedLivestreams++;
|
||||
continue;
|
||||
}
|
||||
final String videoContentURL = (String) map.get("permalink_url");
|
||||
final String thumbnailDirectURL = JavaScriptEngineFactory.walkJson(map, "preferred_thumbnail/image/uri").toString();
|
||||
final DownloadLink thumbnail = new DownloadLink(this.hosterplugin, this.getHost(), thumbnailDirectURL, true);
|
||||
thumbnail.setProperty(FaceBookComVideos.PROPERTY_TYPE, FaceBookComVideos.TYPE_THUMBNAIL);
|
||||
thumbnail.setProperty(FaceBookComVideos.PROPERTY_DIRECTURL_LAST, thumbnailDirectURL);
|
||||
final String thumbnailDirectURL = (String) JavaScriptEngineFactory.walkJson(map, "preferred_thumbnail/image/uri");
|
||||
final DownloadLink video = new DownloadLink(this.hosterplugin, this.getHost(), videoContentURL, true);
|
||||
final Object playable_duration_in_ms = map.get("playable_duration_in_ms");
|
||||
if (playable_duration_in_ms instanceof Number) {
|
||||
@ -467,7 +484,13 @@ public class FaceBookComGallery extends PluginForDecrypt {
|
||||
video.setProperty(FaceBookComVideos.PROPERTY_TYPE, FaceBookComVideos.TYPE_VIDEO);
|
||||
final ArrayList<DownloadLink> thisResults = new ArrayList<DownloadLink>();
|
||||
thisResults.add(video);
|
||||
thisResults.add(thumbnail);
|
||||
if (!StringUtils.isEmpty(thumbnailDirectURL)) {
|
||||
/* Not all videos have thumbnails! Alternatively we could check for field "has_preview_thumbnails". */
|
||||
final DownloadLink thumbnail = new DownloadLink(this.hosterplugin, this.getHost(), thumbnailDirectURL, true);
|
||||
thumbnail.setProperty(FaceBookComVideos.PROPERTY_TYPE, FaceBookComVideos.TYPE_THUMBNAIL);
|
||||
thumbnail.setProperty(FaceBookComVideos.PROPERTY_DIRECTURL_LAST, thumbnailDirectURL);
|
||||
thisResults.add(thumbnail);
|
||||
}
|
||||
/* Add properties to result */
|
||||
for (final DownloadLink thisResult : thisResults) {
|
||||
thisResult.setProperty(FaceBookComVideos.PROPERTY_CONTENT_ID, ifThisisAVideoThisIsTheVideoID);
|
||||
|
157
src/jd/plugins/decrypter/QiwiGgFolder.java
Normal file
157
src/jd/plugins/decrypter/QiwiGgFolder.java
Normal file
@ -0,0 +1,157 @@
|
||||
//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.decrypter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.appwork.storage.TypeRef;
|
||||
import org.appwork.utils.formatter.SizeFormatter;
|
||||
|
||||
import jd.PluginWrapper;
|
||||
import jd.controlling.ProgressController;
|
||||
import jd.nutils.encoding.Encoding;
|
||||
import jd.parser.Regex;
|
||||
import jd.plugins.CryptedLink;
|
||||
import jd.plugins.DecrypterPlugin;
|
||||
import jd.plugins.DownloadLink;
|
||||
import jd.plugins.FilePackage;
|
||||
import jd.plugins.LinkStatus;
|
||||
import jd.plugins.PluginDependencies;
|
||||
import jd.plugins.PluginException;
|
||||
import jd.plugins.PluginForDecrypt;
|
||||
import jd.plugins.components.PluginJSonUtils;
|
||||
import jd.plugins.hoster.QiwiGg;
|
||||
|
||||
@DecrypterPlugin(revision = "$Revision$", interfaceVersion = 3, names = {}, urls = {})
|
||||
@PluginDependencies(dependencies = { QiwiGg.class })
|
||||
public class QiwiGgFolder extends PluginForDecrypt {
|
||||
public QiwiGgFolder(PluginWrapper wrapper) {
|
||||
super(wrapper);
|
||||
}
|
||||
|
||||
public static List<String[]> getPluginDomains() {
|
||||
return QiwiGg.getPluginDomains();
|
||||
}
|
||||
|
||||
public static String[] getAnnotationNames() {
|
||||
return buildAnnotationNames(getPluginDomains());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] siteSupportedNames() {
|
||||
return buildSupportedNames(getPluginDomains());
|
||||
}
|
||||
|
||||
public static String[] getAnnotationUrls() {
|
||||
return buildAnnotationUrls(getPluginDomains());
|
||||
}
|
||||
|
||||
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) + "/folder/([a-f0-9]{24})");
|
||||
}
|
||||
return ret.toArray(new String[0]);
|
||||
}
|
||||
|
||||
public ArrayList<DownloadLink> decryptIt(final CryptedLink param, ProgressController progress) throws Exception {
|
||||
final ArrayList<DownloadLink> ret = new ArrayList<DownloadLink>();
|
||||
br.setFollowRedirects(true);
|
||||
br.getPage(param.getCryptedUrl());
|
||||
if (br.getHttpConnection().getResponseCode() == 404) {
|
||||
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
|
||||
}
|
||||
final String folderID = new Regex(param.getCryptedUrl(), this.getSupportedLinks()).getMatch(0);
|
||||
if (folderID == null) {
|
||||
/* Developer mistake */
|
||||
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
|
||||
}
|
||||
String thisFolderTitle = br.getRegex("<title>([^<]+)</title>").getMatch(0);
|
||||
if (thisFolderTitle != null) {
|
||||
thisFolderTitle = Encoding.htmlDecode(thisFolderTitle).trim();
|
||||
thisFolderTitle = thisFolderTitle.replaceFirst("(?i)\\s*• Download$", "");
|
||||
} else {
|
||||
/* Fallback */
|
||||
thisFolderTitle = folderID;
|
||||
}
|
||||
String path = this.getAdoptedCloudFolderStructure();
|
||||
if (path == null) {
|
||||
path = thisFolderTitle;
|
||||
} else {
|
||||
path += "/" + thisFolderTitle;
|
||||
}
|
||||
final FilePackage fp = FilePackage.getInstance();
|
||||
fp.setName(path);
|
||||
final String filesJson = br.getRegex("files\\\\\":(\\[.*?\\}\\]),").getMatch(0);
|
||||
final String[] fileIDs = br.getRegex("/file/([^\"\\']+)").getColumn(0);
|
||||
final String[] subfolderIDs = br.getRegex("/folder/([a-f0-9]{24})\"").getColumn(0);
|
||||
if (filesJson != null) {
|
||||
/* Prefer json source as it is much easier to parse */
|
||||
final ArrayList<HashMap<String, Object>> ressourcelist = restoreFromString(PluginJSonUtils.unescape(filesJson), TypeRef.LIST_HASHMAP);
|
||||
for (final HashMap<String, Object> filemap : ressourcelist) {
|
||||
final DownloadLink file = this.createDownloadlink(br.getURL("/file/" + filemap.get("slug").toString()).toString());
|
||||
file.setName(filemap.get("fileName").toString());
|
||||
final String fileSizeBytesStr = filemap.get("fileSize").toString();
|
||||
if (fileSizeBytesStr != null && fileSizeBytesStr.matches("\\d+")) {
|
||||
file.setDownloadSize(Long.parseLong(fileSizeBytesStr));
|
||||
}
|
||||
file.setRelativeDownloadFolderPath(path);
|
||||
file.setAvailable(true);
|
||||
file._setFilePackage(fp);
|
||||
ret.add(file);
|
||||
}
|
||||
} else if (fileIDs != null && fileIDs.length > 0) {
|
||||
logger.info("Fallback: Crawling via html code");
|
||||
for (final String fileID : fileIDs) {
|
||||
final String url = br.getURL("/file/" + fileID).toString();
|
||||
final String urlQuoted = Pattern.quote(url);
|
||||
final DownloadLink file = createDownloadlink(url);
|
||||
String filename = br.getRegex("class=\"DownloadButton_FileName_[^\"]*\"[^>]*><p>([^<]+)</p> <a target=\"_blank\" href=\"" + urlQuoted).getMatch(0);
|
||||
// if (filename == null) {
|
||||
// /* Other view: File-view without filesize */
|
||||
// filename = br.getRegex(urlQuoted + "\"aria-label=\"Download file\"[^>]*><div [^>]*></span></div><p
|
||||
// [^>]*>([^<]+)</p>").getMatch(0);
|
||||
// }
|
||||
if (filename != null) {
|
||||
file.setName(filename);
|
||||
}
|
||||
final String filesize = br.getRegex("FileSize_[^\"]*\"[^>]*>([^<]+)</div></div></div><div><a class=\"DownloadButton_DownloadButton_[^\"]+\"[^<]*href=\"" + urlQuoted).getMatch(0);
|
||||
if (filesize != null) {
|
||||
file.setDownloadSize(SizeFormatter.getSize(filesize));
|
||||
}
|
||||
file.setRelativeDownloadFolderPath(path);
|
||||
file.setAvailable(true);
|
||||
file._setFilePackage(fp);
|
||||
ret.add(file);
|
||||
}
|
||||
}
|
||||
if (subfolderIDs != null && subfolderIDs.length > 0) {
|
||||
for (final String subfolderID : subfolderIDs) {
|
||||
final String url = br.getURL("/folder/" + subfolderID).toString();
|
||||
final DownloadLink subfolder = createDownloadlink(url);
|
||||
subfolder.setRelativeDownloadFolderPath(path);
|
||||
ret.add(subfolder);
|
||||
}
|
||||
}
|
||||
if (ret.isEmpty()) {
|
||||
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
@ -17,6 +17,9 @@ package jd.plugins.hoster;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.appwork.utils.StringUtils;
|
||||
import org.jdownloader.plugins.controller.LazyPlugin;
|
||||
|
||||
import jd.PluginWrapper;
|
||||
import jd.http.Browser;
|
||||
import jd.http.URLConnectionAdapter;
|
||||
@ -29,8 +32,6 @@ import jd.plugins.LinkStatus;
|
||||
import jd.plugins.PluginException;
|
||||
import jd.plugins.PluginForHost;
|
||||
|
||||
import org.jdownloader.plugins.controller.LazyPlugin;
|
||||
|
||||
@HostPlugin(revision = "$Revision$", interfaceVersion = 3, names = { "bigholestube.com" }, urls = { "https?://(?:www\\.)?bigholestube\\.com/([a-z0-9\\-_]+)/" })
|
||||
public class BigholestubeCom extends PluginForHost {
|
||||
public BigholestubeCom(PluginWrapper wrapper) {
|
||||
@ -64,7 +65,7 @@ public class BigholestubeCom extends PluginForHost {
|
||||
dllink = null;
|
||||
this.setBrowserExclusive();
|
||||
br.setFollowRedirects(true);
|
||||
br.setCookie("http://bigholestube.com/", "ageCookieRemember", "1");
|
||||
br.setCookie(getHost(), "ageCookieRemember", "1");
|
||||
br.getPage(downloadLink.getDownloadURL());
|
||||
if (br.getHttpConnection().getResponseCode() == 404 || !br.containsHTML("id=\"(playerbox|Video_Player)\"")) {
|
||||
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
|
||||
@ -98,33 +99,42 @@ public class BigholestubeCom extends PluginForHost {
|
||||
} else {
|
||||
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
|
||||
}
|
||||
downloadLink.setProperty("directlink", dllink);
|
||||
return AvailableStatus.TRUE;
|
||||
} finally {
|
||||
try {
|
||||
con.disconnect();
|
||||
} catch (final Throwable e) {
|
||||
}
|
||||
}
|
||||
return AvailableStatus.TRUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleFree(final DownloadLink downloadLink) throws Exception {
|
||||
requestFileInformation(downloadLink);
|
||||
dl = jd.plugins.BrowserAdapter.openDownload(br, downloadLink, dllink, free_resume, free_maxchunks);
|
||||
if (!looksLikeDownloadableContent(dl.getConnection())) {
|
||||
br.followConnection(true);
|
||||
if (dl.getConnection().getResponseCode() == 403) {
|
||||
throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Server error 403", 60 * 60 * 1000l);
|
||||
} else if (dl.getConnection().getResponseCode() == 404) {
|
||||
throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Server error 404", 60 * 60 * 1000l);
|
||||
} else {
|
||||
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
|
||||
}
|
||||
public void handleFree(final DownloadLink link) throws Exception {
|
||||
requestFileInformation(link);
|
||||
if (StringUtils.isEmpty(dllink)) {
|
||||
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
|
||||
}
|
||||
dl = jd.plugins.BrowserAdapter.openDownload(br, link, dllink, free_resume, free_maxchunks);
|
||||
handleConnectionErrors(br, dl.getConnection());
|
||||
dl.startDownload();
|
||||
}
|
||||
|
||||
private void handleConnectionErrors(final Browser br, final URLConnectionAdapter con) throws PluginException {
|
||||
if (!this.looksLikeDownloadableContent(con)) {
|
||||
if (con.getResponseCode() == 403) {
|
||||
throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Server error 403", 60 * 60 * 1000l);
|
||||
} else if (con.getResponseCode() == 404) {
|
||||
throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Server error 404", 60 * 60 * 1000l);
|
||||
}
|
||||
try {
|
||||
br.followConnection(true);
|
||||
} catch (final IOException e) {
|
||||
logger.log(e);
|
||||
}
|
||||
throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Video broken?");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxSimultanFreeDownloadNum() {
|
||||
return free_maxdownloads;
|
||||
|
@ -15,6 +15,11 @@
|
||||
//along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
package jd.plugins.hoster;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.appwork.utils.StringUtils;
|
||||
import org.jdownloader.plugins.controller.LazyPlugin;
|
||||
|
||||
import jd.PluginWrapper;
|
||||
import jd.http.Browser;
|
||||
import jd.http.URLConnectionAdapter;
|
||||
@ -25,14 +30,10 @@ import jd.plugins.DownloadLink.AvailableStatus;
|
||||
import jd.plugins.HostPlugin;
|
||||
import jd.plugins.LinkStatus;
|
||||
import jd.plugins.PluginException;
|
||||
|
||||
import org.appwork.utils.StringUtils;
|
||||
import org.jdownloader.controlling.filter.CompiledFiletypeFilter;
|
||||
import org.jdownloader.plugins.components.antiDDoSForHost;
|
||||
import org.jdownloader.plugins.controller.LazyPlugin;
|
||||
import jd.plugins.PluginForHost;
|
||||
|
||||
@HostPlugin(revision = "$Revision$", interfaceVersion = 3, names = { "bitchute.com" }, urls = { "https?://(?:www\\.)?bitchute\\.com/video/([A-Za-z0-9\\-_]+)" })
|
||||
public class BitchuteCom extends antiDDoSForHost {
|
||||
public class BitchuteCom extends PluginForHost {
|
||||
public BitchuteCom(PluginWrapper wrapper) {
|
||||
super(wrapper);
|
||||
}
|
||||
@ -52,7 +53,6 @@ public class BitchuteCom extends antiDDoSForHost {
|
||||
private static final int free_maxchunks = 1;
|
||||
private static final int free_maxdownloads = -1;
|
||||
private String dllink = null;
|
||||
private boolean server_issues = false;
|
||||
|
||||
@Override
|
||||
public String getAGBLink() {
|
||||
@ -75,12 +75,13 @@ public class BitchuteCom extends antiDDoSForHost {
|
||||
|
||||
@Override
|
||||
public AvailableStatus requestFileInformation(final DownloadLink link) throws Exception {
|
||||
link.setMimeHint(CompiledFiletypeFilter.VideoExtensions.MP4);
|
||||
if (!link.isNameSet()) {
|
||||
link.setName(this.getFID(link) + ".mp4");
|
||||
}
|
||||
dllink = null;
|
||||
server_issues = false;
|
||||
this.setBrowserExclusive();
|
||||
br.setFollowRedirects(true);
|
||||
getPage(link.getPluginPatternMatcher());
|
||||
br.getPage(link.getPluginPatternMatcher());
|
||||
if (br.getHttpConnection().getResponseCode() == 404) {
|
||||
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
|
||||
} else if (br.containsHTML("(?i)>\\s*Channel Blocked\\s*<")) {
|
||||
@ -89,45 +90,34 @@ public class BitchuteCom extends antiDDoSForHost {
|
||||
}
|
||||
throw new PluginException(LinkStatus.ERROR_FILE_NOT_FOUND);
|
||||
}
|
||||
String filename = br.getRegex("class=\"page-title\">([^<>\"]+)<").getMatch(0);
|
||||
if (StringUtils.isEmpty(filename)) {
|
||||
filename = this.getFID(link);
|
||||
}
|
||||
String title = br.getRegex("class=\"page-title\">([^<>\"]+)<").getMatch(0);
|
||||
if (StringUtils.isEmpty(dllink)) {
|
||||
dllink = br.getRegex("<source src=(?:\"|\\')(https?://[^<>\"\\']*?)(?:\"|\\')[^>]*?type=(?:\"|\\')(?:video/)?(?:mp4|flv)(?:\"|\\')").getMatch(0);
|
||||
}
|
||||
if (filename == null) {
|
||||
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
|
||||
}
|
||||
filename = Encoding.htmlDecode(filename);
|
||||
filename = filename.trim();
|
||||
filename = encodeUnicode(filename);
|
||||
String ext;
|
||||
if (!StringUtils.isEmpty(dllink)) {
|
||||
ext = getFileNameExtensionFromString(dllink, default_extension);
|
||||
if (ext != null && !ext.matches("\\.(?:flv|mp4)")) {
|
||||
if (title != null) {
|
||||
String filename = Encoding.htmlDecode(title);
|
||||
filename = filename.trim();
|
||||
String ext;
|
||||
if (!StringUtils.isEmpty(dllink)) {
|
||||
ext = getFileNameExtensionFromString(dllink, default_extension);
|
||||
if (ext != null && !ext.matches("\\.(?:flv|mp4)")) {
|
||||
ext = default_extension;
|
||||
}
|
||||
} else {
|
||||
ext = default_extension;
|
||||
}
|
||||
} else {
|
||||
ext = default_extension;
|
||||
}
|
||||
if (!filename.endsWith(ext)) {
|
||||
filename += ext;
|
||||
if (!filename.endsWith(ext)) {
|
||||
filename += ext;
|
||||
}
|
||||
link.setFinalFileName(filename);
|
||||
}
|
||||
if (!StringUtils.isEmpty(dllink)) {
|
||||
link.setFinalFileName(filename);
|
||||
URLConnectionAdapter con = null;
|
||||
try {
|
||||
final Browser brc = br.cloneBrowser();
|
||||
brc.setFollowRedirects(true);
|
||||
con = openAntiDDoSRequestConnection(brc, brc.createHeadRequest(dllink));
|
||||
if (!this.looksLikeDownloadableContent(con)) {
|
||||
server_issues = true;
|
||||
brc.followConnection(true);
|
||||
} else {
|
||||
if (con.getCompleteContentLength() > 0) {
|
||||
link.setDownloadSize(con.getCompleteContentLength());
|
||||
}
|
||||
con = br.openHeadConnection(this.dllink);
|
||||
handleConnectionErrors(br, con);
|
||||
if (con.getCompleteContentLength() > 0) {
|
||||
link.setVerifiedFileSize(con.getCompleteContentLength());
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
@ -135,32 +125,34 @@ public class BitchuteCom extends antiDDoSForHost {
|
||||
} catch (final Throwable e) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* We cannot be sure whether we have the correct extension or not! */
|
||||
link.setName(filename);
|
||||
}
|
||||
return AvailableStatus.TRUE;
|
||||
}
|
||||
|
||||
private void handleConnectionErrors(final Browser br, final URLConnectionAdapter con) throws PluginException {
|
||||
if (!this.looksLikeDownloadableContent(con)) {
|
||||
if (con.getResponseCode() == 403) {
|
||||
throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Server error 403", 60 * 60 * 1000l);
|
||||
} else if (con.getResponseCode() == 404) {
|
||||
throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Server error 404", 60 * 60 * 1000l);
|
||||
}
|
||||
try {
|
||||
br.followConnection(true);
|
||||
} catch (final IOException e) {
|
||||
logger.log(e);
|
||||
}
|
||||
throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Video broken?");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleFree(final DownloadLink link) throws Exception {
|
||||
requestFileInformation(link);
|
||||
if (server_issues) {
|
||||
throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Unknown server error", 10 * 60 * 1000l);
|
||||
} else if (StringUtils.isEmpty(dllink)) {
|
||||
if (StringUtils.isEmpty(dllink)) {
|
||||
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
|
||||
}
|
||||
dl = jd.plugins.BrowserAdapter.openDownload(br, link, dllink, free_resume, free_maxchunks);
|
||||
if (!this.looksLikeDownloadableContent(dl.getConnection())) {
|
||||
br.followConnection(true);
|
||||
if (dl.getConnection().getResponseCode() == 403) {
|
||||
throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Server error 403", 60 * 60 * 1000l);
|
||||
} else if (dl.getConnection().getResponseCode() == 404) {
|
||||
throw new PluginException(LinkStatus.ERROR_TEMPORARILY_UNAVAILABLE, "Server error 404", 60 * 60 * 1000l);
|
||||
} else {
|
||||
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
|
||||
}
|
||||
}
|
||||
handleConnectionErrors(br, dl.getConnection());
|
||||
dl.startDownload();
|
||||
}
|
||||
|
||||
|
@ -53,20 +53,21 @@ import jd.plugins.decrypter.FaceBookComGallery;
|
||||
|
||||
@HostPlugin(revision = "$Revision$", interfaceVersion = 2, names = {}, urls = {})
|
||||
public class FaceBookComVideos extends PluginForHost {
|
||||
private final boolean enforceCookieLogin = true;
|
||||
|
||||
@Override
|
||||
public LazyPlugin.FEATURE[] getFeatures() {
|
||||
return new LazyPlugin.FEATURE[] { LazyPlugin.FEATURE.VIDEO_STREAMING, LazyPlugin.FEATURE.IMAGE_HOST };
|
||||
if (enforceCookieLogin) {
|
||||
return new LazyPlugin.FEATURE[] { LazyPlugin.FEATURE.VIDEO_STREAMING, LazyPlugin.FEATURE.IMAGE_HOST, LazyPlugin.FEATURE.COOKIE_LOGIN_ONLY };
|
||||
} else {
|
||||
return new LazyPlugin.FEATURE[] { LazyPlugin.FEATURE.VIDEO_STREAMING, LazyPlugin.FEATURE.IMAGE_HOST, LazyPlugin.FEATURE.COOKIE_LOGIN_OPTIONAL };
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Browser createNewBrowserInstance() {
|
||||
final Browser br = new Browser();
|
||||
br.getHeaders().put("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
|
||||
br.getHeaders().put("Accept-Language", "en-gb, en;q=0.9");
|
||||
br.getHeaders().put("Accept-Encoding", "gzip, deflate");
|
||||
br.getHeaders().put("Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7");
|
||||
br.setCookie(this.getHost(), "locale", "en_GB");
|
||||
br.setFollowRedirects(true);
|
||||
FaceBookComGallery.prepBR(br);
|
||||
return br;
|
||||
}
|
||||
|
||||
@ -496,7 +497,6 @@ public class FaceBookComVideos extends PluginForHost {
|
||||
final Cookies cookies = account.loadCookies("");
|
||||
/* 2020-10-9: Experimental login/test */
|
||||
final Cookies userCookies = account.loadUserCookies();
|
||||
final boolean enforceCookieLogin = true;
|
||||
if (enforceCookieLogin && userCookies == null) {
|
||||
showCookieLoginInfo();
|
||||
throw new AccountInvalidException(_GUI.T.accountdialog_check_cookies_required());
|
||||
|
@ -110,7 +110,7 @@ public class GoogleDrive extends PluginForHost {
|
||||
|
||||
@Override
|
||||
public FEATURE[] getFeatures() {
|
||||
return new FEATURE[] { FEATURE.FAVICON };
|
||||
return new FEATURE[] { FEATURE.FAVICON, FEATURE.COOKIE_LOGIN_ONLY };
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -47,7 +47,7 @@ public class QiwiGg extends PluginForHost {
|
||||
return "https://qiwi.gg/legal/tos";
|
||||
}
|
||||
|
||||
private static List<String[]> getPluginDomains() {
|
||||
public static List<String[]> getPluginDomains() {
|
||||
final List<String[]> ret = new ArrayList<String[]>();
|
||||
// each entry in List<String[]> will result in one PluginForHost, Plugin.getHost() will return String[0]->main domain
|
||||
ret.add(new String[] { "qiwi.gg", "spyderrock.com" });
|
||||
|
@ -168,7 +168,7 @@ public class YoutubeDashV2 extends PluginForHost implements YoutubeHostPluginInt
|
||||
|
||||
@Override
|
||||
public LazyPlugin.FEATURE[] getFeatures() {
|
||||
return new LazyPlugin.FEATURE[] { LazyPlugin.FEATURE.VIDEO_STREAMING };
|
||||
return new LazyPlugin.FEATURE[] { LazyPlugin.FEATURE.VIDEO_STREAMING, LazyPlugin.FEATURE.COOKIE_LOGIN_ONLY };
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user