mirror of
https://github.com/jwdeveloper/TikTokLiveJava.git
synced 2026-02-27 16:59:39 -05:00
Updated ProxyData exceptions to include previous exception to finish stacktrace
Updated LiveUserData.Request to throw an IllegalArgumentException when a null or blank username is provided Updated HttpClientSettings to use setProxyClientSettings instead of direct access Fixed ProxyRotation bug starting at index 1 instead of 0 and made methods default to synchronized in case concurrency is used in implementors code Changed HttpClient#toUrl to toUri Added @Getter to HttpClientFactory for liveClientSettings Added consumer to TikTokLive#requests so that way proxies can be used when calling the fetch methods Changed LiveUserData.Response#startTime to clarify the variable name
This commit is contained in:
@@ -32,6 +32,7 @@ import io.github.jwdeveloper.tiktok.http.mappers.*;
|
||||
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastResponse;
|
||||
|
||||
import java.net.http.HttpResponse;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class TikTokLiveHttpClient implements LiveHttpClient
|
||||
@@ -53,17 +54,18 @@ public class TikTokLiveHttpClient implements LiveHttpClient
|
||||
private final GiftsDataMapper giftsDataMapper;
|
||||
private final Logger logger;
|
||||
|
||||
public TikTokLiveHttpClient(HttpClientFactory factory, LiveClientSettings settings) {
|
||||
public TikTokLiveHttpClient(HttpClientFactory factory) {
|
||||
this.httpFactory = factory;
|
||||
this.clientSettings = settings;
|
||||
this.clientSettings = factory.getLiveClientSettings();
|
||||
this.logger = LoggerFactory.create("HttpClient-"+hashCode(), clientSettings);
|
||||
liveUserDataMapper = new LiveUserDataMapper();
|
||||
liveDataMapper = new LiveDataMapper();
|
||||
giftsDataMapper = new GiftsDataMapper();
|
||||
}
|
||||
|
||||
public TikTokLiveHttpClient() {
|
||||
this(new HttpClientFactory(LiveClientSettings.createDefault()), LiveClientSettings.createDefault());
|
||||
public TikTokLiveHttpClient(Consumer<LiveClientSettings> consumer) {
|
||||
this(new HttpClientFactory(LiveClientSettings.createDefault()));
|
||||
consumer.accept(clientSettings);
|
||||
}
|
||||
|
||||
public GiftsData.Response fetchRoomGiftsData(String room_id) {
|
||||
@@ -191,7 +193,7 @@ public class TikTokLiveHttpClient implements LiveHttpClient
|
||||
.withParam("internal_ext", webcastResponse.getInternalExt())
|
||||
.withParams(webcastResponse.getRouteParamsMapMap())
|
||||
.build()
|
||||
.toUrl();
|
||||
.toUri();
|
||||
|
||||
return new LiveConnectionData.Response(websocketCookie, webSocketUrl, webcastResponse);
|
||||
} catch (InvalidProtocolBufferException e) {
|
||||
|
||||
Reference in New Issue
Block a user