mirror of
https://github.com/jwdeveloper/TikTokLiveJava.git
synced 2026-03-02 02:09:40 -05:00
Fixed bugs:
- addListeners() was throwing exception - 404 response code was return while connecting to tiktok for some users - configure.setRoomId() method for people that want to set roomId manually - client.roomInfo().isAgeRestricted() check if live has age restriction
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package io.github.jwdeveloper.tiktok.mappers;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import io.github.jwdeveloper.tiktok.live.LiveRoomMeta;
|
||||
|
||||
public class LiveRoomMetaMapper implements Mapper<JsonObject, LiveRoomMeta>
|
||||
{
|
||||
@Override
|
||||
public LiveRoomMeta mapFrom(JsonObject input) {
|
||||
var liveRoomMeta = new LiveRoomMeta();
|
||||
|
||||
if (!input.has("data")) {
|
||||
return liveRoomMeta;
|
||||
}
|
||||
var data = input.getAsJsonObject("data");
|
||||
if (data.has("status")) {
|
||||
var status = data.get("status");
|
||||
liveRoomMeta.setStatus(status.getAsInt());
|
||||
}
|
||||
|
||||
|
||||
if(data.has("age_restricted"))
|
||||
{
|
||||
var element = data.getAsJsonObject("age_restricted");
|
||||
var restricted= element.get("restricted").getAsBoolean();
|
||||
liveRoomMeta.setAgeRestricted(restricted);
|
||||
}
|
||||
return liveRoomMeta;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user