Search in sources :

Example 21 with Navigator

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

the class Kumanga method getMangasFiltered.

@Override
public ArrayList<Manga> getMangasFiltered(int[][] filters, int pageNumber) throws Exception {
    Navigator nav = getNavigatorAndFlushParameters();
    StringBuilder sb = new StringBuilder("contentType=manga&page=");
    sb.append(pageNumber);
    sb.append("&perPage=30&retrieveCategories=true&retrieveAuthors=true");
    for (int i = 0; i < filters[0].length; i++) {
        sb.append(valGenre[filters[0][i]]);
    }
    for (int i = 0; i < filters[1].length; i++) {
        sb.append(valType[filters[1][i]]);
    }
    for (int i = 0; i < filters[2].length; i++) {
        sb.append(valStatus[filters[2][i]]);
    }
    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"), sb.toString());
    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)

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