eroshare ripper now grabs album name

This commit is contained in:
cyian-1756 2017-03-19 19:50:29 -04:00
parent 306b7ec9cb
commit 141478213c

View File

@ -29,11 +29,11 @@ import com.rarchives.ripme.utils.Http;
* @author losipher
*/
public class EroShareRipper extends AbstractHTMLRipper {
public EroShareRipper (URL url) throws IOException {
super(url);
}
@Override
public String getDomain() {
return "eroshare.com";
@ -43,12 +43,28 @@ public class EroShareRipper extends AbstractHTMLRipper {
public String getHost() {
return "eroshare";
}
@Override
public void downloadURL(URL url, int index){
addURLToDownload(url);
}
@Override
public String getAlbumTitle(URL url) throws MalformedURLException {
try {
// Attempt to use album title as GID
Element titleElement = getFirstPage().select("meta[property=og:title]").first();
String title = titleElement.attr("content");
title = title.substring(title.lastIndexOf('/') + 1);
return getHost() + "_" + getGID(url) + "_" + title.trim();
} catch (IOException e) {
// Fall back to default album naming convention
logger.info("Unable to find title at " + url);
}
return super.getAlbumTitle(url);
}
@Override
public List<String> getURLsFromPage(Document doc){
List<String> URLs = new ArrayList<String>();
@ -70,10 +86,10 @@ public class EroShareRipper extends AbstractHTMLRipper {
URLs.add(videoURL);
}
}
return URLs;
}
@Override
public Document getFirstPage() throws IOException {
Response resp = Http.url(this.url)
@ -81,10 +97,10 @@ public class EroShareRipper extends AbstractHTMLRipper {
.response();
Document doc = resp.parse();
return doc;
}
@Override
public String getGID(URL url) throws MalformedURLException {
Pattern p = Pattern.compile("^https?://[w.]*eroshare.com/([a-zA-Z0-9\\-_]+)/?$");
@ -94,9 +110,9 @@ public class EroShareRipper extends AbstractHTMLRipper {
}
throw new MalformedURLException("eroshare album not found in " + url + ", expected https://eroshare.com/album");
}
public static List<URL> getURLs(URL url) throws IOException{
Response resp = Http.url(url)
.ignoreContentType()
.response();
@ -122,7 +138,7 @@ public class EroShareRipper extends AbstractHTMLRipper {
URLs.add(new URL(videoURL));
}
}
return URLs;
}
}