Search in sources :

Example 36 with Chapter

use of ar.rulosoft.mimanganu.componentes.Chapter in project MiMangaNu by raulhaag.

the class KissManga method loadMangaInformation.

@Override
public void loadMangaInformation(Manga manga, boolean forceReload) throws Exception {
    if (manga.getChapters().isEmpty() || forceReload) {
        String source = getNavigatorAndFlushParameters().get(HOST + manga.getPath());
        // Summary
        manga.setSynopsis(getFirstMatchDefault("<span " + "class=\"info\">Summary:</span>(.+?)</div>", source, context.getString(R.string.nodisponible)));
        // Cover Image
        manga.setImages(getFirstMatchDefault("rel=\"image_src\" href=\"(.+?)" + "\"", source, ""));
        // Author
        manga.setAuthor(getFirstMatchDefault("Author:</span>&nbsp;(.+?)</p>", source, context.getString(R.string.nodisponible)));
        // Genre
        manga.setGenre(getFirstMatchDefault("Genres:</span>&nbsp;(.+?)</p>", source, context.getString(R.string.nodisponible)));
        // Status
        manga.setFinished(source.contains("Status:</span>&nbsp;Completed"));
        // Chapter
        Pattern p = Pattern.compile(PATTERN_CHAPTER, Pattern.DOTALL);
        Matcher matcher = p.matcher(source);
        while (matcher.find()) {
            manga.addChapterFirst(new Chapter(matcher.group(2).replace(" Read Online", ""), matcher.group(1)));
        }
    }
}
Also used : Pattern(java.util.regex.Pattern) Matcher(java.util.regex.Matcher) Chapter(ar.rulosoft.mimanganu.componentes.Chapter)

Example 37 with Chapter

use of ar.rulosoft.mimanganu.componentes.Chapter in project MiMangaNu by raulhaag.

the class LeoManga method loadMangaInformation.

@Override
public void loadMangaInformation(Manga manga, boolean forceReload) throws Exception {
    if (manga.getChapters().isEmpty() || forceReload) {
        String data = getNavigatorAndFlushParameters().get(manga.getPath());
        // Summary
        manga.setSynopsis(getFirstMatchDefault("<p class=\"text-justify\">(.+?)</p>", data, context.getString(R.string.nodisponible)));
        // Cover
        String image = getFirstMatchDefault("<img data-original=\"(.+?)\"", data, "");
        if (image.length() > 4) {
            manga.setImages(HOST + image);
        } else {
            manga.setImages("");
        }
        // Author
        manga.setAuthor(getFirstMatchDefault("<a href=\"/autor.+?\">(.+?)<", data, context.getString(R.string.nodisponible)));
        // Genre
        manga.setGenre(getFirstMatchDefault("GĂ©neros:.+?</div>(.+?)</div>", data, context.getString(R.string.nodisponible)));
        // Status
        manga.setFinished(getFirstMatchDefault("-state\">(.+?)</div>", data, "").contains("Finalizado"));
        // Chapters
        Pattern pattern = Pattern.compile("<li>[\\s]*<a href=\"(/manga/.+?)\">(.+?)</a>", Pattern.DOTALL);
        Matcher matcher = pattern.matcher(data);
        while (matcher.find()) {
            manga.addChapterFirst(new Chapter(matcher.group(2), HOST + matcher.group(1)));
        }
    }
}
Also used : Pattern(java.util.regex.Pattern) Matcher(java.util.regex.Matcher) Chapter(ar.rulosoft.mimanganu.componentes.Chapter)

Aggregations

Chapter (ar.rulosoft.mimanganu.componentes.Chapter)37 Matcher (java.util.regex.Matcher)27 Pattern (java.util.regex.Pattern)27 ArrayList (java.util.ArrayList)5 Manga (ar.rulosoft.mimanganu.componentes.Manga)4 DialogInterface (android.content.DialogInterface)3 View (android.view.View)3 AlertDialog (android.app.AlertDialog)2 SharedPreferences (android.content.SharedPreferences)2 TextView (android.widget.TextView)2 ServerBase (ar.rulosoft.mimanganu.servers.ServerBase)2 JSONException (org.json.JSONException)2 JSONObject (org.json.JSONObject)2 SuppressLint (android.annotation.SuppressLint)1 ColorDrawable (android.graphics.drawable.ColorDrawable)1 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)1 SparseBooleanArray (android.util.SparseBooleanArray)1 ActionMode (android.view.ActionMode)1 LayoutInflater (android.view.LayoutInflater)1 Menu (android.view.Menu)1