use of ar.rulosoft.navegadores.Navigator in project MiMangaNu by raulhaag.
the class Mangapedia method getMangasFiltered.
@Override
public ArrayList<Manga> getMangasFiltered(int[][] filters, int pageNumber) throws Exception {
String web = HOST + "/project_code/script/moreMangas.php";
if (pageNumber == 1) {
web = HOST + "/project_code/script/search.php";
}
Navigator nav = getNavigatorAndFlushParameters();
String boundary = Navigator.getNewBoundary();
nav.addHeader("Content-Type", "multipart/form-data; boundary=" + boundary);
nav.addHeader("X-Requested-With", "XMLHttpRequest");
MultipartBody.Builder mBodyBuilder = new MultipartBody.Builder(boundary).setType(MultipartBody.FORM);
mBodyBuilder.addFormDataPart("artist", "");
mBodyBuilder.addFormDataPart("searchType", "advance");
mBodyBuilder.addFormDataPart("pageNumber", "" + pageNumber);
mBodyBuilder.addFormDataPart("searchTerm", "");
mBodyBuilder.addFormDataPart("searchByLetter", "");
for (int i = 0; i < valDemographic.length; i++) {
if (Util.getInstance().contains(filters[0], i)) {
mBodyBuilder.addFormDataPart(valDemographic[i], "1");
} else {
mBodyBuilder.addFormDataPart(valDemographic[i], "0");
}
}
for (int i = 0; i < valGenre.length; i++) {
if (Util.getInstance().contains(filters[1], i)) {
mBodyBuilder.addFormDataPart(valGenre[i], "1");
} else {
mBodyBuilder.addFormDataPart(valGenre[i], "0");
}
}
for (int i = 0; i < valType.length; i++) {
if (Util.getInstance().contains(filters[2], i)) {
mBodyBuilder.addFormDataPart(valType[i], "1");
} else {
mBodyBuilder.addFormDataPart(valType[i], "0");
}
}
mBodyBuilder.addFormDataPart("sortBy", valSortBy[filters[3][0]]);
mBodyBuilder.addFormDataPart("sortOrder", valSortOrder[filters[4][0]]);
return getMangasString(nav.post(web, mBodyBuilder.build()));
}
use of ar.rulosoft.navegadores.Navigator in project MiMangaNu by raulhaag.
the class MyMangaIo method getNavigatorWithNeededHeader.
private Navigator getNavigatorWithNeededHeader() throws Exception {
Navigator nav = Navigator.getInstance();
nav.addHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
return nav;
}
use of ar.rulosoft.navegadores.Navigator in project MiMangaNu by raulhaag.
the class BatoTo method testLogin.
// just log in batoto to store the cookie if all ok
@Override
public boolean testLogin(String user, String password) throws Exception {
Navigator nav = getNavigatorAndFlushParameters();
CookieJar ccj = nav.getHttpClient().cookieJar();
VolatileCookieJar cj = new VolatileCookieJar();
nav.setCookieJar(cj);
String data = nav.get(HOST + "/forums/index.php?app=core&module=global&section=login");
HashMap<String, String> params = Navigator.getFormParamsFromSource(data);
nav = getNavigatorAndFlushParameters();
nav.addPost("auth_key", params.get("auth_key"));
nav.addPost("ips_password", password);
nav.addPost("ips_username", user);
nav.addPost("referer", "https://bato.to/forums/");
nav.addPost("rememberMe", "1");
nav.post(HOST + "/forums/index.php?app=core&module=global§ion=login&do=process");
List<Cookie> cookies = Navigator.getCookieJar().loadForRequest(HttpUrl.parse("https://bato.to"));
nav.setCookieJar(ccj);
return cj.contain("member_id");
}
use of ar.rulosoft.navegadores.Navigator in project MiMangaNu by raulhaag.
the class DesuMe method search.
@Override
public ArrayList<Manga> search(String term) throws Exception {
ArrayList<Manga> mangas = new ArrayList<>();
Navigator nav = getNavigatorAndFlushParameters();
nav.addHeader("x-requested-with", "XMLHttpRequest");
nav.addPost("q", term);
nav.addPost("_xfResponseType", "json");
String data = nav.post(HOST + "/manga/find");
try {
JSONObject result = new JSONObject(data).getJSONObject("results");
Iterator<String> it = result.keys();
while (it.hasNext()) {
String title = it.next();
String id = getFirstMatch("/(\\d+)\\.jpg", result.getJSONObject(title).getString("avatar"), context.getString(R.string.server_failed_locate_manga_url));
String web = "/manga/" + title.replace(" ", "-").toLowerCase() + "." + id + "/";
mangas.add(new Manga(getServerID(), title, web, false));
}
} catch (JSONException e) {
// do nothing
}
return mangas;
}
use of ar.rulosoft.navegadores.Navigator in project MiMangaNu by raulhaag.
the class KissManga method search.
@Override
public ArrayList<Manga> search(String term) throws Exception {
// make use of AdvanceSearch, more data is then needed
Navigator nav = getNavigatorAndFlushParameters();
// do not hide Doujinshi in result
nav.addHeader("Cookie", "vns_doujinshi=1; ");
nav.addPost("keyword", URLEncoder.encode(term, "UTF-8"));
nav.addPost("type", "Manga");
String source = nav.post(HOST + "/Search/SearchSuggest");
source = source.replaceAll("<\\*span>", "");
ArrayList<Manga> searchList = new ArrayList<>();
Pattern p = Pattern.compile(PATTERN_SEARCH, Pattern.DOTALL);
Matcher m = p.matcher(source);
while (m.find()) {
searchList.add(new Manga(getServerID(), m.group(2), m.group(1), false));
}
return searchList;
}
Aggregations