Update AbstractHTMLRipper.java

This commit is contained in:
jisuyame 2015-10-15 22:27:34 +03:00
parent 1255a76bf3
commit 94068436e8

View File

@ -15,9 +15,11 @@ import com.rarchives.ripme.utils.Utils;
/** /**
* Simplified ripper, designed for ripping from sites by parsing HTML. * Simplified ripper, designed for ripping from sites by parsing HTML.
*/ */
public abstract class AbstractHTMLRipper extends AlbumRipper {
public AbstractHTMLRipper(URL url) throws IOException { public abstract class AbstractHTMLRipper extends AlbumRipper {
public class Tamindirmp3 extends AbstractHTMLRipper {
public Tamindirmp3(URL url) throws IOException {
super(url); super(url);
} }
@ -40,6 +42,47 @@ public abstract class AbstractHTMLRipper extends AlbumRipper {
public boolean keepSortOrder() { public boolean keepSortOrder() {
return true; return true;
} }
@Override
public String getHost() {
return "Tamindirmp3";
}
@Override
public String getDomain() {
return "server28.tamdinle.com";
}
@Override
public String getGID(URL url) throws MalformedURLException {
Pattern p = Pattern.compile("^https?://server28.tamdinle\\.com/files/([files-zA-Z0-9]+).*$");
Matcher m = p.matcher(url.toExternalForm());
if (m.matches()) {
// Return the text contained between () in the regex
return m.group(1);
}
throw new MalformedURLException("Expected server28.tamindir.com URL format: " +
"server28.tamdinle.com/files/ - got " + url + " instead");
}
@Override
public Document getFirstPage() throws IOException {
// "url" is an instance field of the superclass
return Http.url(url).get();
}
@Override
public List<String> getURLsFromPage(Document doc) {
List<String> result = new ArrayList<String>();
for (Element el : doc.select("img")) {
result.add(el.attr("src"));
}
return result
}
@Override
public void downloadURL(URL url, int index) {
addURLToDownload(url, getPrefix(index));
}
@Override @Override
public boolean canRip(URL url) { public boolean canRip(URL url) {