Search in sources :

Example 6 with Navigator

use of ar.rulosoft.navegadores.Navigator in project MiMangaNu by raulhaag.

the class MangaKawaii method search.

@Override
public ArrayList<Manga> search(String search) throws Exception {
    Navigator nav = getNavigatorAndFlushParameters();
    String data = nav.get("https://www.mangakawaii.com/recherche?query=" + URLEncoder.encode(search, "UTF-8"));
    JSONArray array = new JSONObject(data).getJSONArray("suggestions");
    ArrayList<Manga> mangas = new ArrayList<>();
    for (int i = 0, n = array.length(); i < n; i++) {
        mangas.add(new Manga(getServerID(), array.getJSONObject(i).getString("value"), "https://www.mangakawaii.com/manga/" + array.getJSONObject(i).getString("data"), false));
    }
    return mangas;
}
Also used : JSONObject(org.json.JSONObject) Navigator(ar.rulosoft.navegadores.Navigator) JSONArray(org.json.JSONArray) ArrayList(java.util.ArrayList) Manga(ar.rulosoft.mimanganu.componentes.Manga)

Example 7 with Navigator

use of ar.rulosoft.navegadores.Navigator in project MiMangaNu by raulhaag.

the class MyMangaIo method getMangasFiltered.

@Override
public ArrayList<Manga> getMangasFiltered(int[][] filters, int pageNumber) throws Exception {
    String web = HOST + "/search?name=&author=&illustrator=&parution_span=0&parution=";
    for (int i = 0; i < filters[0].length; i++) {
        web = web + valDemographic[filters[0][i]];
    }
    for (int i = 0; i < filters[1].length; i++) {
        web = web + valStatus[filters[1][i]];
    }
    for (int i = 0; i < filters[2].length; i++) {
        web = web + valType[filters[2][i]];
    }
    for (int i = 0; i < filters[3].length; i++) {
        web = web + valGenre[filters[3][i]];
    }
    Navigator nav = getNavigatorWithNeededHeader();
    web = web + "&chapter_span=0&chapter_count=&last_update=&like_span=0&like=&dislike_span=0&dislike=&search=Rechercher";
    String source = nav.get(web);
    return getMangasFromSource(source);
}
Also used : Navigator(ar.rulosoft.navegadores.Navigator)

Example 8 with Navigator

use of ar.rulosoft.navegadores.Navigator in project MiMangaNu by raulhaag.

the class KissManga method getMangasFiltered.

@Override
public ArrayList<Manga> getMangasFiltered(int[][] filters, int pageNumber) throws Exception {
    Navigator nav = getNavigatorAndFlushParameters();
    String source;
    // do not hide Doujinshi in result
    nav.addHeader("Cookie", "vns_doujinshi=1; ");
    // no filtering is active - use MangaList (much faster as it is smaller)
    if ((filters[0].length + filters[1].length + filters[2][0]) == 0) {
        String web = HOST + "/MangaList" + valOrder[filters[3][0]] + "?page=" + pageNumber;
        source = nav.get(web);
    } else // filtering is active, use advanced search (slow, as the whole result set is returned)
    {
        if (pageNumber > 1) {
            // there is only one result page for the advanced search
            return new ArrayList<>();
        } else {
            nav.addPost("mangaName", "");
            nav.addPost("authorArtist", "");
            for (int i = 0; i < fltGenre.length; i++) {
                int result = 0;
                if (Util.getInstance().contains(filters[0], i)) {
                    result++;
                }
                if (Util.getInstance().contains(filters[1], i)) {
                    result--;
                }
                // map exclude to "2"
                if (result < 0) {
                    result = 2;
                }
                nav.addPost("genres", Integer.toString(result));
            }
            nav.addPost("status", valStatus[filters[2][0]]);
            source = nav.post(HOST + "/AdvanceSearch");
        }
    }
    return getMangasSource(source);
}
Also used : Navigator(ar.rulosoft.navegadores.Navigator) ArrayList(java.util.ArrayList)

Example 9 with Navigator

use of ar.rulosoft.navegadores.Navigator in project MiMangaNu by raulhaag.

the class Kumanga method search.

@Override
public ArrayList<Manga> search(String term) throws Exception {
    Navigator nav = getNavigatorAndFlushParameters();
    String web = "contentType=manga&page=1&perPage=30&keywords=";
    web += URLEncoder.encode(term, "UTF-8");
    web += "&retrieveCategories=true&retrieveAuthors=true";
    nav.addHeader("Accept-Language", "es-AR,es;q=0.8,en-US;q=0.5,en;q=0.3");
    nav.addHeader("Accept-Encoding", "deflate");
    nav.addHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
    nav.addHeader("X-Requested-With", "XMLHttpRequest");
    RequestBody body = RequestBody.create(MediaType.parse("application/x-www-form-urlencoded; charset=UTF-8"), web);
    String data = nav.post(HOST + "/backend/ajax/searchengine.php", body);
    return getMangasFromJson(new JSONObject(data));
}
Also used : JSONObject(org.json.JSONObject) Navigator(ar.rulosoft.navegadores.Navigator) RequestBody(okhttp3.RequestBody)

Example 10 with Navigator

use of ar.rulosoft.navegadores.Navigator in project MiMangaNu by raulhaag.

the class ImageLoader method getBitmap.

private Bitmap getBitmap(String url) {
    File f = mFileCache.getFile(url);
    // Second, try to get image from local storage, i.e. SD card
    Bitmap imgFile = decodeFile(f);
    if (imgFile != null)
        return imgFile;
    try {
        if (url.indexOf("|") > 0) {
            Navigator nav = Navigator.getInstance();
            String[] parts = url.split("\\|");
            nav.addHeader("Referer", parts[1]);
            FileCache.writeFile(nav.getStream(parts[0]), f);
        } else if (url.startsWith("/")) {
            // FromFolder sets url as an absolute local path, so load file directly
            InputStream is;
            is = new FileInputStream(url);
            FileCache.writeFile(is, f);
            is.close();
        } else {
            FileCache.writeFile(Navigator.getInstance().getStream(url), f);
        }
        return decodeFile(f);
    } catch (Throwable ex) {
        if (ex instanceof OutOfMemoryError)
            mMemCache.clearMem();
        return null;
    }
}
Also used : Bitmap(android.graphics.Bitmap) Navigator(ar.rulosoft.navegadores.Navigator) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) File(java.io.File) FileInputStream(java.io.FileInputStream)

Aggregations

Navigator (ar.rulosoft.navegadores.Navigator)21 ArrayList (java.util.ArrayList)6 JSONObject (org.json.JSONObject)6 Manga (ar.rulosoft.mimanganu.componentes.Manga)5 Matcher (java.util.regex.Matcher)2 Pattern (java.util.regex.Pattern)2 RequestBody (okhttp3.RequestBody)2 JSONArray (org.json.JSONArray)2 JSONException (org.json.JSONException)2 Bitmap (android.graphics.Bitmap)1 LargeTest (android.support.test.filters.LargeTest)1 Chapter (ar.rulosoft.mimanganu.componentes.Chapter)1 VolatileCookieJar (ar.rulosoft.navegadores.VolatileCookieJar)1 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 InputStream (java.io.InputStream)1 Cookie (okhttp3.Cookie)1 CookieJar (okhttp3.CookieJar)1 MultipartBody (okhttp3.MultipartBody)1 Test (org.junit.Test)1