Change cookie name of the sorting settings

This commit is contained in:
0xboobface 2020-03-02 20:44:52 +01:00
parent 2f013bc870
commit 2eb1b17513
1 changed files with 4 additions and 2 deletions

View File

@ -26,6 +26,7 @@ import okhttp3.Response;
public class BongaCamsHttpClient extends HttpClient { public class BongaCamsHttpClient extends HttpClient {
private static final Logger LOG = LoggerFactory.getLogger(BongaCamsHttpClient.class); private static final Logger LOG = LoggerFactory.getLogger(BongaCamsHttpClient.class);
private static final String SORT_COOKIE = "ls01";
private int userId = 0; private int userId = 0;
public BongaCamsHttpClient() { public BongaCamsHttpClient() {
@ -39,16 +40,17 @@ public class BongaCamsHttpClient extends HttpClient {
private void addSortByPopularCookie() { private void addSortByPopularCookie() {
Cookie sortByCookie = new Cookie.Builder() Cookie sortByCookie = new Cookie.Builder()
.domain("bongacams.com") .domain("bongacams.com")
.name("bcmlsf9") .name(SORT_COOKIE)
.value("%7B%22limit%22%3A20%2C%22c_limit%22%3A10%2C%22th_type%22%3A%22live%22%2C%22sorting%22%3A%22popular%22%2C%22display%22%3A%22auto%22%7D") .value("%7B%22limit%22%3A20%2C%22c_limit%22%3A10%2C%22th_type%22%3A%22live%22%2C%22sorting%22%3A%22popular%22%2C%22display%22%3A%22auto%22%7D")
.build(); .build();
Map<String, List<Cookie>> cookies = cookieJar.getCookies(); Map<String, List<Cookie>> cookies = cookieJar.getCookies();
for (Entry<String, List<Cookie>> entry : cookies.entrySet()) { for (Entry<String, List<Cookie>> entry : cookies.entrySet()) {
List<Cookie> cookieList = entry.getValue(); List<Cookie> cookieList = entry.getValue();
for (Iterator<Cookie> iterator = cookieList.iterator(); iterator.hasNext();) { for (Iterator<Cookie> iterator = cookieList.iterator(); iterator.hasNext();) {
Cookie cookie = iterator.next(); Cookie cookie = iterator.next();
if(cookie.name().equals("bcmlsf9")) { if(cookie.name().equals(SORT_COOKIE)) {
iterator.remove(); iterator.remove();
} }
} }