Skip to content

Commit

Permalink
Merge pull request #1036 from cyian-1756/mangadexRipperFixes
Browse files Browse the repository at this point in the history
Fixed mangadex ripper
  • Loading branch information
cyian-1756 committed Nov 6, 2018
2 parents de773db + dbf1534 commit 33f1bec
Showing 1 changed file with 5 additions and 3 deletions.
Expand Up @@ -19,8 +19,8 @@
public class MangadexRipper extends AbstractJSONRipper {
private String chapterApiEndPoint = "https://mangadex.org/api/chapter/";

private String getImageUrl(String chapterHash, String imageName) {
return "https://mangadex.org/data/" + chapterHash + "/" + imageName;
private String getImageUrl(String chapterHash, String imageName, String server) {
return server + chapterHash + "/" + imageName;
}

public MangadexRipper(URL url) throws IOException {
Expand Down Expand Up @@ -72,11 +72,13 @@ protected List<String> getURLsFromJSON(JSONObject json) {
JSONArray currentObject;

String chapterHash = json.getString("hash");
// Server is the cdn hosting the images.
String server = json.getString("server");

for (int i = 0; i < json.getJSONArray("page_array").length(); i++) {
currentObject = json.getJSONArray("page_array");

assetURLs.add(getImageUrl(chapterHash, currentObject.getString(i)));
assetURLs.add(getImageUrl(chapterHash, currentObject.getString(i), server));
}

return assetURLs;
Expand Down

0 comments on commit 33f1bec

Please sign in to comment.