new CB stream info url
This commit is contained in:
parent
c9fd95c247
commit
7a0dc3a371
|
@ -215,7 +215,7 @@ public class ChaturbateModel extends AbstractModel {
|
|||
src.setBandwidth(playlist.getStreamInfo().getBandwidth());
|
||||
src.setHeight(playlist.getStreamInfo().getResolution().height);
|
||||
src.setWidth(playlist.getStreamInfo().getResolution().width);
|
||||
String masterUrl = streamInfo.url;
|
||||
String masterUrl = streamInfo.hls_source;
|
||||
String baseUrl = masterUrl.substring(0, masterUrl.lastIndexOf('/') + 1);
|
||||
String segmentUri = baseUrl + playlist.getUri();
|
||||
src.setMediaPlaylistUrl(segmentUri);
|
||||
|
@ -299,13 +299,8 @@ public class ChaturbateModel extends AbstractModel {
|
|||
if (streamInfo != null && Duration.between(lastStreamInfoRequest, Instant.now()).getSeconds() < 5) {
|
||||
return streamInfo;
|
||||
}
|
||||
RequestBody body = new FormBody.Builder()
|
||||
.add("room_slug", getName())
|
||||
.add("bandwidth", "high")
|
||||
.build();
|
||||
Request req = new Request.Builder()
|
||||
.url(getSite().getBaseUrl() + "/get_edge_hls_url_ajax/")
|
||||
.post(body)
|
||||
.url(getSite().getBaseUrl() + "/api/chatvideocontext/" + getName() + '/')
|
||||
.header(USER_AGENT, site.getHttpClient().getEffectiveUserAgent(URI.create(getSite().getBaseUrl()).getHost()))
|
||||
.header(X_REQUESTED_WITH, XML_HTTP_REQUEST)
|
||||
.build();
|
||||
|
@ -317,18 +312,18 @@ public class ChaturbateModel extends AbstractModel {
|
|||
streamInfo = mapper.readValue(content, StreamInfo.class);
|
||||
|
||||
if (streamInfo.cmaf_edge) {
|
||||
if (streamInfo.url.contains("playlist.m3u8")) {
|
||||
streamInfo.url = streamInfo.url.replace("playlist.m3u8", "playlist_sfm4s.m3u8");
|
||||
} else if (streamInfo.url.contains("playlist_sfm4s.m3u8")) {
|
||||
streamInfo.url = streamInfo.url.replace("playlist_sfm4s.m3u8", "playlist.m3u8");
|
||||
if (streamInfo.hls_source.contains("playlist.m3u8")) {
|
||||
streamInfo.hls_source = streamInfo.hls_source.replace("playlist.m3u8", "playlist_sfm4s.m3u8");
|
||||
} else if (streamInfo.hls_source.contains("playlist_sfm4s.m3u8")) {
|
||||
streamInfo.hls_source = streamInfo.hls_source.replace("playlist_sfm4s.m3u8", "playlist.m3u8");
|
||||
}
|
||||
|
||||
var match = serverPattern.matcher(streamInfo.url);
|
||||
var match = serverPattern.matcher(streamInfo.hls_source);
|
||||
|
||||
if (getSite().getHttpClient().isLoggedIn()) {
|
||||
streamInfo.url = match.replaceFirst("live-fhls/amlst");
|
||||
streamInfo.hls_source = match.replaceFirst("live-fhls/amlst");
|
||||
} else {
|
||||
streamInfo.url = match.replaceFirst("live-c-fhls/amlst");
|
||||
streamInfo.hls_source = match.replaceFirst("live-c-fhls/amlst");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -343,7 +338,7 @@ public class ChaturbateModel extends AbstractModel {
|
|||
|
||||
private int[] getResolution() throws IOException, ParseException, PlaylistException {
|
||||
int[] res = new int[2];
|
||||
if (!getStreamInfo().url.startsWith("http")) {
|
||||
if (!getStreamInfo().hls_source.startsWith("http")) {
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -382,10 +377,10 @@ public class ChaturbateModel extends AbstractModel {
|
|||
}
|
||||
|
||||
private MasterPlaylist getMasterPlaylist(StreamInfo streamInfo) throws IOException, ParseException, PlaylistException {
|
||||
log.trace("Loading master playlist {}", streamInfo.url);
|
||||
log.trace("Loading master playlist {}", streamInfo.hls_source);
|
||||
Request req = new Request.Builder()
|
||||
.url(streamInfo.url)
|
||||
.header(USER_AGENT, site.getHttpClient().getEffectiveUserAgent(URI.create(streamInfo.url).getHost()))
|
||||
.url(streamInfo.hls_source)
|
||||
.header(USER_AGENT, site.getHttpClient().getEffectiveUserAgent(URI.create(streamInfo.hls_source).getHost()))
|
||||
.build();
|
||||
try (Response response = getSite().getHttpClient().execute(req)) {
|
||||
if (response.isSuccessful()) {
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
package ctbrec.sites.chaturbate;
|
||||
|
||||
public class StreamInfo {
|
||||
public String url;
|
||||
public String hls_source;
|
||||
public String room_status;
|
||||
public String hidden_message;
|
||||
public boolean success;
|
||||
public boolean cmaf_edge;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue