Merge pull request #937 from cyian-1756/HbrowseRipperTest

Hbrowse ripper test
This commit is contained in:
cyian-1756 2018-09-13 06:30:16 -04:00 committed by GitHub
commit d35fd511db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -32,7 +32,7 @@ public class HbrowseRipper extends AbstractHTMLRipper {
@Override
public String getGID(URL url) throws MalformedURLException {
Pattern p = Pattern.compile("http://www.hbrowse.com/(\\d+)/[a-zA-Z0-9]*");
Pattern p = Pattern.compile("https?://www.hbrowse.com/(\\d+)/[a-zA-Z0-9]*");
Matcher m = p.matcher(url.toExternalForm());
if (m.matches()) {
return m.group(1);
@ -45,7 +45,7 @@ public class HbrowseRipper extends AbstractHTMLRipper {
public Document getFirstPage() throws IOException {
// "url" is an instance field of the superclass
Document tempDoc = Http.url(url).get();
return Http.url(tempDoc.select("td[id=pageTopHome] > a[title=view thumbnails (top)]").attr("href")).get();
return Http.url("https://www.hbrowse.com" + tempDoc.select("td[id=pageTopHome] > a[title=view thumbnails (top)]").attr("href")).get();
}
@Override
@ -66,7 +66,7 @@ public class HbrowseRipper extends AbstractHTMLRipper {
List<String> result = new ArrayList<String>();
for (Element el : doc.select("table > tbody > tr > td > a > img")) {
String imageURL = el.attr("src").replace("/zzz", "");
result.add(imageURL);
result.add("https://www.hbrowse.com" + imageURL);
}
return result;
}

View File

@ -6,5 +6,8 @@ import java.net.URL;
import com.rarchives.ripme.ripper.rippers.HbrowseRipper;
public class HbrowseRipperTest extends RippersTest {
// TODO add a test
public void testPahealRipper() throws IOException {
HbrowseRipper ripper = new HbrowseRipper(new URL("https://www.hbrowse.com/21013/c00001"));
testRipper(ripper);
}
}