-class E621 extends BasicSupport_Deprecated {
- @Override
- protected MetaData getMeta(URL source, InputStream in) throws IOException {
- MetaData meta = new MetaData();
-
- meta.setTitle(getTitle(reset(in)));
- meta.setAuthor(getAuthor(source, reset(in)));
- meta.setDate("");
- meta.setTags(getTags(source, reset(in), false));
- meta.setSource(getType().getSourceName());
- meta.setUrl(source.toString());
- meta.setPublisher(getType().getSourceName());
- meta.setUuid(source.toString());
- meta.setLuid("");
- meta.setLang("en");
- meta.setSubject("Furry");
- meta.setType(getType().toString());
- meta.setImageDocument(true);
- meta.setCover(getCover(source, reset(in)));
- meta.setFakeCover(true);
-
- return meta;
- }
-
- private List<String> getTags(URL source, InputStream in, boolean authors) {
- List<String> tags = new ArrayList<String>();
-
- if (isSearch(source)) {
- String tagLine = getLine(in, "id=\"tag-sidebar\"", 1);
- if (tagLine != null) {
- String key = "href=\"";
- for (int pos = tagLine.indexOf(key); pos >= 0; pos = tagLine
- .indexOf(key, pos + 1)) {
- int end = tagLine.indexOf("\"", pos + key.length());
- if (end >= 0) {
- String href = tagLine.substring(pos, end);
- String subkey;
- if (authors)
- subkey = "?name=";
- else
- subkey = "?title=";
- if (href.contains(subkey)) {
- String tag = href.substring(href.indexOf(subkey)
- + subkey.length());
- try {
- tags.add(URLDecoder.decode(tag, "UTF-8"));
- } catch (UnsupportedEncodingException e) {
- // supported JVMs must have UTF-8 support
- e.printStackTrace();
- }
- }
- }
- }
-
- }
- }
-
- return tags;
- }
-
- @Override
- public Story process(URL url, Progress pg) throws IOException {
- // There is no chapters on e621, just pagination...
- Story story = super.process(url, pg);
-
- Chapter only = new Chapter(1, null);
- for (Chapter chap : story) {
- only.getParagraphs().addAll(chap.getParagraphs());
- }
-
- story.getChapters().clear();
- story.getChapters().add(only);
-
- return story;
- }
-