mirror of
https://github.com/RipMeApp/ripme.git
synced 2025-08-22 05:23:06 +02:00
Fix #1830
+ add config option "erome.laravel_session" for EromeRipper to avoid JS-Browser-Check
This commit is contained in:
@@ -4,10 +4,12 @@ import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.rarchives.ripme.utils.Utils;
|
||||
import org.jsoup.Connection.Response;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
@@ -23,7 +25,7 @@ import com.rarchives.ripme.utils.Http;
|
||||
public class EromeRipper extends AbstractHTMLRipper {
|
||||
|
||||
boolean rippingProfile;
|
||||
|
||||
private HashMap<String, String> cookies = new HashMap<>();
|
||||
|
||||
public EromeRipper (URL url) throws IOException {
|
||||
super(url);
|
||||
@@ -96,7 +98,9 @@ public class EromeRipper extends AbstractHTMLRipper {
|
||||
|
||||
@Override
|
||||
public Document getFirstPage() throws IOException {
|
||||
this.setAuthCookie();
|
||||
Response resp = Http.url(this.url)
|
||||
.cookies(cookies)
|
||||
.ignoreContentType()
|
||||
.response();
|
||||
|
||||
@@ -152,7 +156,22 @@ public class EromeRipper extends AbstractHTMLRipper {
|
||||
results.add("https:" + el.attr("src"));
|
||||
}
|
||||
}
|
||||
|
||||
if (results.size() == 0) {
|
||||
if (cookies.isEmpty()) {
|
||||
LOGGER.warn("You might try setting erome.laravel_session manually " +
|
||||
"if you think this page definitely contains media.");
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
private void setAuthCookie() {
|
||||
String sessionId = Utils.getConfigString("erome.laravel_session", null);
|
||||
if (sessionId != null) {
|
||||
cookies.put("laravel_session", sessionId);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user