forked from j62/ctbrec
Fix Streamate
The way to obtains the xsrf token has changed
This commit is contained in:
parent
3f4973137c
commit
03b6de626c
|
@ -6,6 +6,7 @@ public class HttpConstants {
|
|||
public static final String ACCEPT_LANGUAGE = "Accept-Language";
|
||||
public static final String CONNECTION = "Connection";
|
||||
public static final String CONTENT_TYPE = "Content-Type";
|
||||
public static final String COOKIE = "Cookie";
|
||||
public static final String KEEP_ALIVE = "keep-alive";
|
||||
public static final String MIMETYPE_APPLICATION_JSON = "application/json";
|
||||
public static final String ORIGIN = "Origin";
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.io.IOException;
|
|||
import java.util.Collections;
|
||||
import java.util.Locale;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
@ -15,7 +16,6 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import ctbrec.Config;
|
||||
import ctbrec.io.HttpClient;
|
||||
import ctbrec.io.HttpConstants;
|
||||
import ctbrec.io.HttpException;
|
||||
import okhttp3.Cookie;
|
||||
import okhttp3.HttpUrl;
|
||||
|
@ -60,8 +60,10 @@ public class StreamateHttpClient extends HttpClient {
|
|||
private void loadXsrfToken() {
|
||||
// do a first request to get cookies and stuff
|
||||
Request req = new Request.Builder() //
|
||||
.url(Streamate.BASE_URL) //
|
||||
.header(HttpConstants.USER_AGENT, Config.getInstance().getSettings().httpUserAgent) //
|
||||
.url(Streamate.BASE_URL + "/initialData.js") //
|
||||
.header(USER_AGENT, Config.getInstance().getSettings().httpUserAgent) //
|
||||
.header(COOKIE, "smtid="+UUID.randomUUID().toString()+"; Xld_rct=1;") //
|
||||
.header(REFERER, Streamate.BASE_URL)
|
||||
.build();
|
||||
try (Response resp = execute(req)) {
|
||||
if (resp.code() == 200) {
|
||||
|
|
Loading…
Reference in New Issue