From cda864a1b91e7a284a4ac8035ef089cef3cf9433 Mon Sep 17 00:00:00 2001 From: 4pr0n Date: Fri, 27 Jun 2014 20:19:34 -0700 Subject: [PATCH] 1.0.74 - Videarn video ripper #8 --- pom.xml | 2 +- .../ripper/rippers/video/VidearnRipper.java | 67 +++++++++++++++++++ .../com/rarchives/ripme/ui/UpdateUtils.java | 2 +- 3 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 src/main/java/com/rarchives/ripme/ripper/rippers/video/VidearnRipper.java diff --git a/pom.xml b/pom.xml index 36cfb4be..365b99f7 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rarchives.ripme ripme jar - 1.0.73 + 1.0.74 ripme http://rip.rarchives.com 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 new file mode 100644 index 00000000..5d971b87 --- /dev/null +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/video/VidearnRipper.java @@ -0,0 +1,67 @@ +package com.rarchives.ripme.ripper.rippers.video; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.jsoup.nodes.Document; + +import com.rarchives.ripme.ripper.VideoRipper; +import com.rarchives.ripme.utils.Http; +import com.rarchives.ripme.utils.Utils; + +public class VidearnRipper extends VideoRipper { + + private static final String HOST = "videarn"; + + public VidearnRipper(URL url) throws IOException { + super(url); + } + + @Override + public String getHost() { + return HOST; + } + + @Override + public boolean canRip(URL url) { + Pattern p = Pattern.compile("^https?://[wm.]*videarn\\.com/[a-zA-Z0-9\\-]+/([0-9]+).*$"); + Matcher m = p.matcher(url.toExternalForm()); + return m.matches(); + } + + @Override + public URL sanitizeURL(URL url) throws MalformedURLException { + return url; + } + + @Override + public String getGID(URL url) throws MalformedURLException { + Pattern p = Pattern.compile("^https?://[wm.]*videarn\\.com/[a-zA-Z0-9\\-]+/([0-9]+).*$"); + Matcher m = p.matcher(url.toExternalForm()); + if (m.matches()) { + return m.group(1); + } + + throw new MalformedURLException( + "Expected videarn format:" + + "videarn.com/.../####-..." + + " Got: " + url); + } + + @Override + public void rip() throws IOException { + logger.info("Retrieving " + this.url); + Document doc = Http.url(url).get(); + List mp4s = Utils.between(doc.html(), "file:\"", "\""); + if (mp4s.size() == 0) { + throw new IOException("Could not find files at " + url); + } + String vidUrl = mp4s.get(0); + addURLToDownload(new URL(vidUrl), HOST + "_" + getGID(this.url)); + waitForThreads(); + } +} \ No newline at end of file diff --git a/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java b/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java index 4d0797cf..e6eef051 100644 --- a/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java +++ b/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java @@ -21,7 +21,7 @@ import com.rarchives.ripme.utils.Utils; public class UpdateUtils { private static final Logger logger = Logger.getLogger(UpdateUtils.class); - private static final String DEFAULT_VERSION = "1.0.73"; + private static final String DEFAULT_VERSION = "1.0.74"; private static final String updateJsonURL = "http://rarchives.com/ripme.json"; private static final String updateJarURL = "http://rarchives.com/ripme.jar"; private static final String mainFileName = "ripme.jar";