X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Fsupported%2FE621.java;h=39bbe867d9eb2cdfc630c80df9393bc9bc47aba4;hb=eccb0cbce2c88910dcad6ca832131f5de3c9d72c;hp=2455c8753e822910785cbc1a83a150bee1d35d37;hpb=08fe2e33007063e30fe22dc1d290f8afaa18eb1d;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/supported/E621.java b/src/be/nikiroo/fanfix/supported/E621.java deleted file mode 100644 index 2455c87..0000000 --- a/src/be/nikiroo/fanfix/supported/E621.java +++ /dev/null @@ -1,257 +0,0 @@ -package be.nikiroo.fanfix.supported; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; -import java.util.Map.Entry; -import java.util.Scanner; - -import be.nikiroo.fanfix.Instance; -import be.nikiroo.fanfix.data.Chapter; -import be.nikiroo.fanfix.data.Story; -import be.nikiroo.utils.StringUtils; - -/** - * Support class for e621.net and e926.net, a Furry website supporting comics, - * including some of MLP. - *
- * e926.net only shows the "clean" images and - * comics, but it can be difficult to browse. - * - * @author niki - */ -class E621 extends BasicSupport { - @Override - public String getSourceName() { - return "e621.net"; - } - - @Override - public boolean isImageDocument(URL source, InputStream in) { - return true; - } - - @Override - public Story process(URL url) throws IOException { - // There is no chapters on e621, just pagination... - Story story = super.process(url); - - Chapter only = new Chapter(1, null); - for (Chapter chap : story) { - only.getParagraphs().addAll(chap.getParagraphs()); - } - - story.getChapters().clear(); - story.getChapters().add(only); - - return story; - } - - @Override - protected boolean supports(URL url) { - String host = url.getHost(); - if (host.startsWith("www.")) { - host = host.substring("www.".length()); - } - - return ("e621.net".equals(host) || "e926.net".equals(host)) - && url.getPath().startsWith("/pool/"); - } - - @Override - protected boolean isHtml() { - return true; - } - - @Override - protected String getAuthor(URL source, InputStream in) throws IOException { - String author = getLine(in, "href=\"/post/show/", 0); - if (author != null) { - String key = "href=\""; - int pos = author.indexOf(key); - if (pos >= 0) { - author = author.substring(pos + key.length()); - pos = author.indexOf("\""); - if (pos >= 0) { - author = author.substring(0, pos - 1); - String page = source.getProtocol() + "://" - + source.getHost() + author; - InputStream pageIn = Instance.getCache().open( - new URL(page), this, false); - try { - key = "class=\"tag-type-artist\""; - author = getLine(pageIn, key, 0); - if (author != null) { - pos = author.indexOf("= 0) { - author = author.substring(pos); - pos = author.indexOf(""); - if (pos >= 0) { - author = author.substring(0, pos); - return StringUtils.unhtml(author); - } - } - } - } finally { - pageIn.close(); - } - } - } - } - - return null; - } - - @Override - protected String getDate(URL source, InputStream in) throws IOException { - return null; - } - - @Override - protected String getSubject(URL source, InputStream in) throws IOException { - return null; - } - - @Override - protected URL getCover(URL source, InputStream in) throws IOException { - return null; - } - - @Override - protected String getTitle(URL source, InputStream in) throws IOException { - String title = getLine(in, "