1
0
mirror of https://github.com/RipMeApp/ripme.git synced 2025-08-15 10:24:04 +02:00

Merge pull request #1485 from felixaufreisen/MyreadingmangaFix

Myreadingmanga Fix
This commit is contained in:
cyian-1756
2019-11-29 07:00:20 -05:00
committed by GitHub
3 changed files with 15 additions and 18 deletions

View File

@@ -70,8 +70,8 @@ public class MeituriRipper extends AbstractHTMLRipper {
} }
} }
// Base URL: https://ii.hywly.com/a/1/albumid/imgnum.jpg // Base URL: http://ii.hywly.com/a/1/albumid/imgnum.jpg
String baseURL = "https://ii.hywly.com/a/1/" + albumID + "/"; String baseURL = "http://ii.hywly.com/a/1/" + albumID + "/";
// Loop through and add images to the URL list // Loop through and add images to the URL list
for (int i = 1; i <= numOfImages; i++) { for (int i = 1; i <= numOfImages; i++) {

View File

@@ -50,7 +50,7 @@ public class MyreadingmangaRipper extends AbstractHTMLRipper {
@Override @Override
public List<String> getURLsFromPage(Document doc) { public List<String> getURLsFromPage(Document doc) {
List<String> result = new ArrayList<>(); List<String> result = new ArrayList<>();
for (Element el : doc.select("div.separator > img")) { for (Element el : doc.select("div * img[data-lazy-src]")) {
String imageSource = el.attr("data-lazy-src"); String imageSource = el.attr("data-lazy-src");
result.add(imageSource); result.add(imageSource);
} }

View File

@@ -8,7 +8,6 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import com.rarchives.ripme.ripper.AbstractJSONRipper; import com.rarchives.ripme.ripper.AbstractJSONRipper;
import org.apache.commons.lang.StringEscapeUtils;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
@@ -63,6 +62,7 @@ public class VkRipper extends AbstractJSONRipper {
Map<String,String> photoIDsToURLs = new HashMap<>(); Map<String,String> photoIDsToURLs = new HashMap<>();
int offset = 0; int offset = 0;
while (true) { while (true) {
LOGGER.info(" Retrieving " + this.url);
Map<String,String> postData = new HashMap<>(); Map<String,String> postData = new HashMap<>();
postData.put("al", "1"); postData.put("al", "1");
postData.put("offset", Integer.toString(offset)); postData.put("offset", Integer.toString(offset));
@@ -78,7 +78,6 @@ public class VkRipper extends AbstractJSONRipper {
break; break;
} }
body = body.substring(body.indexOf("<div")); body = body.substring(body.indexOf("<div"));
body = StringEscapeUtils.unescapeJavaScript(body);
doc = Jsoup.parseBodyFragment(body); doc = Jsoup.parseBodyFragment(body);
List<Element> elements = doc.select("a"); List<Element> elements = doc.select("a");
Set<String> photoIDsToGet = new HashSet<>(); Set<String> photoIDsToGet = new HashSet<>();
@@ -198,7 +197,6 @@ public class VkRipper extends AbstractJSONRipper {
else { else {
RIP_TYPE = RipType.IMAGE; RIP_TYPE = RipType.IMAGE;
} }
super.rip();
} }
private Map<String,String> getPhotoIDsToURLs(String photoID) throws IOException { private Map<String,String> getPhotoIDsToURLs(String photoID) throws IOException {
@@ -219,20 +217,19 @@ public class VkRipper extends AbstractJSONRipper {
.data(postData) .data(postData)
.post(); .post();
String jsonString = doc.toString(); String jsonString = doc.toString();
jsonString = StringEscapeUtils.unescapeJavaScript(jsonString); jsonString = jsonString.substring(jsonString.indexOf("<!json>") + "<!json>".length());
jsonString = jsonString.substring(jsonString.indexOf("\"pe_type\"")); jsonString = jsonString.substring(0, jsonString.indexOf("<!>"));
jsonString = jsonString.substring(0, jsonString.indexOf("<div")); JSONArray json = new JSONArray(jsonString);
jsonString = "{" + jsonString + "}"; for (int i = 0; i < json.length(); i++) {
JSONObject json = new JSONObject(jsonString); JSONObject jsonImage = json.getJSONObject(i);
for (String key : new String[] {"z_src", "y_src", "x_src"}) {
for (String key : new String[] {"z_src", "y_src", "x_src"}) { if (!jsonImage.has(key)) {
if (!json.has(key)) { continue;
continue; }
photoIDsToURLs.put(jsonImage.getString("id"), jsonImage.getString(key));
break;
} }
photoIDsToURLs.put(photoID, json.getString(key));
break;
} }
return photoIDsToURLs; return photoIDsToURLs;
} }