mirror of
https://github.com/mirror/jdownloader.git
synced 2024-11-30 07:20:42 +00:00
*Plugins: Fixes/Changes/Maintenance*
- epornercom: finished work on new gallery crawler and added some optimizations for nicer filenames and instantly startable downloads RE forum 93402 git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@48221 ebf7c1c2-ba36-0410-9fe8-c592906822b4 Former-commit-id: f52144d7a2bf5f20298b8daadce202c54a7d339d
This commit is contained in:
parent
9e32db7339
commit
78d190922a
@ -18,6 +18,7 @@ package jd.plugins.decrypter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.appwork.utils.StringUtils;
|
||||
|
||||
@ -30,6 +31,7 @@ import jd.plugins.DecrypterPlugin;
|
||||
import jd.plugins.DownloadLink;
|
||||
import jd.plugins.FilePackage;
|
||||
import jd.plugins.LinkStatus;
|
||||
import jd.plugins.Plugin;
|
||||
import jd.plugins.PluginDependencies;
|
||||
import jd.plugins.PluginException;
|
||||
import jd.plugins.PluginForDecrypt;
|
||||
@ -63,7 +65,7 @@ public class EPornerComGallery extends PluginForDecrypt {
|
||||
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) + "/gallery/([A-Za-z0-9]+)/([\\w\\-]+)/?");
|
||||
ret.add("https?://(?:\\w+\\.)?" + buildHostsPatternPart(domains) + "/gallery/([A-Za-z0-9]+)/([\\w\\-]+)/?");
|
||||
}
|
||||
return ret.toArray(new String[0]);
|
||||
}
|
||||
@ -78,21 +80,19 @@ public class EPornerComGallery extends PluginForDecrypt {
|
||||
}
|
||||
final String numberofPhotosStr = br.getRegex("Photos:\\s*(\\d+)").getMatch(0);
|
||||
final int numberofPhotos = Integer.parseInt(numberofPhotosStr);
|
||||
final boolean crawlByThumbnail = true;
|
||||
final boolean crawlByThumbnail = false;
|
||||
final HashSet<String> dupes = new HashSet<String>();
|
||||
if (crawlByThumbnail) {
|
||||
/* Superfast crawling: Grab thumbnail URLs and modify them so they point to the full images. */
|
||||
final String[] thumbnails = br.getRegex("id=\"t\\d+\"[^>]*src=\"(https?://[^\"]+)\"").getColumn(0);
|
||||
if (thumbnails == null || thumbnails.length == 0) {
|
||||
throw new PluginException(LinkStatus.ERROR_PLUGIN_DEFECT);
|
||||
}
|
||||
final HashSet<String> dupes = new HashSet<String>();
|
||||
for (final String thumbnailURL : thumbnails) {
|
||||
if (!dupes.add(thumbnailURL)) {
|
||||
continue;
|
||||
}
|
||||
final String thumbnailReplacePart = "_296x1000.jpg";
|
||||
String fullImageURL = thumbnailURL.replace(thumbnailReplacePart, "_880x660.jpg");
|
||||
fullImageURL = fullImageURL.replaceFirst("\\d+x\\d+\\.gif$", ".mp4");
|
||||
final String fullImageURL = convertThumbnailUrlToFullsize(thumbnailURL);
|
||||
if (fullImageURL.equals(thumbnailURL)) {
|
||||
logger.warning("Can't fix thumbnail URL: " + thumbnailURL);
|
||||
}
|
||||
@ -101,9 +101,30 @@ public class EPornerComGallery extends PluginForDecrypt {
|
||||
ret.add(image);
|
||||
}
|
||||
} else {
|
||||
final String[] photoURLsRelative = br.getRegex("(/photo/[A-Za-z0-9]+/[\\w\\-]+/?)").getColumn(0);
|
||||
final String[] photoURLsRelative = br.getRegex("href=\"(/photo/[A-Za-z0-9]+/[\\w\\-]+/)").getColumn(0);
|
||||
for (final String photoURLRelative : photoURLsRelative) {
|
||||
if (!dupes.add(photoURLRelative)) {
|
||||
continue;
|
||||
}
|
||||
final String[] urlParts = photoURLRelative.split("/");
|
||||
final String photoTitle = urlParts[urlParts.length - 1];
|
||||
final DownloadLink image = createDownloadlink(br.getURL(photoURLRelative).toString());
|
||||
final String thumbnailURL = br.getRegex("href=\"" + Pattern.quote(photoURLRelative) + "\"[^>]*>\\s*<img id=\"t\\d+\" src=\"(https?://[^\"]+)").getMatch(0);
|
||||
String ext = null;
|
||||
if (thumbnailURL != null) {
|
||||
/* Save directurl as property so later on we can start downloading instantly. */
|
||||
final String fullImageURL = convertThumbnailUrlToFullsize(thumbnailURL);
|
||||
if (fullImageURL.equals(thumbnailURL)) {
|
||||
logger.warning("Can't fix thumbnail URL: " + thumbnailURL);
|
||||
} else {
|
||||
image.setProperty(EPornerCom.PROPERTY_DIRECTURL, fullImageURL);
|
||||
ext = Plugin.getFileNameExtensionFromURL(fullImageURL);
|
||||
}
|
||||
}
|
||||
if (ext == null) {
|
||||
ext = ".jpg";
|
||||
}
|
||||
image.setFinalFileName(photoTitle + ext);
|
||||
image.setAvailable(true);
|
||||
ret.add(image);
|
||||
}
|
||||
@ -120,4 +141,10 @@ public class EPornerComGallery extends PluginForDecrypt {
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static String convertThumbnailUrlToFullsize(final String thumbnailURL) {
|
||||
String fullImageURL = thumbnailURL.replace("_296x1000.jpg", "_880x660.jpg");
|
||||
fullImageURL = fullImageURL.replaceFirst("\\d+x\\d+\\.gif$", ".mp4");
|
||||
return fullImageURL;
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ public class EPornerCom extends PluginForHost {
|
||||
public static String[] getAnnotationUrls() {
|
||||
final List<String> ret = new ArrayList<String>();
|
||||
for (final String[] domains : getPluginDomains()) {
|
||||
ret.add("https?://(?:www\\.)?" + buildHostsPatternPart(domains) + "/((?:hd\\-porn/|video-)\\w+(/([^/]+))?|photo/[A-Za-z0-9]+(/[^/]+/)?)");
|
||||
ret.add("https?://(?:\\w+\\.)?" + buildHostsPatternPart(domains) + "/((?:hd\\-porn/|video-)\\w+(/([^/]+))?|photo/[A-Za-z0-9]+(/[\\w\\-]+/)?)");
|
||||
}
|
||||
return ret.toArray(new String[0]);
|
||||
}
|
||||
@ -90,10 +90,10 @@ public class EPornerCom extends PluginForHost {
|
||||
return "https://www.eporner.com/terms/";
|
||||
}
|
||||
|
||||
private final Pattern PATTERN_VIDEO = Pattern.compile("(?i)https?://[^/]+/(?:hd\\-porn/|video-)(\\w+)(/([^/]+))?");
|
||||
private final Pattern PATTERN_PHOTO = Pattern.compile("(?i)https?://[^/]+/photo/([A-Za-z0-9]+)(/[^/]+/)?");
|
||||
private String vq = null;
|
||||
private final String PROPERTY_DIRECTURL = "directurl";
|
||||
private final Pattern PATTERN_VIDEO = Pattern.compile("(?i)https?://[^/]+/(?:hd\\-porn/|video-)(\\w+)(/([^/]+))?");
|
||||
private final Pattern PATTERN_PHOTO = Pattern.compile("(?i)https?://[^/]+/photo/([A-Za-z0-9]+)(/[\\w\\-]+/)?");
|
||||
private String vq = null;
|
||||
public static final String PROPERTY_DIRECTURL = "directurl";
|
||||
|
||||
@Override
|
||||
public int getMaxSimultanFreeDownloadNum() {
|
||||
@ -200,7 +200,10 @@ public class EPornerCom extends PluginForHost {
|
||||
}
|
||||
} else {
|
||||
/* Photo */
|
||||
dllink = br.getRegex("class=\"mainphoto\" src=\"(https?://[^\"]+)").getMatch(0);
|
||||
dllink = br.getRegex("src=\"(https?://[^\"]+)\" autoplay ").getMatch(0); // gifs -> mp4
|
||||
if (dllink == null) {
|
||||
dllink = br.getRegex("class=\"mainphoto\" src=\"(https?://[^\"]+)").getMatch(0); // normal image -> jpg
|
||||
}
|
||||
final String[] jsons = br.getRegex("<script type=\"application/ld\\+json\">([^<]+)</script>").getColumn(0);
|
||||
String betterPhotoTitle = null;
|
||||
if (jsons != null && jsons.length > 0) {
|
||||
@ -218,12 +221,19 @@ public class EPornerCom extends PluginForHost {
|
||||
title = betterPhotoTitle;
|
||||
}
|
||||
}
|
||||
String ext = null;
|
||||
if (dllink != null) {
|
||||
ext = Plugin.getFileNameExtensionFromURL(dllink);
|
||||
}
|
||||
if (ext == null) {
|
||||
ext = extDefault;
|
||||
}
|
||||
if (title != null) {
|
||||
title = Encoding.htmlDecode(title).trim();
|
||||
title = title.replaceFirst("(?i)\\s*Porn Pic - EPORNER\\s*", "");
|
||||
title = title.replaceFirst("\\s*\\- EPORNER Free HD Porn Tube\\s*", "");
|
||||
title = title.replaceFirst("\\s*- EPORNER\\s*", "");
|
||||
link.setFinalFileName(title + extDefault);
|
||||
link.setFinalFileName(title + ext);
|
||||
} else {
|
||||
link.setFinalFileName(fallbackFilename);
|
||||
}
|
||||
@ -248,9 +258,9 @@ public class EPornerCom extends PluginForHost {
|
||||
if (con.getCompleteContentLength() > 0) {
|
||||
link.setVerifiedFileSize(con.getCompleteContentLength());
|
||||
}
|
||||
final String ext = Plugin.getExtensionFromMimeTypeStatic(con.getContentType());
|
||||
if (ext != null && title != null) {
|
||||
link.setFinalFileName(this.correctOrApplyFileNameExtension(title, "." + ext));
|
||||
ext = Plugin.getExtensionFromMimeTypeStatic(con.getContentType());
|
||||
if (ext != null && link.getName() != null) {
|
||||
link.setFinalFileName(this.correctOrApplyFileNameExtension(link.getName(), "." + ext));
|
||||
}
|
||||
} finally {
|
||||
try {
|
||||
@ -285,6 +295,10 @@ public class EPornerCom extends PluginForHost {
|
||||
try {
|
||||
dl = jd.plugins.BrowserAdapter.openDownload(br, link, directurl, true, 0);
|
||||
connectionErrorhandling(dl.getConnection(), link, account);
|
||||
final String ext = Plugin.getExtensionFromMimeTypeStatic(dl.getConnection().getContentType());
|
||||
if (ext != null && link.getName() != null) {
|
||||
link.setFinalFileName(this.correctOrApplyFileNameExtension(link.getName(), "." + ext));
|
||||
}
|
||||
dl.startDownload();
|
||||
} catch (final Exception e) {
|
||||
if (storedDirecturl != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user