mirror of
https://github.com/jwdeveloper/TikTokLiveJava.git
synced 2026-02-27 16:59:39 -05:00
Breaking changes:
'Gift': changed from class to enum, so now you can handle
incoming gifts in switch
`Events`
- new:
onGiftComboFinished
- Removed:
onGiftBrodcast
- Rename:
onGiftMessage -> onGift
onRoomPinMessage -> onRoomPin
onRoomMessage -> onRoom
onLinkMessage -> onLink
onBarrageMessage -> onBarrage
onPollMessage -> onPoll
onShopMessage -> onShop
onDetectMessage -> onDetect
`GiftManager`
added:
registerGift
findById
findByName
getGifts
removed:
getActiveGifts
This commit is contained in:
@@ -63,7 +63,7 @@ public class RunCollector {
|
||||
// users.add("mia_tattoo");
|
||||
// users.add("mr_wavecheck");
|
||||
users.add("bangbetmenygy");
|
||||
users.add("szwagierkaqueen");
|
||||
// users.add("szwagierkaqueen");
|
||||
for (var user : users) {
|
||||
try {
|
||||
runTikTokLiveInstance(user, db);
|
||||
|
||||
@@ -22,16 +22,61 @@
|
||||
*/
|
||||
package io.github.jwdeveloper.tiktok.tools.tester;
|
||||
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastLinkMicFanTicketMethod;
|
||||
import io.github.jwdeveloper.tiktok.mockClient.TikTokClientMock;
|
||||
|
||||
public class RunLogTester
|
||||
{
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
var mockClient = TikTokClientMock.create("123").buildAndRun();
|
||||
public class RunLogTester {
|
||||
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
|
||||
|
||||
var input ="CjwKHVdlYmNhc3RMaW5rTWljRmFuVGlja2V0TWV0aG9kEIWWp7ig2O6OZRiGlviyrNjpjmUgza2G4a8xMAESZwoNCIWIouKYhLqBYhCbARCbASpTaHR0cHM6Ly9wMTYtd2ViY2FzdC50aWt0b2tjZG4uY29tL2ltZy93ZWJjYXN0LXNnL3Rpa3Rva19saW5rbWljX2NvaW5AM3gucG5nfjB4MC5wbmc=";
|
||||
var bytes = Base64.getDecoder().decode(input);
|
||||
var a= WebcastLinkMicFanTicketMethod.parseFrom(bytes);
|
||||
|
||||
|
||||
|
||||
var messages = getMessages();
|
||||
var client = TikTokClientMock.create().build();
|
||||
for(var msg : messages.entrySet())
|
||||
{
|
||||
for(var content : msg.getValue())
|
||||
{
|
||||
client.publishMessage(msg.getKey(),content);
|
||||
}
|
||||
}
|
||||
client.connect();
|
||||
}
|
||||
|
||||
|
||||
private static Map<String, List<String>> getMessages() throws IOException {
|
||||
var path = "C:\\Users\\ja\\IdeaProjects\\TikTokLiveJava\\Tools-EventsCollector\\src\\main\\resources\\log.json";
|
||||
var jsonElement = JsonParser.parseReader(new FileReader(path, Charset.defaultCharset()));
|
||||
|
||||
var res = new HashMap<String, List<String>>();
|
||||
if (jsonElement.isJsonObject()) {
|
||||
var jsonObject = jsonElement.getAsJsonObject();
|
||||
var keys = jsonObject.keySet();
|
||||
for (String key : keys) {
|
||||
var messages = jsonObject.get(key).getAsJsonArray();
|
||||
for (var msg : messages) {
|
||||
var data = msg.getAsJsonObject().get("eventData").getAsString();
|
||||
// System.out.println("KEY: " + key + " DATA: " + data);
|
||||
res.computeIfAbsent(key, s -> new ArrayList<>()).add(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user