mirror of
https://github.com/jwdeveloper/TikTokLiveJava.git
synced 2026-02-28 09:19:40 -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>
|
<parent>
|
||||||
<artifactId>TikTokLiveJava</artifactId>
|
<artifactId>TikTokLiveJava</artifactId>
|
||||||
<groupId>io.github.jwdeveloper.tiktok</groupId>
|
<groupId>io.github.jwdeveloper.tiktok</groupId>
|
||||||
<version>0.0.12-Release</version>
|
<version>0.0.13-Release</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>API</artifactId>
|
<artifactId>API</artifactId>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>TikTokLiveJava</artifactId>
|
<artifactId>TikTokLiveJava</artifactId>
|
||||||
<groupId>io.github.jwdeveloper.tiktok</groupId>
|
<groupId>io.github.jwdeveloper.tiktok</groupId>
|
||||||
<version>0.0.12-Release</version>
|
<version>0.0.13-Release</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -105,16 +105,18 @@ public class TikTokMessageHandlerRegistration extends TikTokMessageHandler {
|
|||||||
private TikTokEvent handleSocialMedia(WebcastResponse.Message msg) {
|
private TikTokEvent handleSocialMedia(WebcastResponse.Message msg) {
|
||||||
var message = WebcastSocialMessage.parseFrom(msg.getBinary());
|
var message = WebcastSocialMessage.parseFrom(msg.getBinary());
|
||||||
|
|
||||||
String type = message.getHeader().getSocialData().getType();
|
var socialType = message.getHeader().getSocialData().getType();
|
||||||
Pattern pattern = Pattern.compile("\\d+");
|
var pattern = Pattern.compile("pm_mt_guidance_viewer_([0-9]+)_share");
|
||||||
Matcher matcher = pattern.matcher(type);
|
var matcher = pattern.matcher(socialType);
|
||||||
if (matcher.find()) {
|
|
||||||
|
if (matcher.find())
|
||||||
|
{
|
||||||
var value = matcher.group(0);
|
var value = matcher.group(0);
|
||||||
var number = Integer.parseInt(value);
|
var number = Integer.parseInt(value);
|
||||||
return new TikTokShareEvent(message, number);
|
return new TikTokShareEvent(message, number);
|
||||||
}
|
}
|
||||||
|
|
||||||
var socialType = message.getHeader().getSocialData().getType();
|
|
||||||
return switch (socialType) {
|
return switch (socialType) {
|
||||||
case SocialTypes.LikeType -> new TikTokLikeEvent(message);
|
case SocialTypes.LikeType -> new TikTokLikeEvent(message);
|
||||||
case SocialTypes.FollowType -> new TikTokFollowEvent(message);
|
case SocialTypes.FollowType -> new TikTokFollowEvent(message);
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ public class TikTokHttpApiClient {
|
|||||||
|
|
||||||
var fullUrl = HttpUtils.parseParameters(url,parameters);
|
var fullUrl = HttpUtils.parseParameters(url,parameters);
|
||||||
var singHeaders = new TreeMap<String,Object>();
|
var singHeaders = new TreeMap<String,Object>();
|
||||||
singHeaders.put("client", "ttlive-net");
|
singHeaders.put("client", "ttlive-java");
|
||||||
singHeaders.put("uuc", 1);
|
singHeaders.put("uuc", 1);
|
||||||
singHeaders.put("url", fullUrl);
|
singHeaders.put("url", fullUrl);
|
||||||
|
|
||||||
|
|||||||
15
README.md
15
README.md
@@ -37,24 +37,15 @@ Do you prefer other programming languages?
|
|||||||
```xml
|
```xml
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.protobuf</groupId>
|
<groupId>com.github.jwdeveloper.TikTok-Live-Java</groupId>
|
||||||
<artifactId>protobuf-java</artifactId>
|
<artifactId>Client</artifactId>
|
||||||
<version>3.24.1</version>
|
<version>0.0.13-Release</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.code.gson</groupId>
|
<groupId>com.google.code.gson</groupId>
|
||||||
<artifactId>gson</artifactId>
|
<artifactId>gson</artifactId>
|
||||||
<version>2.10.1</version>
|
<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>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>TikTokLiveJava</artifactId>
|
<artifactId>TikTokLiveJava</artifactId>
|
||||||
<groupId>io.github.jwdeveloper.tiktok</groupId>
|
<groupId>io.github.jwdeveloper.tiktok</groupId>
|
||||||
<version>0.0.12-Release</version>
|
<version>0.0.13-Release</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import java.io.IOException;
|
|||||||
|
|
||||||
public class Main {
|
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 {
|
public static void main(String[] args) throws IOException {
|
||||||
var client = TikTokLive.newClient(TEST_TIKTOK_USER)
|
var client = TikTokLive.newClient(TEST_TIKTOK_USER)
|
||||||
|
|||||||
@@ -6,10 +6,15 @@ public class SimpleExample {
|
|||||||
public static void main(String[] args) throws IOException {
|
public static void main(String[] args) throws IOException {
|
||||||
|
|
||||||
TikTokLive.newClient(Main.TEST_TIKTOK_USER)
|
TikTokLive.newClient(Main.TEST_TIKTOK_USER)
|
||||||
|
.onFollow((liveClient, event) ->
|
||||||
|
{
|
||||||
|
System.out.println("Follow joined -> " + event.getNewFollower().getNickName());
|
||||||
|
})
|
||||||
.onConnected((client, event) ->
|
.onConnected((client, event) ->
|
||||||
{
|
{
|
||||||
System.out.println("Connected");
|
System.out.println("Connected");
|
||||||
})
|
})
|
||||||
|
|
||||||
.onJoin((client, event) ->
|
.onJoin((client, event) ->
|
||||||
{
|
{
|
||||||
System.out.println("User joined -> " + event.getUser().getNickName());
|
System.out.println("User joined -> " + event.getUser().getNickName());
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>TikTokLiveJava</artifactId>
|
<artifactId>TikTokLiveJava</artifactId>
|
||||||
<groupId>io.github.jwdeveloper.tiktok</groupId>
|
<groupId>io.github.jwdeveloper.tiktok</groupId>
|
||||||
<version>0.0.12-Release</version>
|
<version>0.0.13-Release</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
|||||||
2
pom.xml
2
pom.xml
@@ -7,7 +7,7 @@
|
|||||||
<groupId>io.github.jwdeveloper.tiktok</groupId>
|
<groupId>io.github.jwdeveloper.tiktok</groupId>
|
||||||
<artifactId>TikTokLiveJava</artifactId>
|
<artifactId>TikTokLiveJava</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<version>0.0.12-Release</version>
|
<version>0.0.13-Release</version>
|
||||||
<modules>
|
<modules>
|
||||||
<module>API</module>
|
<module>API</module>
|
||||||
<module>Client</module>
|
<module>Client</module>
|
||||||
|
|||||||
Reference in New Issue
Block a user