SC decrypt revert

This commit is contained in:
Jafea7 2025-09-06 16:03:25 +10:00
parent 719aeeb4b4
commit ecccfd501b
2 changed files with 18 additions and 21 deletions

View File

@ -22,7 +22,7 @@ import ctbrec.recorder.download.HttpHeaderFactory;
import ctbrec.recorder.download.StreamSource;
import ctbrec.recorder.download.hls.SegmentPlaylist.Segment;
import ctbrec.sites.Site;
//import ctbrec.sites.stripchat.StripchatModel;
import ctbrec.sites.stripchat.StripchatModel;
import okhttp3.Request;
import okhttp3.Request.Builder;
import okhttp3.Response;
@ -294,9 +294,9 @@ public abstract class AbstractHlsDownload extends AbstractDownload {
if (response.isSuccessful()) {
consecutivePlaylistTimeouts = 0;
String body = Objects.requireNonNull(response.body()).string();
/* if (model.getSite().getName().equalsIgnoreCase("stripchat")) {
if (model.getSite().getName().equalsIgnoreCase("stripchat")) {
body = StripchatModel.m3uDecoder(body);
} */
}
if (!body.contains("#EXTINF")) {
// no segments, empty playlist
return new SegmentPlaylist(segmentPlaylistUrl);

View File

@ -22,7 +22,7 @@ import org.json.JSONObject;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
//import java.security.MessageDigest;
import java.security.MessageDigest;
import java.text.MessageFormat;
import java.time.Duration;
import java.time.Instant;
@ -46,8 +46,8 @@ public class StripchatModel extends AbstractModel {
private transient Instant lastInfoRequest = Instant.EPOCH;
// New fields for DRM fix
// private transient String psch;
// private transient String pkey;
private transient String psch;
private transient String pkey;
@Override
public boolean isOnline(boolean ignoreCache) throws IOException, ExecutionException, InterruptedException {
@ -177,9 +177,9 @@ public class StripchatModel extends AbstractModel {
mediaUrl = mediaUrl.substring(0, mediaUrl.lastIndexOf('?'));
}
// Append psch & pkey if available
/* if (psch != null && pkey != null) {
if (psch != null && pkey != null) {
mediaUrl += "?psch=" + psch + "&pkey=" + pkey;
} */
}
src.setMediaPlaylistUrl(mediaUrl);
log.trace("Media playlist {}", mediaUrl);
sources.add(src);
@ -198,7 +198,7 @@ public class StripchatModel extends AbstractModel {
if (response.isSuccessful()) {
String body = response.body().string();
/* // Detect Mouflon DRM line
// Detect Mouflon DRM line
if (body.contains("#EXT-X-MOUFLON")) {
int start = body.indexOf("#EXT-X-MOUFLON:");
int end = body.indexOf('\n', start);
@ -215,8 +215,7 @@ public class StripchatModel extends AbstractModel {
// Run through m3uDecoder
String decoded = m3uDecoder(body);
InputStream inputStream = new ByteArrayInputStream(decoded.getBytes(UTF_8)); */
InputStream inputStream = new ByteArrayInputStream(body.getBytes(UTF_8));
InputStream inputStream = new ByteArrayInputStream(decoded.getBytes(UTF_8));
PlaylistParser parser = new PlaylistParser(inputStream, Format.EXT_M3U, Encoding.UTF_8, ParsingMode.LENIENT);
Playlist playlist = parser.parse();
return playlist.getMasterPlaylist();
@ -244,17 +243,15 @@ public class StripchatModel extends AbstractModel {
log.debug("Spy start for {}", getName());
}
}
// String hlsUrlTemplate = "https://edge-hls.doppiocdn.com/hls/{0}{1}/master/{0}{1}_auto.m3u8?playlistType=Standart{2}";
String hlsUrlTemplate = "https://edge-hls.saawsedge.com/hls/{0}{1}/master/{0}{1}.m3u8";
// return MessageFormat.format(hlsUrlTemplate, String.valueOf(id), vrSuffix, token);
return MessageFormat.format(hlsUrlTemplate, String.valueOf(id), vrSuffix);
String hlsUrlTemplate = "https://edge-hls.doppiocdn.live/hls/{0}{1}/master/{0}{1}_auto.m3u8?playlistType=Standart{2}";
return MessageFormat.format(hlsUrlTemplate, String.valueOf(id), vrSuffix, token);
} else {
throw new IOException("Playlist URL not found");
}
}
// Java equivalent of Python m3u_decoder
/* public static String m3uDecoder(String content) {
public static String m3uDecoder(String content) {
List<String> decodedLines = new ArrayList<>();
String[] lines = content.split("\\r?\\n");
for (int i = 0; i < lines.length; i++) {
@ -274,9 +271,9 @@ public class StripchatModel extends AbstractModel {
decodedLines.add(line);
}
return String.join("\n", decodedLines);
} */
}
/* private static String decodeMouflon(String encryptedB64, String key) throws Exception {
private static String decodeMouflon(String encryptedB64, String key) throws Exception {
MessageDigest digest = MessageDigest.getInstance("SHA-256");
byte[] hash = digest.digest(key.getBytes(UTF_8));
@ -295,15 +292,15 @@ public class StripchatModel extends AbstractModel {
decrypted[i] = (byte) (encrypted[i] ^ hash[i % hash.length]);
}
return new String(decrypted, UTF_8);
} */
}
@Override
public void invalidateCacheEntries() {
resolution = new int[]{0, 0};
lastInfoRequest = Instant.EPOCH;
modelInfo = null;
// psch = null;
// pkey = null;
psch = null;
pkey = null;
}
@Override