From d06a0ae11bac13d31934d4d4de46c04be1f12998 Mon Sep 17 00:00:00 2001 From: cyian-1756 Date: Mon, 18 Dec 2017 14:35:20 -0500 Subject: [PATCH] Erome ripper now matchs links without the www --- .../ripme/ripper/rippers/EromeRipper.java | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/rarchives/ripme/ripper/rippers/EromeRipper.java b/src/main/java/com/rarchives/ripme/ripper/rippers/EromeRipper.java index e9f2fa54..84e63e76 100644 --- a/src/main/java/com/rarchives/ripme/ripper/rippers/EromeRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/rippers/EromeRipper.java @@ -1,8 +1,3 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ package com.rarchives.ripme.ripper.rippers; import java.io.IOException; @@ -62,6 +57,11 @@ public class EromeRipper extends AbstractHTMLRipper { return super.getAlbumTitle(url); } + @Override + public URL sanitizeURL(URL url) throws MalformedURLException { + return new URL(url.toExternalForm().replaceAll("https?://erome.com", "https://www.erome.com")); + } + @Override public List getURLsFromPage(Document doc) { @@ -99,7 +99,15 @@ public class EromeRipper extends AbstractHTMLRipper { if (m.matches()) { return m.group(1); } - throw new MalformedURLException("erome album not found in " + url + ", expected https://erome.com/album"); + + p = Pattern.compile("^https?://erome.com/a/([a-zA-Z0-9]*)/?$"); + m = p.matcher(url.toExternalForm()); + + if (m.matches()) { + return m.group(1); + } + + throw new MalformedURLException("erome album not found in " + url + ", expected https://www.erome.com/album"); } public static List getURLs(URL url) throws IOException{