Replaced the if-else statement by a single return statement.

Replaced use of Collection.size () by Collection.isEmpty () in ViddmeRipper.
This commit is contained in:
Gaboso 2018-05-31 09:21:44 -04:00
parent 2ecffc3497
commit 5c6b68a428
7 changed files with 8 additions and 29 deletions

View File

@ -57,10 +57,7 @@ public class BatoRipper extends AbstractHTMLRipper {
public boolean pageContainsAlbums(URL url) { public boolean pageContainsAlbums(URL url) {
Pattern p = Pattern.compile("https?://bato.to/series/([\\d]+)/?"); Pattern p = Pattern.compile("https?://bato.to/series/([\\d]+)/?");
Matcher m = p.matcher(url.toExternalForm()); Matcher m = p.matcher(url.toExternalForm());
if (m.matches()) { return m.matches();
return true;
}
return false;
} }
@Override @Override
@ -94,10 +91,7 @@ public class BatoRipper extends AbstractHTMLRipper {
p = Pattern.compile("https?://bato.to/chapter/([\\d]+)/?"); p = Pattern.compile("https?://bato.to/chapter/([\\d]+)/?");
m = p.matcher(url.toExternalForm()); m = p.matcher(url.toExternalForm());
if (m.matches()) { return m.matches();
return true;
}
return false;
} }
@Override @Override

View File

@ -35,10 +35,7 @@ public class NhentaiRipper extends AbstractHTMLRipper {
public boolean pageContainsAlbums(URL url) { public boolean pageContainsAlbums(URL url) {
Pattern pa = Pattern.compile("^https?://nhentai\\.net/tag/([a-zA-Z0-9_\\-]+)/?"); Pattern pa = Pattern.compile("^https?://nhentai\\.net/tag/([a-zA-Z0-9_\\-]+)/?");
Matcher ma = pa.matcher(url.toExternalForm()); Matcher ma = pa.matcher(url.toExternalForm());
if (ma.matches()) { return ma.matches();
return true;
}
return false;
} }
@Override @Override

View File

@ -60,10 +60,7 @@ public class PichunterRipper extends AbstractHTMLRipper {
private boolean isPhotoSet(URL url) { private boolean isPhotoSet(URL url) {
Pattern p = Pattern.compile("https?://www.pichunter.com/gallery/\\d+/(\\S*)/?"); Pattern p = Pattern.compile("https?://www.pichunter.com/gallery/\\d+/(\\S*)/?");
Matcher m = p.matcher(url.toExternalForm()); Matcher m = p.matcher(url.toExternalForm());
if (m.matches()) { return m.matches();
return true;
}
return false;
} }
@Override @Override

View File

@ -37,10 +37,7 @@ public class Rule34Ripper extends AbstractHTMLRipper {
public boolean canRip(URL url){ public boolean canRip(URL url){
Pattern p = Pattern.compile("https?://rule34.xxx/index.php\\?page=post&s=list&tags=([\\S]+)"); Pattern p = Pattern.compile("https?://rule34.xxx/index.php\\?page=post&s=list&tags=([\\S]+)");
Matcher m = p.matcher(url.toExternalForm()); Matcher m = p.matcher(url.toExternalForm());
if (m.matches()) { return m.matches();
return true;
}
return false;
} }
@Override @Override

View File

@ -38,10 +38,7 @@ public class WebtoonsRipper extends AbstractHTMLRipper {
public boolean canRip(URL url) { public boolean canRip(URL url) {
Pattern pat = Pattern.compile("https?://www.webtoons.com/[a-zA-Z-_]+/[a-zA-Z_-]+/([a-zA-Z0-9_-]*)/[a-zA-Z0-9_-]+/\\S*"); Pattern pat = Pattern.compile("https?://www.webtoons.com/[a-zA-Z-_]+/[a-zA-Z_-]+/([a-zA-Z0-9_-]*)/[a-zA-Z0-9_-]+/\\S*");
Matcher mat = pat.matcher(url.toExternalForm()); Matcher mat = pat.matcher(url.toExternalForm());
if (mat.matches()) { return mat.matches();
return true;
}
return false;
} }

View File

@ -64,10 +64,7 @@ public class XhamsterRipper extends AbstractHTMLRipper {
public boolean canRip(URL url) { public boolean canRip(URL url) {
Pattern p = Pattern.compile("^https?://[wmde.]*xhamster\\.com/photos/gallery/.*?(\\d+)$"); Pattern p = Pattern.compile("^https?://[wmde.]*xhamster\\.com/photos/gallery/.*?(\\d+)$");
Matcher m = p.matcher(url.toExternalForm()); Matcher m = p.matcher(url.toExternalForm());
if (m.matches()) { return m.matches();
return true;
}
return false;
} }
@Override @Override

View File

@ -56,7 +56,7 @@ public class ViddmeRipper extends VideoRipper {
logger.info(" Retrieving " + this.url.toExternalForm()); logger.info(" Retrieving " + this.url.toExternalForm());
Document doc = Http.url(this.url).get(); Document doc = Http.url(this.url).get();
Elements videos = doc.select("meta[name=twitter:player:stream]"); Elements videos = doc.select("meta[name=twitter:player:stream]");
if (videos.size() == 0) { if (videos.isEmpty()) {
throw new IOException("Could not find twitter:player:stream at " + url); throw new IOException("Could not find twitter:player:stream at " + url);
} }
String vidUrl = videos.first().attr("content"); String vidUrl = videos.first().attr("content");