mirror of
https://github.com/jwdeveloper/TikTokLiveJava.git
synced 2026-02-27 08:49:40 -05:00
Due to convention, interfaces should not have TikTok name inside, but they should have prefix Live instead
- rename TikTokMapper to LiveMapper - rename TikTokLiveMapperHelper to LiveMapperHelper Create interface: LiveEventsHandler for TikTokLiveEventHandler LiveMessagesHandler for TikTokLiveMessageHandler
This commit is contained in:
@@ -3,6 +3,9 @@ package io.github.jwdeveloper.tiktok;
|
||||
import io.github.jwdeveloper.tiktok.data.events.common.TikTokEvent;
|
||||
import io.github.jwdeveloper.tiktok.data.events.gift.TikTokGiftEvent;
|
||||
import io.github.jwdeveloper.tiktok.data.models.gifts.Gift;
|
||||
import io.github.jwdeveloper.tiktok.data.settings.LiveClientSettings;
|
||||
import io.github.jwdeveloper.tiktok.http.HttpClientBuilder;
|
||||
import io.github.jwdeveloper.tiktok.http.HttpClientFactory;
|
||||
import io.github.jwdeveloper.tiktok.live.GiftsManager;
|
||||
import io.github.jwdeveloper.tiktok.live.LiveClient;
|
||||
|
||||
@@ -17,6 +20,7 @@ import java.util.function.Predicate;
|
||||
public class CusomizationExample {
|
||||
public static void main(String[] args) {
|
||||
|
||||
var customEventHandler = new CustomEventsHandler();
|
||||
var client = TikTokLive.newClient("john")
|
||||
.configure(liveClientSettings ->
|
||||
{
|
||||
@@ -30,7 +34,7 @@ public class CusomizationExample {
|
||||
.customize(container ->
|
||||
{
|
||||
//overriding default implementation of GiftsManager, with own one
|
||||
container.registerSingleton(TikTokLiveEventHandler.class, CustomEventsHandler.class);
|
||||
container.registerSingleton(TikTokLiveEventHandler.class, customEventHandler);
|
||||
}).build();
|
||||
|
||||
client.connect();
|
||||
@@ -38,6 +42,7 @@ public class CusomizationExample {
|
||||
client.publishEvent(TikTokGiftEvent.of("stone", 2, 12));
|
||||
}
|
||||
|
||||
|
||||
public static class CustomEventsHandler extends TikTokLiveEventHandler {
|
||||
|
||||
@Override
|
||||
|
||||
2
pom.xml
2
pom.xml
@@ -12,7 +12,7 @@
|
||||
<module>API</module>
|
||||
<module>Client</module>
|
||||
<module>Examples</module>
|
||||
<module>Tools-ReadmeGenerator</module>
|
||||
<module>tools-readme</module>
|
||||
|
||||
<module>extension-recorder</module>
|
||||
<module>extension-collector</module>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>Tools-ReadmeGenerator</artifactId>
|
||||
<artifactId>tools-readme</artifactId>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
@@ -23,6 +23,11 @@
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.hubspot.jinjava</groupId>
|
||||
<artifactId>jinjava</artifactId>
|
||||
<version>2.7.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
3
tools-readme/readme.md
Normal file
3
tools-readme/readme.md
Normal file
@@ -0,0 +1,3 @@
|
||||
Generates documentation from template
|
||||
that can be found under
|
||||
- `src/main/resources/readme-template.html`
|
||||
@@ -22,6 +22,7 @@ public class Main
|
||||
|
||||
var output = System.getProperty("user.dir");
|
||||
|
||||
|
||||
DescriptionGenerator generator = Descrabble.create()
|
||||
.withTemplate(targetFile)
|
||||
.withVariable("version", version)
|
||||
@@ -0,0 +1,27 @@
|
||||
package io.github.jwdeveloper.tiktok;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.io.Resources;
|
||||
import com.hubspot.jinjava.Jinjava;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
|
||||
|
||||
public class Main2 {
|
||||
public static void main(String[] args) throws IOException {
|
||||
var version = System.getenv("VERSION");
|
||||
if (version == null || version.equals("")) {
|
||||
version = "[Replace with current version]";
|
||||
}
|
||||
|
||||
var template = Resources.toString(Resources.getResource("my-template.html"), Charsets.UTF_8);
|
||||
|
||||
var jinjava = new Jinjava();
|
||||
var context = new HashMap<String, Object>();
|
||||
context.put("version", version);
|
||||
|
||||
var renderedTemplate = jinjava.render(template, context);
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 241 KiB After Width: | Height: | Size: 241 KiB |
@@ -4,7 +4,6 @@
|
||||
</image>
|
||||
</container>
|
||||
|
||||
|
||||
<container>
|
||||
<title>TikTok Live Java</title>
|
||||
<br>
|
||||
@@ -19,6 +18,11 @@
|
||||
</container>
|
||||
</container>
|
||||
|
||||
<text>
|
||||
A Java library inspired by [TikTokLive](https://github.com/isaackogan/TikTokLive) and [TikTokLiveSharp](https://github.com/frankvHoof93/TikTokLiveSharp). Use it to receive live stream events such as comments and gifts in realtime from [TikTok LIVE](https://www.tiktok.com/live) by connecting to TikTok's internal WebCast push service.
|
||||
The library includes a wrapper that connects to the WebCast service using just the username (`uniqueId`). This allows you to connect to your own live chat as well as the live chat of other streamers.
|
||||
No credentials are required. Events such as [Members Joining](#member), [Gifts](#gift), [Subscriptions](#subscribe), [Viewers](#roomuser), [Follows](#social), [Shares](#social), [Questions](#questionnew), [Likes](#like) and [Battles](#linkmicbattle) can be tracked.
|
||||
</text>
|
||||
|
||||
<br>
|
||||
<code language="xml">
|
||||
@@ -81,7 +81,8 @@ Do you prefer other programming languages?
|
||||
|
||||
## Events
|
||||
|
||||
{{events-content}}
|
||||
|
||||
@{events-content}
|
||||
|
||||
{{for item of data}}
|
||||
|
||||
@@ -102,6 +103,5 @@ my name is {{item.name}}
|
||||
{{listener-content}}
|
||||
```
|
||||
|
||||
|
||||
## Contributing
|
||||
Your improvements are welcome! Feel free to open an <a href="https://github.com/jwdeveloper/TikTok-Live-Java/issues">issue</a> or <a href="https://github.com/jwdeveloper/TikTok-Live-Java/pulls">pull request</a>.
|
||||
Reference in New Issue
Block a user