Merge pull request #979 from cyian-1756/yuki.la

Added yuki.la to chan ripper
This commit is contained in:
cyian-1756 2018-10-06 08:57:59 -05:00 committed by GitHub
commit 89f1fdbc67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,7 +19,8 @@ public class ChanRipper extends AbstractHTMLRipper {
private static List<ChanSite> explicit_domains = Arrays.asList( private static List<ChanSite> explicit_domains = Arrays.asList(
new ChanSite(Arrays.asList("boards.4chan.org"), Arrays.asList("4cdn.org", "is.4chan.org", "is2.4chan.org", "is3.4chan.org")), new ChanSite(Arrays.asList("boards.4chan.org"), Arrays.asList("4cdn.org", "is.4chan.org", "is2.4chan.org", "is3.4chan.org")),
new ChanSite(Arrays.asList("4archive.org"), Arrays.asList("imgur.com")), new ChanSite(Arrays.asList("4archive.org"), Arrays.asList("imgur.com")),
new ChanSite(Arrays.asList("archive.4plebs.org"), Arrays.asList("img.4plebs.org")) new ChanSite(Arrays.asList("archive.4plebs.org"), Arrays.asList("img.4plebs.org")),
new ChanSite(Arrays.asList("yuki.la"))
); );
private static List<String> url_piece_blacklist = Arrays.asList( private static List<String> url_piece_blacklist = Arrays.asList(
@ -120,7 +121,7 @@ public class ChanRipper extends AbstractHTMLRipper {
Matcher m; Matcher m;
String u = url.toExternalForm(); String u = url.toExternalForm();
if (u.contains("/thread/") || u.contains("/res/")) { if (u.contains("/thread/") || u.contains("/res/") || u.contains("yuki.la")) {
p = Pattern.compile("^.*\\.[a-z]{1,3}/[a-zA-Z0-9]+/(thread|res)/([0-9]+)(\\.html|\\.php)?.*$"); p = Pattern.compile("^.*\\.[a-z]{1,3}/[a-zA-Z0-9]+/(thread|res)/([0-9]+)(\\.html|\\.php)?.*$");
m = p.matcher(u); m = p.matcher(u);
if (m.matches()) { if (m.matches()) {
@ -139,6 +140,13 @@ public class ChanRipper extends AbstractHTMLRipper {
if (m.matches()) { if (m.matches()) {
return m.group(1); return m.group(1);
} }
// yuki.la
p = Pattern.compile("https?://yuki.la/[a-zA-Z0-9]+/([0-9]+)");
m = p.matcher(u);
if (m.matches()) {
return m.group(1);
}
} }
throw new MalformedURLException( throw new MalformedURLException(