Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ public static Map<String, Object> DefaultClientParams() {
clientParams.put("screen_height", 1152);
clientParams.put("screen_width", 2048);
clientParams.put("tz_name", "Europe/Berlin");
clientParams.put("referer", "https, //www.tiktok.com/");
clientParams.put("root_referer", "https, //www.tiktok.com/");
clientParams.put("referer", "https://www.tiktok.com/");
clientParams.put("root_referer", "https://www.tiktok.com/");
clientParams.put("msToken", "");
clientParams.put("version_code", 180800);
clientParams.put("webcast_sdk_version", "1.3.0");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public LiveUserData.Response getLiveUserData(LiveUserData.Request request) {
var result = httpFactory.client(url)
.withParam("uniqueId", request.getUserName())
.withParam("sourceType", "54") //MAGIC NUMBER, WHAT 54 means?
.withCookie("sessionid", clientSettings.getSessionId())
.build()
.toJsonResponse();

Expand Down Expand Up @@ -139,6 +140,7 @@ public LiveData.Response getLiveData(LiveData.Request request) {
var url = TIKTOK_URL_WEBCAST + "room/info";
var result = httpFactory.client(url)
.withParam("room_id", request.getRoomId())
.withCookie("sessionid", clientSettings.getSessionId())
.build()
.toJsonResponse();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ protected HttpRequest prepareGetRequest() {
var requestBuilder = HttpRequest.newBuilder().GET();
requestBuilder.uri(toUri());
requestBuilder.timeout(httpClientSettings.getTimeout());
if (!httpClientSettings.getCookies().isEmpty()) {
String cookieString = httpClientSettings.getCookies().entrySet().stream().map(e -> e.getKey()+"="+e.getValue()).collect(Collectors.joining("; "));
httpClientSettings.getHeaders().put("Cookie", cookieString);
}
httpClientSettings.getHeaders().forEach(requestBuilder::setHeader);

httpClientSettings.getOnRequestCreating().accept(requestBuilder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ public HttpClientBuilder withHttpClientSettings(Consumer<HttpClientSettings> con
}

public HttpClientBuilder withCookie(String name, String value) {
httpClientSettings.getCookies().put(name, value);
if (name != null && value != null)
httpClientSettings.getCookies().put(name, value);
return this;
}

Expand Down