Use descriptive naming when Save album titles option is enabled. Format is xhamster_<user>_<gallery url>.
This commit is contained in:
parent
1c902751d3
commit
aac4fa48f5
@ -100,4 +100,23 @@ public class XhamsterRipper extends AbstractHTMLRipper {
|
|||||||
public void downloadURL(URL url, int index) {
|
public void downloadURL(URL url, int index) {
|
||||||
addURLToDownload(url, getPrefix(index));
|
addURLToDownload(url, getPrefix(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAlbumTitle(URL url) throws MalformedURLException {
|
||||||
|
try {
|
||||||
|
// Attempt to use album title and username as GID
|
||||||
|
Document doc = getFirstPage();
|
||||||
|
Element user = doc.select("a.author").first();
|
||||||
|
String username = user.text();
|
||||||
|
String path = url.getPath();
|
||||||
|
Pattern p = Pattern.compile("^/photos/gallery/(.*)$");
|
||||||
|
Matcher m = p.matcher(path);
|
||||||
|
if (m.matches() && !username.isEmpty()) {
|
||||||
|
return getHost() + "_" + username + "_" + m.group(1);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
// Fall back to default album naming convention
|
||||||
|
}
|
||||||
|
return super.getAlbumTitle(url);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user