From fdce3bcec0756be8a921e65263e583c27c611859 Mon Sep 17 00:00:00 2001 From: 0xboobface <0xboobface@gmail.com> Date: Sun, 7 Jun 2020 12:28:08 +0200 Subject: [PATCH] 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. --- .../java/ctbrec/sites/chaturbate/ChaturbateHttpClient.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/ctbrec/sites/chaturbate/ChaturbateHttpClient.java b/common/src/main/java/ctbrec/sites/chaturbate/ChaturbateHttpClient.java index 37f2697e..e48671f1 100644 --- a/common/src/main/java/ctbrec/sites/chaturbate/ChaturbateHttpClient.java +++ b/common/src/main/java/ctbrec/sites/chaturbate/ChaturbateHttpClient.java @@ -4,7 +4,9 @@ import static ctbrec.io.HttpConstants.*; import java.io.IOException; import java.util.NoSuchElementException; +import java.util.Objects; +import org.jsoup.nodes.Element; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -110,8 +112,8 @@ public class ChaturbateHttpClient extends HttpClient { if (resp.isSuccessful()) { String profilePage = resp.body().string(); try { - HtmlParser.getText(profilePage, "span.tokencount"); - return true; + Element userIcon = HtmlParser.getTag(profilePage, "img.user_information_header_icon"); + return !Objects.equals("Anonymous Icon", userIcon.attr("alt")); } catch(Exception e) { LOG.debug("Token tag not found. Login failed"); return false;