use of ar.rulosoft.mimanganu.componentes.Chapter in project MiMangaNu by raulhaag.
the class ReadMangaMe method loadMangaInformation.
@Override
public void loadMangaInformation(Manga manga, boolean forceReload) throws Exception {
if (manga.getChapters().isEmpty() || forceReload) {
String source = getNavigatorAndFlushParameters().get(HOST + manga.getPath());
// Cover
manga.setImages(getFirstMatchDefault("<img class=.+?src=\"(http[^\"]+)\"", source, ""));
// Summary
String summary = getFirstMatchDefault("<p><span style=\"text-align: start; text-indent: 0px;\">(.+?)</span></p>", source, context.getString(R.string.nodisponible));
manga.setSynopsis(summary);
// summary can be empty after cleaning, so check again here
if (manga.getSynopsis().isEmpty()) {
manga.setSynopsis(context.getString(R.string.nodisponible));
}
// Status
// manga.setFinished(source.contains(""));
// Author (can be multi-part)
ArrayList<String> authors = getAllMatch("elem_author.+?person-link\">(.+?)<", source);
if (authors.isEmpty()) {
manga.setAuthor(context.getString(R.string.nodisponible));
} else {
manga.setAuthor(TextUtils.join(", ", authors));
}
// Genre
ArrayList<String> genres = getAllMatch("elem_genre.+?element-link\">(.+?)<", source);
if (genres.isEmpty()) {
manga.setGenre(context.getString(R.string.nodisponible));
} else {
manga.setGenre(TextUtils.join(", ", genres));
}
// Chapters
Pattern p = Pattern.compile("<td class=\"[\\s\\S]+?\">\\s+<a href=\"([^\"]+)\"[^>]+?>\\s+([\\s\\S]+?)<", Pattern.DOTALL);
Matcher matcher = p.matcher(source);
while (matcher.find()) {
manga.addChapterFirst(new Chapter(matcher.group(2).replaceAll("\\s+", " ").trim(), matcher.group(1)));
}
}
}
use of ar.rulosoft.mimanganu.componentes.Chapter in project MiMangaNu by raulhaag.
the class TuMangaOnline method loadChapters.
@SuppressWarnings("unused")
public void loadChapters(Manga manga, boolean forceReload, boolean last) throws Exception {
ArrayList<Chapter> result = new ArrayList<>();
Navigator nav = getNavigatorAndFlushParameters();
nav.addHeader("Cache-mode", "no-cache");
nav.addHeader("Referer", "http://www.tumangaonline.com/biblioteca/mangas/" + manga.getPath() + "/" + URLEncoder.encode(manga.getTitle(), "UTF-8"));
String data = nav.get("http://www.tumangaonline.com/api/v1/mangas/" + manga.getPath() + "/capitulos?page=" + 1 + "&tomo=-1");
if (data != null && data.length() > 3) {
JSONObject object = new JSONObject(data);
int last_page = object.getInt("last_page");
result.addAll(0, getChaptersJsonArray(object.getJSONArray("data"), manga.getPath()));
if (!last)
for (int i = 2; i <= last_page; i++) {
try {
nav = getNavigatorAndFlushParameters();
nav.addHeader("Cache-mode", "no-cache");
nav.addHeader("Referer", "http://www.tumangaonline.com/biblioteca/mangas/" + manga.getPath() + "/" + URLEncoder.encode(manga.getTitle(), "UTF-8"));
data = nav.get("http://www.tumangaonline.com/api/v1/mangas/" + manga.getPath() + "/capitulos?page=" + i + "&tomo=-1");
if (data != null && data.length() > 3) {
object = new JSONObject(data);
result.addAll(0, getChaptersJsonArray(object.getJSONArray("data"), manga.getPath()));
}
} catch (Exception ignore) {
}
}
}
manga.setChapters(result);
}
use of ar.rulosoft.mimanganu.componentes.Chapter in project MiMangaNu by raulhaag.
the class ViewComic method loadMangaInformation.
@Override
public void loadMangaInformation(Manga manga, boolean forceReload) throws Exception {
if (manga.getChapters().isEmpty() || forceReload) {
String source = getNavigatorAndFlushParameters().get(manga.getPath());
// Cover
if (manga.getImages() == null || manga.getImages().isEmpty())
manga.setImages(getFirstMatchDefault("src=\"(http[s]?://\\d+\\.bp\\.blogspot\\.com/.+?)\"", source, ""));
// Summary
manga.setSynopsis(context.getString(R.string.nodisponible));
// Status
// ViewComic lists no status ...
// Author
manga.setAuthor(context.getString(R.string.nodisponible));
// Genre
manga.setGenre(context.getString(R.string.nodisponible));
// Chapters
String newSource = getFirstMatchDefault("<select id(.+?)</select>", source, "");
Pattern p = Pattern.compile("<option value=\"(.+?)\">(.+?)</div>|<option selected value=\"(.+?)\">(.+?)</div>", Pattern.DOTALL);
Matcher matcher;
if (newSource.isEmpty()) {
matcher = p.matcher(source);
} else {
matcher = p.matcher(newSource);
}
while (matcher.find()) {
if (matcher.group(1) != null && matcher.group(2) != null) {
manga.addChapterFirst(new Chapter(matcher.group(2).replaceAll("[….\\s]*(Reading)?$", ""), matcher.group(1)));
} else {
manga.addChapterFirst(new Chapter(matcher.group(4).replaceAll("[….\\s]*(Reading)?$", ""), matcher.group(3)));
}
}
}
}
use of ar.rulosoft.mimanganu.componentes.Chapter in project MiMangaNu by raulhaag.
the class MangaFox method loadChapters.
@Override
public void loadChapters(Manga manga, boolean forceReload) throws Exception {
if (manga.getChapters().isEmpty() || forceReload) {
String data = getNavigatorAndFlushParameters().get((manga.getPath()));
// Cover
manga.setImages(getFirstMatchDefault(PATTERN_COVER, data, ""));
// Summary
manga.setSynopsis(getFirstMatchDefault(PATTERN_SUMMARY, data, context.getString(R.string.nodisponible)));
// Status
manga.setFinished(data.contains("<h\\d>Status:</h\\d>\\s*<span>\\s*Completed</span>"));
// Author
manga.setAuthor(getFirstMatchDefault("\"/search/author/.+?>(.+?)<", data, context.getString(R.string.nodisponible)));
// Genre
manga.setGenre(getFirstMatchDefault("(<a href=\"//mangafox.[^/]+/search/genres/.+?</td>)", data, context.getString(R.string.nodisponible)));
// Chapter
Pattern p = Pattern.compile(PATTERN_CHAPTERS, Pattern.DOTALL);
Matcher m = p.matcher(data);
while (m.find()) {
if (m.group(4) != null) {
manga.addChapterFirst(new Chapter(m.group(2).trim() + ": " + m.group(4), "http:" + m.group(1).replace("1.html", "")));
} else {
manga.addChapterFirst(new Chapter(m.group(2).trim(), "http:" + m.group(1).replace("1.html", "")));
}
}
}
}
use of ar.rulosoft.mimanganu.componentes.Chapter in project MiMangaNu by raulhaag.
the class MangaHere method loadChapters.
@Override
public void loadChapters(Manga manga, boolean forceReload) throws Exception {
if (manga.getChapters().isEmpty() || forceReload) {
String data = getNavigatorAndFlushParameters().get(HOST + manga.getPath());
// Front
manga.setImages(getFirstMatchDefault(PATTERN_COVER, data, context.getString(R.string.nodisponible)));
// Summary
manga.setSynopsis(getFirstMatchDefault(PATTERN_SUMMARY, data, context.getString(R.string.nodisponible)));
// Status
manga.setFinished(data.contains(PATTERN_FINISHED));
// Author
manga.setAuthor(getFirstMatchDefault(PATTERN_AUTHOR, data, context.getString(R.string.nodisponible)));
assert manga.getAuthor() != null;
if (manga.getAuthor().equals("Unknown")) {
manga.setAuthor(context.getString(R.string.nodisponible));
}
// Genre
manga.setGenre(getFirstMatchDefault(PATTERN_GENRE, data, context.getString(R.string.nodisponible)));
assert manga.getGenre() != null;
if (manga.getGenre().equals("None")) {
manga.setGenre(context.getString(R.string.nodisponible));
}
// Chapter
Pattern p = Pattern.compile(PATTERN_CHAPTERS, Pattern.DOTALL);
Matcher m = p.matcher(data);
while (m.find()) {
manga.addChapterFirst(new Chapter(m.group(2), Util.getInstance().getFilePath(m.group(1))));
}
}
}
Aggregations