From b66809b2b26d152a6701c99547c84cc38be76c5b Mon Sep 17 00:00:00 2001 From: inorichi Date: Mon, 30 Nov 2015 23:51:17 +0100 Subject: [PATCH] Complete Kissmanga --- .../data/source/online/english/Kissmanga.java | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/kanade/mangafeed/data/source/online/english/Kissmanga.java b/app/src/main/java/eu/kanade/mangafeed/data/source/online/english/Kissmanga.java index f59161aec3..6ddd43b8c5 100644 --- a/app/src/main/java/eu/kanade/mangafeed/data/source/online/english/Kissmanga.java +++ b/app/src/main/java/eu/kanade/mangafeed/data/source/online/english/Kissmanga.java @@ -36,6 +36,7 @@ public class Kissmanga extends Source { public static final String IP = "93.174.95.110"; public static final String BASE_URL = "http://" + IP; public static final String POPULAR_MANGAS_URL = BASE_URL + "/MangaList/MostPopular?page=%s"; + public static final String SEARCH_URL = BASE_URL + "/AdvanceSearch"; public Kissmanga(Context context) { super(context); @@ -75,7 +76,7 @@ public class Kissmanga extends Source { @Override protected String getInitialSearchUrl(String query) { - return null; + return SEARCH_URL; } @Override @@ -111,12 +112,31 @@ public class Kissmanga extends Source { if (next == null) return null; - return String.format(POPULAR_MANGAS_URL, next.attr("href")); + return BASE_URL + next.attr("href"); + } + + public Observable searchMangasFromNetwork(MangasPage page, String query) { + if (page.page == 1) + page.url = getInitialSearchUrl(query); + + FormEncodingBuilder form = new FormEncodingBuilder(); + form.add("authorArtist", ""); + form.add("mangaName", query); + form.add("status", ""); + form.add("genres", ""); + + return networkService + .postData(page.url, form.build(), requestHeaders) + .flatMap(networkService::mapResponseToString) + .map(Jsoup::parse) + .doOnNext(doc -> page.mangas = parseSearchFromHtml(doc)) + .doOnNext(doc -> page.nextPageUrl = parseNextSearchUrl(doc, page, query)) + .map(response -> page); } @Override protected List parseSearchFromHtml(Document parsedHtml) { - return null; + return parsePopularMangasFromHtml(parsedHtml); } @Override