Compare commits

..

5 Commits

Author SHA1 Message Date
JW
6e9244aa67 Changes:
- Fixed bug: WebcastSocialMessage was always triggering `TikTokShareEvent` events such as `TikTokLikeEvent`, `TikTokFollowEvent`, `TikTokShareEvent`, `TikTokJoinEvent` was ignored
2023-08-25 21:01:56 +02:00
JW
fadb1ab267 changeing client name 2023-08-24 22:37:56 +02:00
JW
4273375eb9 Update README.md 2023-08-24 16:51:04 +02:00
JW
3daeee6316 Update README.md 2023-08-24 16:45:25 +02:00
GitHub Action
cde38df1b3 Update version in pom.xml 2023-08-24 14:38:53 +00:00
10 changed files with 22 additions and 24 deletions

View File

@@ -5,7 +5,7 @@
<parent>
<artifactId>TikTokLiveJava</artifactId>
<groupId>io.github.jwdeveloper.tiktok</groupId>
<version>0.0.12-Release</version>
<version>0.0.13-Release</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>API</artifactId>

View File

@@ -5,7 +5,7 @@
<parent>
<artifactId>TikTokLiveJava</artifactId>
<groupId>io.github.jwdeveloper.tiktok</groupId>
<version>0.0.12-Release</version>
<version>0.0.13-Release</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -105,16 +105,18 @@ public class TikTokMessageHandlerRegistration extends TikTokMessageHandler {
private TikTokEvent handleSocialMedia(WebcastResponse.Message msg) {
var message = WebcastSocialMessage.parseFrom(msg.getBinary());
String type = message.getHeader().getSocialData().getType();
Pattern pattern = Pattern.compile("\\d+");
Matcher matcher = pattern.matcher(type);
if (matcher.find()) {
var socialType = message.getHeader().getSocialData().getType();
var pattern = Pattern.compile("pm_mt_guidance_viewer_([0-9]+)_share");
var matcher = pattern.matcher(socialType);
if (matcher.find())
{
var value = matcher.group(0);
var number = Integer.parseInt(value);
return new TikTokShareEvent(message, number);
}
var socialType = message.getHeader().getSocialData().getType();
return switch (socialType) {
case SocialTypes.LikeType -> new TikTokLikeEvent(message);
case SocialTypes.FollowType -> new TikTokFollowEvent(message);

View File

@@ -90,7 +90,7 @@ public class TikTokHttpApiClient {
var fullUrl = HttpUtils.parseParameters(url,parameters);
var singHeaders = new TreeMap<String,Object>();
singHeaders.put("client", "ttlive-net");
singHeaders.put("client", "ttlive-java");
singHeaders.put("uuc", 1);
singHeaders.put("url", fullUrl);

View File

@@ -37,24 +37,15 @@ Do you prefer other programming languages?
```xml
<dependencies>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.24.1</version>
<groupId>com.github.jwdeveloper.TikTok-Live-Java</groupId>
<artifactId>Client</artifactId>
<version>0.0.13-Release</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.jwdeveloper</groupId>
<artifactId>TikTok-Live-Java</artifactId>
<version>0.0.12-Release</version>
<scope>compile</scope>
</dependency>
</dependencies>
```

View File

@@ -5,7 +5,7 @@
<parent>
<artifactId>TikTokLiveJava</artifactId>
<groupId>io.github.jwdeveloper.tiktok</groupId>
<version>0.0.12-Release</version>
<version>0.0.13-Release</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -7,7 +7,7 @@ import java.io.IOException;
public class Main {
public static String TEST_TIKTOK_USER = "dmikl_";
public static String TEST_TIKTOK_USER = "kitovskyyy";
public static void main(String[] args) throws IOException {
var client = TikTokLive.newClient(TEST_TIKTOK_USER)

View File

@@ -6,10 +6,15 @@ public class SimpleExample {
public static void main(String[] args) throws IOException {
TikTokLive.newClient(Main.TEST_TIKTOK_USER)
.onFollow((liveClient, event) ->
{
System.out.println("Follow joined -> " + event.getNewFollower().getNickName());
})
.onConnected((client, event) ->
{
System.out.println("Connected");
})
.onJoin((client, event) ->
{
System.out.println("User joined -> " + event.getUser().getNickName());

View File

@@ -5,7 +5,7 @@
<parent>
<artifactId>TikTokLiveJava</artifactId>
<groupId>io.github.jwdeveloper.tiktok</groupId>
<version>0.0.12-Release</version>
<version>0.0.13-Release</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@@ -7,7 +7,7 @@
<groupId>io.github.jwdeveloper.tiktok</groupId>
<artifactId>TikTokLiveJava</artifactId>
<packaging>pom</packaging>
<version>0.0.12-Release</version>
<version>0.0.13-Release</version>
<modules>
<module>API</module>
<module>Client</module>