Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.github.jreddit.captcha;
 
 
This class corresponds to the Reddit's captcha class.

Author(s):
Karan Goel
Raul Rene Lepsa
Andrei Sfat
Simon Kassing
public class Captcha {
    private final RestClient restClient;

    
Constructor.

Parameters:
restClient
captchaDownloader
    public Captcha(RestClient restClient) {
        this. = restClient;
    }

    
Generates and saves a new reddit captcha in the working directory

Parameters:
user user to get captcha for
Returns:
the iden of the generated captcha as a String
    public String newCaptcha(User user) {
       	String iden = (String) ((JSONArray) ((JSONArray) ((JSONArrayobj.get("jquery")).get(11)).get(3)).get(0);
        return iden;
    }

    
Check whether user needs CAPTCHAs for API methods that define the "captcha" and "iden" parameters.

Parameters:
user user to do the check for
Returns:
true if CAPTCHAs are needed, false otherwise
    public boolean needsCaptcha(User user) {
    	// TODO: Object comparison or responsetext comparison?
        return .get(.user.getCookie()).getResponseText().equals("true");
    }
New to GrepCode? Check out our FAQ X