diff --git a/src/main/java/com/rarchives/ripme/ripper/AbstractHTMLRipper.java b/src/main/java/com/rarchives/ripme/ripper/AbstractHTMLRipper.java index 35b2aa43..c0c1861c 100644 --- a/src/main/java/com/rarchives/ripme/ripper/AbstractHTMLRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/AbstractHTMLRipper.java @@ -16,7 +16,7 @@ import com.rarchives.ripme.utils.Utils; * Simplified ripper, designed for ripping from sites by parsing HTML. */ public abstract class AbstractHTMLRipper extends AlbumRipper { - + public AbstractHTMLRipper(URL url) throws IOException { super(url); } @@ -45,7 +45,7 @@ public abstract class AbstractHTMLRipper extends AlbumRipper { public boolean canRip(URL url) { return url.getHost().endsWith(getDomain()); } - + @Override public URL sanitizeURL(URL url) throws MalformedURLException { return url; @@ -66,7 +66,7 @@ public abstract class AbstractHTMLRipper extends AlbumRipper { logger.info("Retrieving " + this.url); sendUpdate(STATUS.LOADING_RESOURCE, this.url.toExternalForm()); Document doc = getFirstPage(); - + while (doc != null) { List imageURLs = getURLsFromPage(doc); // Remove all but 1 image @@ -79,7 +79,7 @@ public abstract class AbstractHTMLRipper extends AlbumRipper { if (imageURLs.size() == 0) { throw new IOException("No images found at " + doc.location()); } - + for (String imageURL : imageURLs) { index += 1; logger.debug("Found image url #" + index + ": " + imageURL); diff --git a/src/main/java/com/rarchives/ripme/ripper/DownloadThreadPool.java b/src/main/java/com/rarchives/ripme/ripper/DownloadThreadPool.java index 9b385500..30e3c2b7 100644 --- a/src/main/java/com/rarchives/ripme/ripper/DownloadThreadPool.java +++ b/src/main/java/com/rarchives/ripme/ripper/DownloadThreadPool.java @@ -19,7 +19,7 @@ public class DownloadThreadPool { public DownloadThreadPool() { initialize("Main"); } - + public DownloadThreadPool(String threadPoolName) { initialize(threadPoolName); } diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/BcfakesRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/BcfakesRipper.java index edc63e02..682519cc 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/BcfakesRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/BcfakesRipper.java @@ -46,12 +46,12 @@ public class BcfakesRipper extends AbstractHTMLRipper { + "http://www.bcfakes.com/celebritylist/name" + " Got: " + url); } - + @Override public Document getFirstPage() throws IOException { return Http.url(url).get(); } - + @Override public Document getNextPage(Document doc) throws IOException { // Find next page @@ -63,7 +63,7 @@ public class BcfakesRipper extends AbstractHTMLRipper { sleep(500); return Http.url(nextUrl).get(); } - + @Override public List getURLsFromPage(Document doc) { List imageURLs = new ArrayList(); diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/DatwinRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/DatwinRipper.java index 7d067e35..2f276bd8 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/DatwinRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/DatwinRipper.java @@ -46,7 +46,7 @@ public class DatwinRipper extends AbstractHTMLRipper { public Document getFirstPage() throws IOException { return Http.url(url).get(); } - + @Override public List getURLsFromPage(Document doc) { List imageURLs = new ArrayList(); @@ -57,7 +57,7 @@ public class DatwinRipper extends AbstractHTMLRipper { } return imageURLs; } - + @Override public void downloadURL(URL url, int index) { addURLToDownload(url, getPrefix(index)); diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/DeviantartRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/DeviantartRipper.java index b170c2e7..0343019e 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/DeviantartRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/DeviantartRipper.java @@ -239,7 +239,7 @@ public class DeviantartRipper extends AbstractHTMLRipper { } return result.toString(); } - + /** * Attempts to download description for image. * Comes in handy when people put entire stories in their description. @@ -277,7 +277,7 @@ public class DeviantartRipper extends AbstractHTMLRipper { return null; } } - + /** * If largest resolution for image at 'thumb' is found, starts downloading * and returns null. diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/FivehundredpxRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/FivehundredpxRipper.java index 1c57cf82..18c32c7f 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/FivehundredpxRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/FivehundredpxRipper.java @@ -155,7 +155,7 @@ public class FivehundredpxRipper extends AbstractJSONRipper { private String getUserID(String username) throws IOException { logger.info("Fetching user ID for " + username); JSONObject json = new Http("https://api.500px.com/v1/" + - "users/show" + + "users/show" + "?username=" + username + "&consumer_key=" + CONSUMER_KEY) .getJSON(); @@ -307,7 +307,7 @@ public class FivehundredpxRipper extends AbstractJSONRipper { } return imageURLs; } - + private boolean urlExists(String url) { try { HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/GirlsOfDesireRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/GirlsOfDesireRipper.java index a7130ed3..1950cf8e 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/GirlsOfDesireRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/GirlsOfDesireRipper.java @@ -69,7 +69,7 @@ public class GirlsOfDesireRipper extends AbstractHTMLRipper { } return albumDoc; } - + @Override public List getURLsFromPage(Document doc) { List imageURLs = new ArrayList(); @@ -83,7 +83,7 @@ public class GirlsOfDesireRipper extends AbstractHTMLRipper { } return imageURLs; } - + @Override public void downloadURL(URL url, int index) { // Send referrer when downloading images diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/ImagearnRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/ImagearnRipper.java index 9fede305..6f82a9c9 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/ImagearnRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/ImagearnRipper.java @@ -69,12 +69,12 @@ public class ImagearnRipper extends AbstractHTMLRipper { } throw new IOException("Failed to find gallery at URL " + url); } - + @Override public Document getFirstPage() throws IOException { return Http.url(url).get(); } - + @Override public List getURLsFromPage(Document doc) { List imageURLs = new ArrayList(); @@ -85,7 +85,7 @@ public class ImagearnRipper extends AbstractHTMLRipper { } return imageURLs; } - + @Override public void downloadURL(URL url, int index) { addURLToDownload(url, getPrefix(index)); diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/ImagebamRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/ImagebamRipper.java index 0a358783..f4608d73 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/ImagebamRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/ImagebamRipper.java @@ -58,7 +58,7 @@ public class ImagebamRipper extends AbstractHTMLRipper { + "http://www.imagebam.com/gallery/galleryid" + " Got: " + url); } - + @Override public Document getFirstPage() throws IOException { if (albumDoc == null) { @@ -66,7 +66,7 @@ public class ImagebamRipper extends AbstractHTMLRipper { } return albumDoc; } - + @Override public Document getNextPage(Document doc) throws IOException { // Find next page @@ -78,7 +78,7 @@ public class ImagebamRipper extends AbstractHTMLRipper { sleep(500); return Http.url(nextUrl).get(); } - + @Override public List getURLsFromPage(Document doc) { List imageURLs = new ArrayList(); @@ -117,7 +117,7 @@ public class ImagebamRipper extends AbstractHTMLRipper { /** * Helper class to find and download images found on "image" pages - * + * * Handles case when site has IP-banned the user. */ private class ImagebamImageThread extends Thread { @@ -134,7 +134,7 @@ public class ImagebamRipper extends AbstractHTMLRipper { public void run() { fetchImage(); } - + private void fetchImage() { try { Document doc = Http.url(url).get(); diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/ImagefapRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/ImagefapRipper.java index ad6a82ae..b405caff 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/ImagefapRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/ImagefapRipper.java @@ -93,7 +93,7 @@ public class ImagefapRipper extends AbstractHTMLRipper { + "imagefap.com/pictures/####..." + " Got: " + url); } - + @Override public Document getFirstPage() throws IOException { if (albumDoc == null) { @@ -101,7 +101,7 @@ public class ImagefapRipper extends AbstractHTMLRipper { } return albumDoc; } - + @Override public Document getNextPage(Document doc) throws IOException { String nextURL = null; @@ -117,7 +117,7 @@ public class ImagefapRipper extends AbstractHTMLRipper { sleep(1000); return Http.url(nextURL).get(); } - + @Override public List getURLsFromPage(Document doc) { List imageURLs = new ArrayList(); @@ -137,7 +137,7 @@ public class ImagefapRipper extends AbstractHTMLRipper { } return imageURLs; } - + @Override public void downloadURL(URL url, int index) { // Send referrer for image downloads diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/ImagevenueRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/ImagevenueRipper.java index 0bb2b6a4..c818f3ec 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/ImagevenueRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/ImagevenueRipper.java @@ -55,12 +55,12 @@ public class ImagevenueRipper extends AbstractHTMLRipper { + "http://...imagevenue.com/galshow.php?gal=gallery_...." + " Got: " + url); } - + @Override public Document getFirstPage() throws IOException { return Http.url(url).get(); } - + public List getURLsFromPage(Document doc) { List imageURLs = new ArrayList(); for (Element thumb : doc.select("a[target=_blank]")) { @@ -68,7 +68,7 @@ public class ImagevenueRipper extends AbstractHTMLRipper { } return imageURLs; } - + public void downloadURL(URL url, int index) { ImagevenueImageThread t = new ImagevenueImageThread(url, index); imagevenueThreadPool.addThread(t); @@ -76,7 +76,7 @@ public class ImagevenueRipper extends AbstractHTMLRipper { /** * Helper class to find and download images found on "image" pages - * + * * Handles case when site has IP-banned the user. */ private class ImagevenueImageThread extends Thread { @@ -93,7 +93,7 @@ public class ImagevenueRipper extends AbstractHTMLRipper { public void run() { fetchImage(); } - + private void fetchImage() { try { Document doc = Http.url(url) diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/ImgboxRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/ImgboxRipper.java index d8804d61..69392c95 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/ImgboxRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/ImgboxRipper.java @@ -39,7 +39,7 @@ public class ImgboxRipper extends AbstractHTMLRipper { throw new MalformedURLException("Expected imgbox.com URL format: " + "imgbox.com/g/albumid - got " + url + "instead"); } - + @Override public Document getFirstPage() throws IOException { return Http.url(url).get(); diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/InstagramRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/InstagramRipper.java index 43b8eda3..69db4920 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/InstagramRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/InstagramRipper.java @@ -11,11 +11,8 @@ import java.util.regex.Pattern; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; -import org.jsoup.nodes.Document; -import org.jsoup.nodes.Element; import com.rarchives.ripme.ripper.AbstractJSONRipper; -import com.rarchives.ripme.ui.RipStatusMessage.STATUS; import com.rarchives.ripme.utils.Http; public class InstagramRipper extends AbstractJSONRipper { @@ -60,7 +57,7 @@ public class InstagramRipper extends AbstractJSONRipper { throw new MalformedURLException("Expected username in URL (instagram.com/username and not " + url); } - + private String getUserID(URL url) throws IOException { Pattern p = Pattern.compile("^https?://instagram\\.com/([^/]+)"); @@ -71,7 +68,7 @@ public class InstagramRipper extends AbstractJSONRipper { throw new IOException("Unable to find userID at " + this.url); } - + @Override public JSONObject getFirstPage() throws IOException { userID = getUserID(url); @@ -111,7 +108,7 @@ public class InstagramRipper extends AbstractJSONRipper { throw new IOException("No more images found"); } } - + @Override public List getURLsFromJSON(JSONObject json) { List imageURLs = new ArrayList(); @@ -142,7 +139,7 @@ public class InstagramRipper extends AbstractJSONRipper { } return imageURLs; } - + @Override public void downloadURL(URL url, int index) { addURLToDownload(url); diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/MediacrushRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/MediacrushRipper.java index 8970c22b..b3fdbdaf 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/MediacrushRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/MediacrushRipper.java @@ -138,9 +138,9 @@ public class MediacrushRipper extends AbstractJSONRipper { } /** - * Iterates over list if "file" objects and returns the preferred + * Iterates over list if "file" objects and returns the preferred * image format. - * @param subfiles Array of "files" (JSONObjects) which contain + * @param subfiles Array of "files" (JSONObjects) which contain * @return Preferred media format. */ private String getPreferredUrl(JSONArray subfiles) { diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/NatalieMuRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/NatalieMuRipper.java index 51f2bdda..9526c6b1 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/NatalieMuRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/NatalieMuRipper.java @@ -4,7 +4,6 @@ import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -13,15 +12,14 @@ import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import com.rarchives.ripme.ripper.AbstractHTMLRipper; -import com.rarchives.ripme.ripper.rippers.ripperhelpers.ChanSite; import com.rarchives.ripme.utils.Http; public class NatalieMuRipper extends AbstractHTMLRipper { - + public int news_id = 0; - + public NatalieMuRipper(URL url) throws IOException { - super(url); + super(url); } @Override @@ -37,12 +35,12 @@ public class NatalieMuRipper extends AbstractHTMLRipper { } @Override - public boolean canRip(URL url) { + public boolean canRip(URL url) { //urls like: // http://cdn2.natalie.mu/music/gallery/show/news_id/xxxxxx/image_id/xxxxxx // http://cdn2.natalie.mu/music/news/140411 return url.toExternalForm().contains("natalie.mu") // Most chans - && (url.toExternalForm().contains("/news_id/") + && (url.toExternalForm().contains("/news_id/") || url.toExternalForm().contains("/news/")); // 4chan, archive.moe } @@ -61,13 +59,13 @@ public class NatalieMuRipper extends AbstractHTMLRipper { m = p.matcher(u); if (m.find()) { return m.group(1); - } + } } else if (u.contains("/news/")) { p = Pattern.compile("/news/([0-9]+)/?"); m = p.matcher(u); if (m.find()) { return m.group(1); - } + } } throw new MalformedURLException( @@ -85,18 +83,18 @@ public class NatalieMuRipper extends AbstractHTMLRipper { public Document getFirstPage() throws IOException { return Http.url(this.url).get(); } - + @Override public List getURLsFromPage(Document page) { List imageURLs = new ArrayList(); Pattern p; Matcher m; //select all album thumbnails for (Element span : page.select(".NA_articleGallery span")) { - if (!span.hasAttr("style")) { + if (!span.hasAttr("style")) { continue; } String style = span.attr("style").trim(); - + p = Pattern.compile("background-image: url\\((.*list_thumb_inbox.*)\\);", Pattern.CASE_INSENSITIVE); m = p.matcher(style); if (m.find()) { @@ -118,7 +116,7 @@ public class NatalieMuRipper extends AbstractHTMLRipper { if (isThisATest()) { break; } - } + } if (isStopped()) { break; @@ -130,5 +128,5 @@ public class NatalieMuRipper extends AbstractHTMLRipper { @Override public void downloadURL(URL url, int index) { addURLToDownload(url, getPrefix(index), "", this.url.toString(), null); - } + } } diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/PornhubRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/PornhubRipper.java index c217f86b..a18ee118 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/PornhubRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/PornhubRipper.java @@ -80,7 +80,7 @@ public class PornhubRipper extends AlbumRipper { public void rip() throws IOException { int index = 0; String nextUrl = this.url.toExternalForm(); - + if (albumDoc == null) { logger.info(" Retrieving album page " + nextUrl); sendUpdate(STATUS.LOADING_RESOURCE, nextUrl); @@ -127,7 +127,7 @@ public class PornhubRipper extends AlbumRipper { /** * Helper class to find and download images found on "image" pages - * + * * Handles case when site has IP-banned the user. */ private class PornhubImageThread extends Thread { @@ -144,28 +144,28 @@ public class PornhubRipper extends AlbumRipper { public void run() { fetchImage(); } - + private void fetchImage() { try { Document doc = Http.url(this.url) .referrer(this.url) .get(); - + // Find image Elements images = doc.select("#photoImageSection img"); Element image = images.first(); String imgsrc = image.attr("src"); logger.info("Found URL " + imgsrc + " via " + images.get(0)); - + // Provide prefix and let the AbstractRipper "guess" the filename String prefix = ""; if (Utils.getConfigBoolean("download.save_order", true)) { prefix = String.format("%03d_", index); } - + URL imgurl = new URL(url, imgsrc); addURLToDownload(imgurl, prefix); - + } catch (IOException e) { logger.error("[!] Exception while loading/parsing " + this.url, e); } diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/RedditRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/RedditRipper.java index 067e7866..cfe71d08 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/RedditRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/RedditRipper.java @@ -26,13 +26,13 @@ public class RedditRipper extends AlbumRipper { private static final String HOST = "reddit"; private static final String DOMAIN = "reddit.com"; - + private static final String REDDIT_USER_AGENT = "RipMe:github/4pr0n/ripme:" + UpdateUtils.getThisJarVersion() + " (by /u/4_pr0n)"; private static final int SLEEP_TIME = 2000; //private static final String USER_AGENT = "ripme by /u/4_pr0n github.com/4pr0n/ripme"; - + private long lastRequestTime = 0; @Override @@ -68,9 +68,9 @@ public class RedditRipper extends AlbumRipper { } waitForThreads(); } - - - + + + private URL getAndParseAndReturnNext(URL url) throws IOException { JSONArray jsonArray = getJsonArrayFromURL(url), children; JSONObject json, data; @@ -108,7 +108,7 @@ public class RedditRipper extends AlbumRipper { } return nextURL; } - + private JSONArray getJsonArrayFromURL(URL url) throws IOException { // Wait 2 seconds before the next request long timeDiff = System.currentTimeMillis() - lastRequestTime; diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/TwodgalleriesRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/TwodgalleriesRipper.java index c48a11c3..fa5281eb 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/TwodgalleriesRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/TwodgalleriesRipper.java @@ -36,7 +36,7 @@ public class TwodgalleriesRipper extends AbstractHTMLRipper { public String getDomain() { return "2dgalleries.com"; } - + @Override public String getGID(URL url) throws MalformedURLException { Pattern p; Matcher m; @@ -108,7 +108,7 @@ public class TwodgalleriesRipper extends AbstractHTMLRipper { public void downloadURL(URL url, int index) { addURLToDownload(url, getPrefix(index)); } - + private void login() throws IOException { Response resp = Http.url(this.url).response(); cookies = resp.cookies(); diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/VidbleRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/VidbleRipper.java index 7b0c8bbb..93bfeab6 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/VidbleRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/VidbleRipper.java @@ -29,7 +29,7 @@ public class VidbleRipper extends AbstractHTMLRipper { public String getDomain() { return "vidble.com"; } - + @Override public String getGID(URL url) throws MalformedURLException { Pattern p; Matcher m; @@ -62,7 +62,7 @@ public class VidbleRipper extends AbstractHTMLRipper { for (Element img : imgs) { String src = img.absUrl("src"); src = src.replaceAll("_[a-zA-Z]{3,5}", ""); - + if (!src.equals("")) { imageURLs.add(src); } diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/tamindirmp3.java b/src/main/java/com/rarchives/ripme/ripper/rippers/tamindirmp3.java index 208932d0..7657a5af 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/tamindirmp3.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/tamindirmp3.java @@ -39,13 +39,13 @@ public class tamindirmp3 extends AbstractHTMLRipper { throw new MalformedURLException("Expected tamindir.com URL format: " + "tamindir.com/files/albumid - got " + url + "instead"); } - + @Override public Document getFirstPage() throws IOException { return Http.url(url).get(); - + } - + @Override public List getURLsFromPage(Document doc) { List music = new ArrayList(); diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/video/CliphunterRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/video/CliphunterRipper.java index 19048f8a..fb38b216 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/video/CliphunterRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/video/CliphunterRipper.java @@ -33,7 +33,7 @@ public class CliphunterRipper extends VideoRipper { Matcher m = p.matcher(url.toExternalForm()); return m.matches(); } - + @Override public URL sanitizeURL(URL url) throws MalformedURLException { return url; diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/video/GfycatRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/video/GfycatRipper.java index 54a66769..dd0d20eb 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/video/GfycatRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/video/GfycatRipper.java @@ -29,7 +29,7 @@ public class GfycatRipper extends VideoRipper { public boolean canRip(URL url) { return url.getHost().endsWith(HOST); } - + @Override public URL sanitizeURL(URL url) throws MalformedURLException { return url; diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/video/VidearnRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/video/VidearnRipper.java index 5d971b87..7f215770 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/video/VidearnRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/video/VidearnRipper.java @@ -32,7 +32,7 @@ public class VidearnRipper extends VideoRipper { Matcher m = p.matcher(url.toExternalForm()); return m.matches(); } - + @Override public URL sanitizeURL(URL url) throws MalformedURLException { return url; diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/video/VineRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/video/VineRipper.java index 02aea14e..09637b84 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/video/VineRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/video/VineRipper.java @@ -32,7 +32,7 @@ public class VineRipper extends VideoRipper { Matcher m = p.matcher(url.toExternalForm()); return m.matches(); } - + @Override public URL sanitizeURL(URL url) throws MalformedURLException { return url; diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/video/VkRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/video/VkRipper.java index a5ce360d..c610a470 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/video/VkRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/video/VkRipper.java @@ -30,7 +30,7 @@ public class VkRipper extends VideoRipper { Matcher m = p.matcher(url.toExternalForm()); return m.matches(); } - + @Override public URL sanitizeURL(URL url) throws MalformedURLException { return url; @@ -57,7 +57,7 @@ public class VkRipper extends VideoRipper { addURLToDownload(new URL(videoURL), HOST + "_" + getGID(this.url)); waitForThreads(); } - + public static String getVideoURLAtPage(String url) throws IOException { Document doc = Http.url(url) .userAgent(USER_AGENT) diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/video/XhamsterRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/video/XhamsterRipper.java index cb6d5725..061ec2fb 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/video/XhamsterRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/video/XhamsterRipper.java @@ -31,7 +31,7 @@ public class XhamsterRipper extends VideoRipper { Matcher m = p.matcher(url.toExternalForm()); return m.matches(); } - + @Override public URL sanitizeURL(URL url) throws MalformedURLException { return url; diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/video/XvideosRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/video/XvideosRipper.java index 53edc9f6..06841ce9 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/video/XvideosRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/video/XvideosRipper.java @@ -33,7 +33,7 @@ public class XvideosRipper extends VideoRipper { Matcher m = p.matcher(url.toExternalForm()); return m.matches(); } - + @Override public URL sanitizeURL(URL url) throws MalformedURLException { return url; diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/video/YoupornRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/video/YoupornRipper.java index 493bb89a..a5e00b4b 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/video/YoupornRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/video/YoupornRipper.java @@ -32,7 +32,7 @@ public class YoupornRipper extends VideoRipper { Matcher m = p.matcher(url.toExternalForm()); return m.matches(); } - + @Override public URL sanitizeURL(URL url) throws MalformedURLException { return url; diff --git a/src/main/java/com/rarchives/ripme/ui/ClipboardUtils.java b/src/main/java/com/rarchives/ripme/ui/ClipboardUtils.java index 8b68a4b2..1a07da97 100644 --- a/src/main/java/com/rarchives/ripme/ui/ClipboardUtils.java +++ b/src/main/java/com/rarchives/ripme/ui/ClipboardUtils.java @@ -14,7 +14,7 @@ import static com.rarchives.ripme.App.logger; public class ClipboardUtils { private static AutoripThread autoripThread = new AutoripThread(); - + public static void setClipboardAutoRip(boolean enabled) { if (enabled) { autoripThread.kill(); @@ -44,7 +44,7 @@ public class ClipboardUtils { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); - } + } return null; } } @@ -61,15 +61,15 @@ class AutoripThread extends Thread { String clipboard = ClipboardUtils.getClipboardString(); if (clipboard != null) { Pattern p = Pattern.compile( - "\\b(((ht|f)tp(s?)\\:\\/\\/|~\\/|\\/)|www.)" + - "(\\w+:\\w+@)?(([-\\w]+\\.)+(com|org|net|gov" + - "|mil|biz|info|mobi|name|aero|jobs|museum" + - "|travel|[a-z]{2}))(:[\\d]{1,5})?" + - "(((\\/([-\\w~!$+|.,=]|%[a-f\\d]{2})+)+|\\/)+|\\?|#)?" + - "((\\?([-\\w~!$+|.,*:]|%[a-f\\d{2}])+=?" + - "([-\\w~!$+|.,*:=]|%[a-f\\d]{2})*)" + - "(&(?:[-\\w~!$+|.,*:]|%[a-f\\d{2}])+=?" + - "([-\\w~!$+|.,*:=]|%[a-f\\d]{2})*)*)*" + + "\\b(((ht|f)tp(s?)\\:\\/\\/|~\\/|\\/)|www.)" + + "(\\w+:\\w+@)?(([-\\w]+\\.)+(com|org|net|gov" + + "|mil|biz|info|mobi|name|aero|jobs|museum" + + "|travel|[a-z]{2}))(:[\\d]{1,5})?" + + "(((\\/([-\\w~!$+|.,=]|%[a-f\\d]{2})+)+|\\/)+|\\?|#)?" + + "((\\?([-\\w~!$+|.,*:]|%[a-f\\d{2}])+=?" + + "([-\\w~!$+|.,*:=]|%[a-f\\d]{2})*)" + + "(&(?:[-\\w~!$+|.,*:]|%[a-f\\d{2}])+=?" + + "([-\\w~!$+|.,*:=]|%[a-f\\d]{2})*)*)*" + "(#([-\\w~!$+|.,*:=]|%[a-f\\d]{2})*)?\\b"); Matcher m = p.matcher(clipboard); while (m.find()) { @@ -87,7 +87,7 @@ class AutoripThread extends Thread { e.printStackTrace(); } } - + public void kill() { isRunning = false; } diff --git a/src/main/java/com/rarchives/ripme/ui/RipStatusMessage.java b/src/main/java/com/rarchives/ripme/ui/RipStatusMessage.java index 9d1c73d3..bdd68e3b 100644 --- a/src/main/java/com/rarchives/ripme/ui/RipStatusMessage.java +++ b/src/main/java/com/rarchives/ripme/ui/RipStatusMessage.java @@ -10,7 +10,7 @@ public class RipStatusMessage { DOWNLOAD_STARTED("Download Started"), DOWNLOAD_COMPLETE("Download Complete"), DOWNLOAD_ERRORED("Download Errored"), - RIP_COMPLETE("Rip Complete"), + RIP_COMPLETE("Rip Complete"), DOWNLOAD_WARN("Download problem"), TOTAL_BYTES("Total bytes"), COMPLETED_BYTES("Completed bytes"), @@ -29,11 +29,11 @@ public class RipStatusMessage { this.status = status; this.object = object; } - + public STATUS getStatus() { return status; } - + public Object getObject() { return object; } diff --git a/src/main/java/com/rarchives/ripme/utils/Base64.java b/src/main/java/com/rarchives/ripme/utils/Base64.java index d38f545e..b48f7452 100644 --- a/src/main/java/com/rarchives/ripme/utils/Base64.java +++ b/src/main/java/com/rarchives/ripme/utils/Base64.java @@ -72,5 +72,5 @@ public class Base64 { buffer[index++]= (byte)(((c2 << 6) | c3) & mask); } return buffer; - } + } } diff --git a/src/main/java/com/rarchives/ripme/utils/RipUtils.java b/src/main/java/com/rarchives/ripme/utils/RipUtils.java index 073d4717..c36942d9 100644 --- a/src/main/java/com/rarchives/ripme/utils/RipUtils.java +++ b/src/main/java/com/rarchives/ripme/utils/RipUtils.java @@ -23,7 +23,6 @@ import com.rarchives.ripme.ripper.rippers.VidbleRipper; import com.rarchives.ripme.ripper.rippers.video.GfycatRipper; import com.rarchives.ripme.ripper.rippers.EroShareRipper; - public class RipUtils { private static final Logger logger = Logger.getLogger(RipUtils.class); @@ -32,7 +31,7 @@ public class RipUtils { logger.debug("Checking " + url); // Imgur album - if ((url.getHost().endsWith("imgur.com")) + if ((url.getHost().endsWith("imgur.com")) && url.toExternalForm().contains("imgur.com/a/")) { try { logger.debug("Fetching imgur album at " + url); @@ -91,7 +90,7 @@ public class RipUtils { } return result; } - + Pattern p = Pattern.compile("https?://i.reddituploads.com/([a-zA-Z0-9]+)\\?.*"); Matcher m = p.matcher(url.toExternalForm()); if (m.matches()) { @@ -117,8 +116,8 @@ public class RipUtils { logger.error("[!] Not a valid URL: '" + url + "'", e); } } - - if (url.getHost().equals("imgur.com") || + + if (url.getHost().equals("imgur.com") || url.getHost().equals("m.imgur.com")){ try { // Fetch the page @@ -138,13 +137,13 @@ public class RipUtils { } catch (IOException ex) { logger.error("[!] Error", ex); } - + } - + logger.error("[!] Unable to rip URL: " + url); return result; } - + public static Pattern getURLRegex() { return Pattern.compile("(https?://[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,3}(/\\S*))"); } diff --git a/src/main/java/com/rarchives/ripme/utils/Utils.java b/src/main/java/com/rarchives/ripme/utils/Utils.java index f3957360..e5343cf2 100644 --- a/src/main/java/com/rarchives/ripme/utils/Utils.java +++ b/src/main/java/com/rarchives/ripme/utils/Utils.java @@ -393,7 +393,7 @@ public class Utils { /** * Parses an URL query - * + * * @param query * The query part of an URL * @return The map of all query parameters @@ -426,7 +426,7 @@ public class Utils { /** * Parses an URL query and returns the requested parameter's value - * + * * @param query * The query part of an URL * @param key diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BasicRippersTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BasicRippersTest.java index 39f57576..153288d8 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BasicRippersTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/BasicRippersTest.java @@ -106,7 +106,7 @@ public class BasicRippersTest extends RippersTest { testRipper(ripper); } */ - + public void test500pxAlbum() throws IOException { FivehundredpxRipper ripper = new FivehundredpxRipper(new URL("https://marketplace.500px.com/alexander_hurman")); testRipper(ripper); @@ -261,7 +261,7 @@ public class BasicRippersTest extends RippersTest { AbstractRipper ripper = new VineRipper(new URL("https://vine.co/u/954440445776334848")); testRipper(ripper); } - + public void testVkSubalbumRip() throws IOException { VkRipper ripper = new VkRipper(new URL("http://vk.com/album45506334_0")); testRipper(ripper); diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/InstagramRipperTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/InstagramRipperTest.java index 984bc29f..bcf8a711 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/InstagramRipperTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/InstagramRipperTest.java @@ -10,7 +10,7 @@ import java.util.Map; import com.rarchives.ripme.ripper.rippers.InstagramRipper; public class InstagramRipperTest extends RippersTest { - + public void testInstagramGID() throws IOException { Map testURLs = new HashMap(); testURLs.put(new URL("http://instagram.com/Test_User"), "Test_User"); diff --git a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/VideoRippersTest.java b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/VideoRippersTest.java index 72249fd8..409dfee9 100644 --- a/src/test/java/com/rarchives/ripme/tst/ripper/rippers/VideoRippersTest.java +++ b/src/test/java/com/rarchives/ripme/tst/ripper/rippers/VideoRippersTest.java @@ -12,7 +12,7 @@ import com.rarchives.ripme.ripper.rippers.video.XvideosRipper; import com.rarchives.ripme.ripper.rippers.video.YoupornRipper; public class VideoRippersTest extends RippersTest { - + /** * Helper method for testing a video ripper * @param ripper The video ripper @@ -44,7 +44,7 @@ public class VideoRippersTest extends RippersTest { videoTestHelper(ripper); } } - + public void testPornhubRipper() throws IOException { List contentURLs = new ArrayList(); contentURLs.add(new URL("http://www.pornhub.com/view_video.php?viewkey=993166542"));