diff --git a/app/src/main/java/org/nv95/openmanga/providers/MangaTownProvider.java b/app/src/main/java/org/nv95/openmanga/providers/MangaTownProvider.java index 3e4a3222..eea76c5a 100755 --- a/app/src/main/java/org/nv95/openmanga/providers/MangaTownProvider.java +++ b/app/src/main/java/org/nv95/openmanga/providers/MangaTownProvider.java @@ -47,7 +47,7 @@ public MangaList getList(int page, int sort, int genre) throws Exception { } catch (Exception e) { manga.genres = ""; } - manga.path = appendProtocol("http:", o.select("a").first().attr("href")); + manga.path = appendSite(o.select("a").first().attr("href")); try { manga.preview = o.select("img").first().attr("src"); } catch (Exception e) { @@ -74,7 +74,7 @@ public MangaSummary getDetailedInfo(MangaInfo mangaInfo) { for (Element o : e.select("li")) { chapter = new MangaChapter(); chapter.name = o.select("a").first().text() + " " + o.select("span").get(0).text(); - chapter.readLink = appendProtocol("http:", o.select("a").first().attr("href")); + chapter.readLink = appendSite(o.select("a").first().attr("href")); chapter.provider = summary.provider; summary.chapters.add(0, chapter); } @@ -94,7 +94,7 @@ public ArrayList getPages(String readLink) { MangaPage page; Element e = document.body().select("select").get(1); for (Element o : e.select("option")) { - page = new MangaPage(appendProtocol("http:", o.attr("value"))); + page = new MangaPage(appendSite(o.attr("value"))); page.provider = MangaTownProvider.class; pages.add(page); } @@ -113,7 +113,8 @@ private static String appendProtocol(String protocol, String url) { public String getPageImage(MangaPage mangaPage) { try { Document document = getPage(mangaPage.path); - return document.body().getElementById("image").attr("src"); + String noProtocolUrl = document.body().getElementById("image").attr("src"); + return appendProtocol("http:", noProtocolUrl); } catch (Exception e) { return null; } @@ -132,7 +133,7 @@ public MangaList search(String query, int page) throws Exception { Element el = o.select("a").first(); if (null != el) { manga.name = el.attr("title"); - manga.path = appendProtocol("http:", el.attr("href")); + manga.path = appendSite(el.attr("href")); } manga.subtitle = ""; try { @@ -148,13 +149,17 @@ public MangaList search(String query, int page) throws Exception { manga.preview = ""; } - manga.path.hashCode(); + manga.id = manga.path.hashCode(); list.add(manga); } return list; } + private static String appendSite(String url){ + return url != null ? "http://www.mangatown.com" + url : null; + } + @Override public String getName() { return "MangaTown";