Skip to content

Commit ba69f5f

Browse files
authored
Merge pull request #129 from jwdeveloper/develop-1.10.5
Add TikTok Target Identity Data Center cookie to make sessionid effective and verifiable.
2 parents 053bb5e + e9a91f5 commit ba69f5f

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

API/src/main/java/io/github/jwdeveloper/tiktok/data/settings/LiveClientSettings.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,18 @@ public class LiveClientSettings {
9090
private boolean throwOnAgeRestriction;
9191

9292
/**
93-
* Optional: Sometimes not every messages from chat are send to TikTokLiveJava to fix this issue you can set sessionId
94-
* @see <a href="https://github.com/isaackogan/TikTok-Live-Connector#send-chat-messages">Documentation: How to obtain sessionId</a>
93+
* Optional: Sometimes not every messages from chat are send to TikTokLiveJava to fix this issue you can set sessionId.
94+
* <p>This requires {@link #ttTargetIdc} also being set correctly for sessionid to be effective.
95+
* @apiNote This cookie is supplied by <a href="https://www.tiktok.com">TikTok</a> and can be found in your browser cookies.
9596
*/
9697
private String sessionId;
9798

99+
/**
100+
* Used with {@link #sessionId} to verify it is valid and return extra chat messages and 18+ content.
101+
* @apiNote This cookie is supplied by <a href="https://www.tiktok.com">TikTok</a> and can be found in your browser cookies.
102+
*/
103+
private String ttTargetIdc;
104+
98105
/**
99106
* Optional: By default roomID is fetched before connect to live, but you can set it manually
100107
*/

Client/src/main/java/io/github/jwdeveloper/tiktok/TikTokLiveHttpClient.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ public LiveUserData.Response getLiveUserData(LiveUserData.Request request) {
113113
.withParam("uniqueId", request.getUserName())
114114
.withParam("sourceType", "54") //MAGIC NUMBER, WHAT 54 means?
115115
.withCookie("sessionid", clientSettings.getSessionId())
116+
.withCookie("tt-target-idc", clientSettings.getTtTargetIdc())
116117
.build()
117118
.toJsonResponse();
118119

@@ -141,6 +142,7 @@ public LiveData.Response getLiveData(LiveData.Request request) {
141142
var result = httpFactory.client(url)
142143
.withParam("room_id", request.getRoomId())
143144
.withCookie("sessionid", clientSettings.getSessionId())
145+
.withCookie("tt-target-idc", clientSettings.getTtTargetIdc())
144146
.build()
145147
.toJsonResponse();
146148

0 commit comments

Comments
 (0)