mirror of
https://github.com/jwdeveloper/TikTokLiveJava.git
synced 2026-02-27 16:59:39 -05:00
Compare commits
5 Commits
0.0.13-Rel
...
0.0.14-Rel
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6e9244aa67 | ||
|
|
fadb1ab267 | ||
|
|
4273375eb9 | ||
|
|
3daeee6316 | ||
|
|
cde38df1b3 |
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
15
README.md
15
README.md
@@ -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>
|
||||
```
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user