mirror of
https://github.com/jwdeveloper/TikTokLiveJava.git
synced 2026-02-27 16:59:39 -05:00
Fix Message parsing for
- LikeMessage - MessageWebcastGiftMessage - MessageWebcastChatMessage
This commit is contained in:
@@ -3,6 +3,8 @@ package io.github.jwdeveloper.tiktok;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
@Data
|
||||
@@ -11,12 +13,12 @@ public class ClientSettings {
|
||||
/// Timeout for Connections
|
||||
/// </summary>
|
||||
|
||||
private Duration Timeout;
|
||||
private Duration timeout;
|
||||
/// <summary>
|
||||
/// Polling-Interval for Socket-Connection
|
||||
/// </summary
|
||||
|
||||
private Duration PollingInterval;
|
||||
private Duration pollingInterval;
|
||||
/// <summary>
|
||||
/// Proxy for Connection
|
||||
/// </summary>
|
||||
@@ -26,46 +28,49 @@ public class ClientSettings {
|
||||
/// ISO-Language for Client
|
||||
/// </summary>
|
||||
|
||||
private String ClientLanguage;
|
||||
private String clientLanguage;
|
||||
/// <summary>
|
||||
/// Size for Buffer for Socket-Connection
|
||||
/// </summary>
|
||||
|
||||
private int SocketBufferSize;
|
||||
private int socketBufferSize;
|
||||
|
||||
/// <summary>
|
||||
/// Whether to Retry if Connection Fails
|
||||
/// </summary>
|
||||
private boolean RetryOnConnectionFailure;
|
||||
|
||||
private boolean retryOnConnectionFailure;
|
||||
|
||||
/// <summary>
|
||||
/// Whether to handle Messages received from Room when Connecting
|
||||
/// </summary>
|
||||
private boolean HandleExistingMessagesOnConnect;
|
||||
private boolean handleExistingMessagesOnConnect;
|
||||
/// <summary>
|
||||
/// Whether to download List of Gifts for Room when Connecting
|
||||
/// </summary>
|
||||
private boolean DownloadGiftInfo;
|
||||
private boolean downloadGiftInfo;
|
||||
|
||||
/// <summary>
|
||||
/// Whether to print Logs to Console
|
||||
/// </summary>
|
||||
|
||||
private boolean PrintToConsole;
|
||||
private boolean printToConsole;
|
||||
/// <summary>
|
||||
/// LoggingLevel for Logs
|
||||
/// </summary>
|
||||
private Level LogLevel;
|
||||
private Level logLevel;
|
||||
|
||||
/// <summary>
|
||||
/// Whether to print Base64-Data for Messages to Console
|
||||
/// </summary>
|
||||
private boolean PrintMessageData;
|
||||
private boolean printMessageData;
|
||||
|
||||
/// <summary>
|
||||
/// Whether to check Messages for Unparsed Data
|
||||
/// </summary>
|
||||
private boolean CheckForUnparsedData;
|
||||
private boolean checkForUnparsedData;
|
||||
|
||||
private String hostName;
|
||||
|
||||
private Map<String, Object> clientParameters;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,6 @@ public class Constants {
|
||||
|
||||
public static ClientSettings DefaultClientSettings() {
|
||||
var clientSettings = new ClientSettings();
|
||||
|
||||
clientSettings.setTimeout(Duration.ofSeconds(DEFAULT_TIMEOUT));
|
||||
clientSettings.setPollingInterval(Duration.ofSeconds(DEFAULT_POLLTIME));
|
||||
clientSettings.setClientLanguage("en-US");
|
||||
@@ -51,6 +50,7 @@ public class Constants {
|
||||
clientSettings.setLogLevel(Level.ALL);
|
||||
clientSettings.setCheckForUnparsedData(false);
|
||||
clientSettings.setPrintMessageData(false);
|
||||
clientSettings.setClientParameters(Constants.DefaultClientParams());
|
||||
return clientSettings;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,14 +7,14 @@ import java.util.List;
|
||||
|
||||
@Getter
|
||||
public class Badge {
|
||||
private final ComboBadge comboBadges;
|
||||
private ComboBadge comboBadges;
|
||||
private final List<TextBadge> textBadges;
|
||||
private final List<ImageBadge> imageBadges;
|
||||
|
||||
public Badge(io.github.jwdeveloper.tiktok.messages.Badge badge) {
|
||||
textBadges = badge.getTextBadgesList().stream().map(b -> new TextBadge(b.getType(), b.getName())).toList();
|
||||
imageBadges = badge.getImageBadgesList().stream().map(b -> new ImageBadge(b.getDisplayType(), new Picture(b.getImage()))).toList();
|
||||
comboBadges = new ComboBadge(new Picture(badge.getComplexBadge().getImageUrl()), badge.getComplexBadge().getData());
|
||||
comboBadges = new ComboBadge(new Picture("badge.getComplexBadge().getImageUrl()"), badge.getComplexBadge().getData());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package io.github.jwdeveloper.tiktok.exceptions;
|
||||
|
||||
public class TikTokLiveRequestException extends TikTokLiveException
|
||||
{
|
||||
public TikTokLiveRequestException() {
|
||||
}
|
||||
|
||||
public TikTokLiveRequestException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public TikTokLiveRequestException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public TikTokLiveRequestException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public TikTokLiveRequestException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
}
|
||||
}
|
||||
@@ -186,7 +186,7 @@ message Badge {
|
||||
|
||||
message BadgeComplex {
|
||||
uint32 data1 = 1;
|
||||
string imageUrl = 2;
|
||||
//string imageUrl = 2; Protocol message had invalid UTF-8
|
||||
string data = 4;
|
||||
DataContainer detail1 = 5;
|
||||
string data2 = 6;
|
||||
@@ -377,7 +377,7 @@ message RankTextMessage {
|
||||
// Links to Image-Files on the TikTok CDN
|
||||
message Picture {
|
||||
repeated string urls = 1; // Usually has 3 different urls with different sizes/extensions
|
||||
string prefix = 2; // uri
|
||||
// string prefix = 2; // uri not working
|
||||
uint32 data1 = 3;
|
||||
uint32 data2 = 4;
|
||||
string color = 5;
|
||||
@@ -681,7 +681,7 @@ message WebcastGiftMessage {
|
||||
uint32 data11 = 34;
|
||||
|
||||
message GiftData1 {
|
||||
string data1 = 1;
|
||||
// string data1 = 1; not working
|
||||
uint32 data2 = 2;
|
||||
uint32 data3 = 3;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user