Merge pull request #742 from cyian-1756/modelmayhemNSFWFix

ModelmayhemRipper can now donwload nsfw images again
This commit is contained in:
cyian-1756 2018-06-28 06:47:48 -04:00 committed by GitHub
commit c4588a03a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,9 @@ import java.io.IOException;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -16,6 +18,8 @@ import com.rarchives.ripme.utils.Http;
public class ModelmayhemRipper extends AbstractHTMLRipper { public class ModelmayhemRipper extends AbstractHTMLRipper {
private Map<String,String> cookies = new HashMap<>();
public ModelmayhemRipper(URL url) throws IOException { public ModelmayhemRipper(URL url) throws IOException {
super(url); super(url);
} }
@ -43,8 +47,10 @@ public class ModelmayhemRipper extends AbstractHTMLRipper {
@Override @Override
public Document getFirstPage() throws IOException { public Document getFirstPage() throws IOException {
// Bypass NSFW filter
cookies.put("worksafe", "0");
// "url" is an instance field of the superclass // "url" is an instance field of the superclass
return Http.url(url).get(); return Http.url(url).cookies(cookies).get();
} }
@Override @Override