Fix chaturbate login check

The check if ctbrec is logged in always returned true because of a
change on the user profile page. ctbrec now uses the user icon to check,
if the user is the anonymous user or a logged in user.
This commit is contained in:
0xboobface 2020-06-07 12:28:08 +02:00
parent a67ef7f4fd
commit fdce3bcec0
1 changed files with 4 additions and 2 deletions

View File

@ -4,7 +4,9 @@ import static ctbrec.io.HttpConstants.*;
import java.io.IOException; import java.io.IOException;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
import java.util.Objects;
import org.jsoup.nodes.Element;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -110,8 +112,8 @@ public class ChaturbateHttpClient extends HttpClient {
if (resp.isSuccessful()) { if (resp.isSuccessful()) {
String profilePage = resp.body().string(); String profilePage = resp.body().string();
try { try {
HtmlParser.getText(profilePage, "span.tokencount"); Element userIcon = HtmlParser.getTag(profilePage, "img.user_information_header_icon");
return true; return !Objects.equals("Anonymous Icon", userIcon.attr("alt"));
} catch(Exception e) { } catch(Exception e) {
LOG.debug("Token tag not found. Login failed"); LOG.debug("Token tag not found. Login failed");
return false; return false;