Fixes xhamster.com video ripper.

This commit is contained in:
reph 2018-01-13 21:23:44 -06:00
parent c070f154f4
commit 81f804e61f
2 changed files with 13 additions and 3 deletions

View File

@ -39,10 +39,10 @@ public class XhamsterRipper extends VideoRipper {
@Override @Override
public String getGID(URL url) throws MalformedURLException { public String getGID(URL url) throws MalformedURLException {
Pattern p = Pattern.compile("^https?://.*xhamster\\.com/(movies|videos)/.*$"); Pattern p = Pattern.compile("^https?://.*xhamster\\.com/(movies|videos)/(.*)$");
Matcher m = p.matcher(url.toExternalForm()); Matcher m = p.matcher(url.toExternalForm());
if (m.matches()) { if (m.matches()) {
return m.group(1); return m.group(2);
} }
throw new MalformedURLException( throw new MalformedURLException(
@ -56,7 +56,7 @@ public class XhamsterRipper extends VideoRipper {
public void rip() throws IOException { public void rip() throws IOException {
logger.info("Retrieving " + this.url); logger.info("Retrieving " + this.url);
Document doc = Http.url(url).get(); Document doc = Http.url(url).get();
Elements videos = doc.select("a.mp4Thumb"); Elements videos = doc.select("div.player-container > a");
if (videos.size() == 0) { if (videos.size() == 0) {
throw new IOException("Could not find Embed code at " + url); throw new IOException("Could not find Embed code at " + url);
} }

View File

@ -8,6 +8,7 @@ import java.util.List;
import com.rarchives.ripme.ripper.VideoRipper; import com.rarchives.ripme.ripper.VideoRipper;
import com.rarchives.ripme.ripper.rippers.video.PornhubRipper; import com.rarchives.ripme.ripper.rippers.video.PornhubRipper;
import com.rarchives.ripme.ripper.rippers.video.VineRipper; import com.rarchives.ripme.ripper.rippers.video.VineRipper;
import com.rarchives.ripme.ripper.rippers.video.XhamsterRipper;
import com.rarchives.ripme.ripper.rippers.video.XvideosRipper; import com.rarchives.ripme.ripper.rippers.video.XvideosRipper;
import com.rarchives.ripme.ripper.rippers.video.YoupornRipper; import com.rarchives.ripme.ripper.rippers.video.YoupornRipper;
@ -35,6 +36,15 @@ public class VideoRippersTest extends RippersTest {
} }
} }
public void testXhamsterRipper() throws IOException {
List<URL> contentURLs = new ArrayList<>();
contentURLs.add(new URL("https://xhamster.com/videos/brazzers-busty-big-booty-milf-lisa-ann-fucks-her-masseur-1492828"));
for (URL url : contentURLs) {
XhamsterRipper ripper = new XhamsterRipper(url);
videoTestHelper(ripper);
}
}
public void testXvideosRipper() throws IOException { public void testXvideosRipper() throws IOException {
List<URL> contentURLs = new ArrayList<>(); List<URL> contentURLs = new ArrayList<>();
contentURLs.add(new URL("https://www.xvideos.com/video19719109/ziggy_star_ultra_hard_anal_pounding")); contentURLs.add(new URL("https://www.xvideos.com/video19719109/ziggy_star_ultra_hard_anal_pounding"));