forked from j62/ctbrec
1
0
Fork 0

Merge branch 'dev' into fc2

# Conflicts:
#	client/src/main/java/ctbrec/ui/ExternalBrowser.java
This commit is contained in:
0xboobface 2019-01-23 17:56:20 +01:00
commit 16fdee2a2c
24 changed files with 149 additions and 129 deletions

View File

@ -1,3 +1,10 @@
1.17.1
========================
* Improved LiveJasmin recordings. Login is not required anymore (thanks to M1h43ly)
HD recordings should also work much better
* Added setting for the base URL for LiveJasmin
* Fixed CamSoda thumbnail overviews
1.17.0
========================
* Added LiveJasmin

View File

@ -8,7 +8,7 @@
<parent>
<groupId>ctbrec</groupId>
<artifactId>master</artifactId>
<version>1.17.0</version>
<version>1.17.1</version>
<relativePath>../master</relativePath>
</parent>

View File

@ -139,7 +139,7 @@ public class ExternalBrowser implements AutoCloseable {
ready.notify();
}
while( !Thread.interrupted() && (line = br.readLine()) != null ) {
LOG.debug(line);
LOG.debug("Browser output: {}", line);
if(!line.startsWith("{")) {
} else {
if(messageListener != null) {

View File

@ -84,31 +84,25 @@ public class CamsodaUpdateService extends PaginatedScheduledService {
} else {
String name = result.getString("username");
CamsodaModel model = (CamsodaModel) camsoda.createModel(name);
if(result.has("server_prefix")) {
String serverPrefix = result.getString("server_prefix");
String streamName = result.getString("stream_name");
model.setSortOrder(result.getFloat("sort_value"));
models.add(model);
if(result.has("status")) {
model.setOnlineStateByStatus(result.getString("status"));
}
String streamName = result.getString("stream_name");
model.setSortOrder(result.getFloat("sort_value"));
models.add(model);
if(result.has("status")) {
model.setOnlineStateByStatus(result.getString("status"));
}
if(result.has("display_name")) {
model.setDisplayName(result.getString("display_name"));
}
if(result.has("display_name")) {
model.setDisplayName(result.getString("display_name"));
}
if(result.has("edge_servers")) {
JSONArray edgeServers = result.getJSONArray("edge_servers");
model.setStreamUrl("https://" + edgeServers.getString(0) + "/cam/mp4:" + streamName + "_h264_aac_480p/playlist.m3u8");
}
if(result.has("edge_servers")) {
JSONArray edgeServers = result.getJSONArray("edge_servers");
model.setStreamUrl("https://" + edgeServers.getString(0) + "/cam/mp4:" + streamName + "_h264_aac_480p/playlist.m3u8");
}
if(result.has("tsize")) {
long unixtime = System.currentTimeMillis() / 1000;
String tsize = result.getString("tsize");
String preview = "https://thumbs-orig.camsoda.com/thumbs/"
+ streamName + '/' + serverPrefix + '/' + tsize + '/' + unixtime + '/' + name + ".jpg?cb=" + unixtime;
model.setPreview(preview);
}
if(result.has("thumb")) {
String previewUrl = "https:" + result.getString("thumb");
model.setPreview(previewUrl);
}
}
}
@ -118,6 +112,7 @@ public class CamsodaUpdateService extends PaginatedScheduledService {
.limit(modelsPerPage)
.collect(Collectors.toList());
} else {
LOG.debug("Response was not successful: {}", json.toString());
return Collections.emptyList();
}
} else {

View File

@ -73,20 +73,17 @@ public class LiveJasminConfigUi extends AbstractConfigUI {
GridPane.setColumnSpan(password, 2);
layout.add(password, 1, row++);
// layout.add(new Label("LiveJasmin Session ID"), 0, row);
// TextField sessionId = new TextField();
// sessionId.setText(Config.getInstance().getSettings().livejasminSession);
// sessionId.textProperty().addListener((ob, o, n) -> {
// if(!n.equals(Config.getInstance().getSettings().livejasminSession)) {
// Config.getInstance().getSettings().livejasminSession = n;
// save();
// }
// });
// GridPane.setFillWidth(sessionId, true);
// GridPane.setHgrow(sessionId, Priority.ALWAYS);
// GridPane.setColumnSpan(sessionId, 2);
// GridPane.setMargin(sessionId, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
// layout.add(sessionId, 1, row++);
layout.add(new Label("LiveJasmin Base URL"), 0, row);
TextField baseUrl = new TextField();
baseUrl.setText(Config.getInstance().getSettings().livejasminBaseUrl);
baseUrl.textProperty().addListener((ob, o, n) -> {
Config.getInstance().getSettings().livejasminBaseUrl = baseUrl.getText();
save();
});
GridPane.setFillWidth(baseUrl, true);
GridPane.setHgrow(baseUrl, Priority.ALWAYS);
GridPane.setColumnSpan(baseUrl, 2);
layout.add(baseUrl, 1, row++);
Button createAccount = new Button("Create new Account");
createAccount.setOnAction((e) -> DesktopIntegration.open(liveJasmin.getAffiliateLink()));
@ -94,6 +91,7 @@ public class LiveJasminConfigUi extends AbstractConfigUI {
GridPane.setColumnSpan(createAccount, 2);
GridPane.setMargin(username, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
GridPane.setMargin(password, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
GridPane.setMargin(baseUrl, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
GridPane.setMargin(createAccount, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
username.setPrefWidth(300);

View File

@ -20,7 +20,7 @@ import okhttp3.HttpUrl;
public class LiveJasminElectronLoginDialog {
private static final transient Logger LOG = LoggerFactory.getLogger(LiveJasminElectronLoginDialog.class);
public static final String URL = LiveJasmin.BASE_URL + "/en/auth/login";
public static final String URL = LiveJasmin.baseUrl + "/en/auth/login";
private CookieJar cookieJar;
private ExternalBrowser browser;
@ -77,12 +77,12 @@ public class LiveJasminElectronLoginDialog {
JSONObject cookie = _cookies.getJSONObject(i);
Builder b = new Cookie.Builder()
.path("/")
.domain("livejasmin.com")
.domain(LiveJasmin.baseDomain)
.name(cookie.getString("name"))
.value(cookie.getString("value"))
.expiresAt(0);
Cookie c = b.build();
cookieJar.saveFromResponse(HttpUrl.parse(LiveJasmin.BASE_URL), Collections.singletonList(c));
cookieJar.saveFromResponse(HttpUrl.parse(LiveJasmin.baseUrl), Collections.singletonList(c));
}
}
if(url.contains("/member/")) {

View File

@ -40,7 +40,7 @@ public class LiveJasminFollowedUpdateService extends PaginatedScheduledService {
public List<Model> call() throws IOException {
boolean loggedIn = SiteUiFactory.getUi(liveJasmin).login();
if(!loggedIn) {
throw new RuntimeException("Couldn't login on livejasmin.com");
throw new RuntimeException("Couldn't login to livejasmin");
}
//String _url = url + ((page-1) * 36); // TODO find out how to switch pages
//LOG.debug("Fetching page {}", url);

View File

@ -4,7 +4,6 @@ import java.io.IOException;
import ctbrec.Config;
import ctbrec.sites.Site;
import ctbrec.ui.DesktopIntegration;
import ctbrec.ui.PaginatedScheduledService;
import ctbrec.ui.ThumbOverviewTab;
import javafx.concurrent.WorkerStateEvent;
@ -17,20 +16,16 @@ import javafx.scene.input.KeyEvent;
public class LiveJasminTab extends ThumbOverviewTab {
protected Label status;
protected Button acknowledge = new Button("That's alright");
private Button createAccount = new Button("Create Account");
private boolean betaAcknowledged = Config.getInstance().getSettings().livejasminBetaAcknowledged;
public LiveJasminTab(String title, PaginatedScheduledService updateService, Site site) {
super(title, updateService, site);
if(!betaAcknowledged) {
status = new Label("LiveJasmin is not fully functional. Live previews do not work.\n"
+ "Also make sure, that you have an account and that you have entered your credentials.\n"
+ "Otherwise you might get errors.");
status = new Label("LiveJasmin is not fully functional. Live previews do not work.");
grid.getChildren().add(status);
grid.getChildren().add(acknowledge);
grid.getChildren().add(createAccount);
} else {
status = new Label("Logging in...");
status = new Label("Loading...");
grid.getChildren().add(status);
}
@ -41,17 +36,14 @@ public class LiveJasminTab extends ThumbOverviewTab {
Config.getInstance().save();
} catch (IOException e1) {
}
status.setText("Logging in...");
status.setText("Loading...");
grid.getChildren().remove(acknowledge);
grid.getChildren().remove(createAccount);
if(updateService != null) {
updateService.cancel();
updateService.reset();
updateService.restart();
}
});
createAccount.setOnAction(e -> DesktopIntegration.open(site.getAffiliateLink()));
}
@Override
@ -64,15 +56,17 @@ public class LiveJasminTab extends ThumbOverviewTab {
if(Config.getInstance().getSettings().livejasminBetaAcknowledged) {
grid.getChildren().remove(status);
grid.getChildren().remove(acknowledge);
grid.getChildren().remove(createAccount);
super.onSuccess();
}
}
@Override
protected void onFail(WorkerStateEvent event) {
status.setText("Login failed");
super.onFail(event);
if(Config.getInstance().getSettings().livejasminBetaAcknowledged) {
status.setText("Error");
grid.getChildren().remove(acknowledge);
super.onFail(event);
}
}
@Override

View File

@ -23,10 +23,10 @@ public class LiveJasminTabProvider extends TabProvider {
public List<Tab> getTabs(Scene scene) {
List<Tab> tabs = new ArrayList<>();
tabs.add(createTab("Girls", liveJasmin.getBaseUrl() + "/en/girls/?listPageOrderType=most_popular"));
tabs.add(createTab("Girls HD", liveJasmin.getBaseUrl() + "/en/girls/hd/?listPageOrderType=most_popular"));
tabs.add(createTab("Boys", liveJasmin.getBaseUrl() + "/en/boys/?listPageOrderType=most_popular"));
tabs.add(createTab("Boys HD", liveJasmin.getBaseUrl() + "/en/boys/hd/?listPageOrderType=most_popular"));
tabs.add(createTab("Girls", liveJasmin.getBaseUrl() + "/en/girl/?listPageOrderType=most_popular"));
tabs.add(createTab("Girls HD", liveJasmin.getBaseUrl() + "/en/girl/hd/?listPageOrderType=most_popular"));
tabs.add(createTab("Boys", liveJasmin.getBaseUrl() + "/en/boy/?listPageOrderType=most_popular"));
tabs.add(createTab("Boys HD", liveJasmin.getBaseUrl() + "/en/boy/hd/?listPageOrderType=most_popular"));
followedTab = new LiveJasminFollowedTab(liveJasmin);
followedTab.setRecorder(liveJasmin.getRecorder());

View File

@ -40,28 +40,24 @@ public class LiveJasminUpdateService extends PaginatedScheduledService {
protected Task<List<Model>> createTask() {
return new Task<List<Model>>() {
@Override
public List<Model> call() throws IOException, NotLoggedInExcetion {
//String _url = url + ((page-1) * 36); // TODO find out how to switch pages
if(!SiteUiFactory.getUi(liveJasmin).login()) {
throw new NotLoggedInExcetion();
}
public List<Model> call() throws IOException {
// sort by popularity
CookieJarImpl cookieJar = liveJasmin.getHttpClient().getCookieJar();
Cookie sortCookie = new Cookie.Builder()
.domain("livejasmin.com")
.domain(LiveJasmin.baseDomain)
.name("listPageOrderType")
.value("most_popular")
.build();
cookieJar.saveFromResponse(HttpUrl.parse("https://livejasmin.com"), Collections.singletonList(sortCookie));
cookieJar.saveFromResponse(HttpUrl.parse("https://" + LiveJasmin.baseDomain), Collections.singletonList(sortCookie));
// TODO find out how to switch pages
LOG.debug("Fetching page {}", url);
Request request = new Request.Builder()
.url(url)
.addHeader("User-Agent", Config.getInstance().getSettings().httpUserAgent)
.addHeader("Accept", "application/json, text/javascript, */*")
.addHeader("Accept-Language", "en")
.addHeader("Referer", liveJasmin.getBaseUrl() + "/en/girls/")
.addHeader("Referer", liveJasmin.getBaseUrl())
.addHeader("X-Requested-With", "XMLHttpRequest")
.build();
try (Response response = liveJasmin.getHttpClient().execute(request)) {

View File

@ -1,5 +0,0 @@
package ctbrec.ui.sites.jasmin;
public class NotLoggedInExcetion extends Exception {
}

View File

@ -8,7 +8,7 @@
<parent>
<groupId>ctbrec</groupId>
<artifactId>master</artifactId>
<version>1.17.0</version>
<version>1.17.1</version>
<relativePath>../master</relativePath>
</parent>

View File

@ -65,6 +65,7 @@ public class Settings {
public String cam4Password = "";
public String livejasminUsername = "";
public String livejasminPassword = "";
public String livejasminBaseUrl = "https://www.livejasmin.com";
public boolean livejasminBetaAcknowledged = false;
public String streamateUsername = "";
public String streamatePassword = "";

View File

@ -27,4 +27,31 @@ public class StringUtil {
}
return df.format(size) + ' ' + unit;
}
public static String toHexString(byte[] bytes, int bytesPerRow) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < bytes.length; i += bytesPerRow) {
int length = bytes.length - i >= bytesPerRow ? bytesPerRow : bytes.length % bytesPerRow;
byte[] row = new byte[bytesPerRow];
System.arraycopy(bytes, i, row, 0, length);
for (int j = 0; j < length; j++) {
sb.append(toHexString(row[j]));
}
}
return sb.toString();
}
/**
* Converts one byte to its hex representation with leading zeros. E.g. 255 -> FF, 12 -> 0C
*
* @param b
* @return
*/
public static String toHexString(int b) {
String hex = Integer.toHexString(b & 0xFF);
if (hex.length() < 2) {
hex = "0" + hex;
}
return hex;
}
}

View File

@ -18,12 +18,14 @@ import ctbrec.io.HtmlParser;
import ctbrec.io.HttpClient;
import ctbrec.io.HttpException;
import ctbrec.sites.AbstractSite;
import okhttp3.HttpUrl;
import okhttp3.Request;
import okhttp3.Response;
public class LiveJasmin extends AbstractSite {
public static final String BASE_URL = "https://www.livejasmin.com";
public static String baseUrl = "";
public static String baseDomain = "";
private HttpClient httpClient;
@Override
@ -33,12 +35,13 @@ public class LiveJasmin extends AbstractSite {
@Override
public String getBaseUrl() {
return BASE_URL;
return baseUrl;
}
@Override
public String getAffiliateLink() {
return "https://awejmp.com/?siteId=jasmin&categoryName=girl&pageName=listpage&performerName=&prm[psid]=0xb00bface&prm[pstool]=205_1&prm[psprogram]=pps&prm[campaign_id]=&subAffId={SUBAFFID}&filters=";
return "https://awejmp.com/?siteId=jasmin&categoryName=girl&pageName=listpage&performerName=&prm[psid]=0xb00bface&prm[pstool]=205_1&prm[psprogram]=revs&prm[campaign_id]=&subAffId={SUBAFFID}&filters=";
// return "https://awejmp.com/?siteId=jasmin&categoryName=girl&pageName=listpage&performerName=&prm[psid]=0xb00bface&prm[pstool]=205_1&prm[psprogram]=pps&prm[campaign_id]=&subAffId={SUBAFFID}&filters=";
}
@Override
@ -53,22 +56,17 @@ public class LiveJasmin extends AbstractSite {
@Override
public Double getTokenBalance() throws IOException {
if(getLiveJasminHttpClient().login()) {
if (getLiveJasminHttpClient().login()) {
String sessionId = getLiveJasminHttpClient().getSessionId();
String url = getBaseUrl() + "/en/offline-surprise/get-member-balance?session=" + sessionId;
Request request = new Request.Builder()
.url(url)
.addHeader("User-Agent", Config.getInstance().getSettings().httpUserAgent)
.addHeader("Accept", "*/*")
.addHeader("Accept-Language", "en")
.addHeader("Referer", getBaseUrl())
.addHeader("X-Requested-With", "XMLHttpRequest")
.build();
Request request = new Request.Builder().url(url).addHeader("User-Agent", Config.getInstance().getSettings().httpUserAgent)
.addHeader("Accept", "*/*").addHeader("Accept-Language", "en").addHeader("Referer", getBaseUrl())
.addHeader("X-Requested-With", "XMLHttpRequest").build();
try (Response response = getHttpClient().execute(request)) {
if(response.isSuccessful()) {
if (response.isSuccessful()) {
String body = response.body().string();
JSONObject json = new JSONObject(body);
if(json.optBoolean("success")) {
if (json.optBoolean("success")) {
return json.optDouble("result");
} else {
throw new IOException("Response was not successful: " + url + "\n" + body);
@ -102,6 +100,9 @@ public class LiveJasmin extends AbstractSite {
@Override
public void init() throws IOException {
baseUrl = Config.getInstance().getSettings().livejasminBaseUrl;
HttpUrl url = HttpUrl.parse(baseUrl);
baseDomain = url.topPrivateDomain();
}
@Override
@ -131,19 +132,13 @@ public class LiveJasmin extends AbstractSite {
String query = URLEncoder.encode(q, "utf-8");
long ts = System.currentTimeMillis();
String url = getBaseUrl() + "/en/auto-suggest-search/auto-suggest?category=girls&searchText=" + query + "&_dc=" + ts + "&appletType=html5";
Request request = new Request.Builder()
.url(url)
.addHeader("User-Agent", Config.getInstance().getSettings().httpUserAgent)
.addHeader("Accept", "*/*")
.addHeader("Accept-Language", "en")
.addHeader("Referer", getBaseUrl())
.addHeader("X-Requested-With", "XMLHttpRequest")
.build();
Request request = new Request.Builder().url(url).addHeader("User-Agent", Config.getInstance().getSettings().httpUserAgent).addHeader("Accept", "*/*")
.addHeader("Accept-Language", "en").addHeader("Referer", getBaseUrl()).addHeader("X-Requested-With", "XMLHttpRequest").build();
try (Response response = getHttpClient().execute(request)) {
if (response.isSuccessful()) {
String body = response.body().string();
JSONObject json = new JSONObject(body);
if(json.optBoolean("success")) {
if (json.optBoolean("success")) {
List<Model> models = new ArrayList<>();
JSONObject data = json.getJSONObject("data");
String html = data.getString("content");
@ -155,7 +150,7 @@ public class LiveJasmin extends AbstractSite {
Element pic = HtmlParser.getTag(itemHtml, "span.pic i");
String style = pic.attr("style");
Matcher m = Pattern.compile("url\\('(.*?)'\\)").matcher(style);
if(m.find()) {
if (m.find()) {
model.setPreview(m.group(1));
}
models.add(model);

View File

@ -141,7 +141,7 @@ public class LiveJasminChunkedHttpDownload implements Download {
Request request = new Request.Builder()
.url("https://" + relayHost + "/?random=" + newClientInstanceId())
.header("Origin", "https://www.livejasmin.com")
.header("Origin", LiveJasmin.baseUrl)
.header("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0")
.header("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
.header("Accept-Language", "de,en-US;q=0.7,en;q=0.3")
@ -154,7 +154,7 @@ public class LiveJasminChunkedHttpDownload implements Download {
+ "\",\"connectionData\":{\"jasmin2App\":true,\"isMobileClient\":false,\"platform\":\"desktop\",\"chatID\":\"freechat\","
+ "\"sessionID\":\"" + sessionId + "\"," + "\"jsm2SessionId\":\"" + jsm2SessionId + "\",\"userType\":\"user\"," + "\"performerId\":\""
+ model
+ "\",\"clientRevision\":\"\",\"proxyIP\":\"\",\"playerVer\":\"nanoPlayerVersion: 3.10.3 appCodeName: Mozilla appName: Netscape appVersion: 5.0 (X11) platform: Linux x86_64\",\"livejasminTvmember\":false,\"newApplet\":true,\"livefeedtype\":null,\"gravityCookieId\":\"\",\"passparam\":\"\",\"brandID\":\"jasmin\",\"cobrandId\":\"\",\"subbrand\":\"livejasmin\",\"siteName\":\"LiveJasmin\",\"siteUrl\":\"https://www.livejasmin.com\","
+ "\",\"clientRevision\":\"\",\"proxyIP\":\"\",\"playerVer\":\"nanoPlayerVersion: 3.10.3 appCodeName: Mozilla appName: Netscape appVersion: 5.0 (X11) platform: Linux x86_64\",\"livejasminTvmember\":false,\"newApplet\":true,\"livefeedtype\":null,\"gravityCookieId\":\"\",\"passparam\":\"\",\"brandID\":\"jasmin\",\"cobrandId\":\"\",\"subbrand\":\"livejasmin\",\"siteName\":\"LiveJasmin\",\"siteUrl\":\""+LiveJasmin.baseUrl+"\","
+ "\"clientInstanceId\":\"" + clientInstanceId + "\",\"armaVersion\":\"34.10.0\",\"isPassive\":false}}");
response.close();
}
@ -231,13 +231,13 @@ public class LiveJasminChunkedHttpDownload implements Download {
}
protected void getPerformerDetails(String name) throws IOException {
String url = "https://m.livejasmin.com/en/chat-html5/" + name;
String url = "https://m."+LiveJasmin.baseDomain+"/en/chat-html5/" + name;
Request req = new Request.Builder()
.url(url)
.header("User-Agent", USER_AGENT)
.header("Accept", "application/json,*/*")
.header("Accept-Language", "en")
.header("Referer", "https://www.livejasmin.com")
.header("Referer", LiveJasmin.baseUrl)
.header("X-Requested-With", "XMLHttpRequest")
.build();
try (Response response = client.execute(req)) {

View File

@ -44,13 +44,13 @@ public class LiveJasminHttpClient extends HttpClient {
.followSslRedirects(false)
.build();
String url = "https://m.livejasmin.com/en/member/favourite/get-favourite-list?ajax=1";
String url = "https://m." + LiveJasmin.baseDomain + "/en/member/favourite/get-favourite-list?ajax=1";
Request request = new Request.Builder()
.url(url)
.addHeader("User-Agent", Config.getInstance().getSettings().httpUserAgentMobile)
.addHeader("Accept", "application/json, text/javascript, */*")
.addHeader("Accept-Language", "en")
.addHeader("Referer", LiveJasmin.BASE_URL)
.addHeader("Referer", LiveJasmin.baseUrl)
.addHeader("X-Requested-With", "XMLHttpRequest")
.build();
try(Response response = temp.newCall(request).execute()) {
@ -64,7 +64,7 @@ public class LiveJasminHttpClient extends HttpClient {
}
public String getSessionId() {
Cookie sessionCookie = getCookieJar().getCookie(HttpUrl.parse(LiveJasmin.BASE_URL), "session");
Cookie sessionCookie = getCookieJar().getCookie(HttpUrl.parse(LiveJasmin.baseUrl), "session");
if(sessionCookie != null) {
return sessionCookie.value();
} else {

View File

@ -5,6 +5,7 @@ import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import java.util.concurrent.ExecutionException;
import org.json.JSONObject;
@ -26,6 +27,7 @@ import com.squareup.moshi.JsonWriter;
import ctbrec.AbstractModel;
import ctbrec.Config;
import ctbrec.StringUtil;
import ctbrec.io.HttpException;
import ctbrec.recorder.download.Download;
import ctbrec.recorder.download.StreamSource;
@ -48,7 +50,7 @@ public class LiveJasminModel extends AbstractModel {
}
protected void loadModelInfo() throws IOException {
String url = "https://m.livejasmin.com/en/chat-html5/" + getName();
String url = "https://m." + LiveJasmin.baseDomain + "/en/chat-html5/" + getName();
Request req = new Request.Builder().url(url).header("User-Agent",
"Mozilla/5.0 (iPhone; CPU OS 10_14 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.1 Mobile/14E304 Safari/605.1.15")
.header("Accept", "application/json,*/*")
@ -148,23 +150,31 @@ public class LiveJasminModel extends AbstractModel {
private String getMasterPlaylistUrl() throws IOException {
loadModelInfo();
String url = site.getBaseUrl() + "/en/stream/hls/free/" + getName();
//String url = site.getBaseUrl() + "/en/stream/hls/free/" + getName();
// generate a fake guest session ID
byte[] sessionIdRandom = new byte[16];
new Random().nextBytes(sessionIdRandom);
String sessionId = 'g' + StringUtil.toHexString(sessionIdRandom, 32);
String url = "https://api-gateway.dditsadn.com/v1/stream/performers/" + getName()
+ "/streams/free/formats/hls?brandId=jasmin&session=" + sessionId + "&streamName=stream_1280_720_2000";
LOG.debug("Getting master playlist URL from {}", url);
Request request = new Request.Builder()
.url(url)
.addHeader("User-Agent", Config.getInstance().getSettings().httpUserAgent)
.addHeader("User-Agent", Config.getInstance().getSettings().httpUserAgentMobile)
.addHeader("Accept", "application/json, text/javascript, */*")
.addHeader("Accept-Language", "en")
.addHeader("Referer", site.getBaseUrl())
.addHeader("Referer", getUrl())
.addHeader("X-Requested-With", "XMLHttpRequest")
.build();
try (Response response = site.getHttpClient().execute(request)) {
if (response.isSuccessful()) {
String body = response.body().string();
JSONObject json = new JSONObject(body);
if (json.optBoolean("success")) {
if (json.has("data")) {
JSONObject data = json.getJSONObject("data");
JSONObject hlsStream = data.getJSONObject("hls_stream");
return hlsStream.getString("url");
return data.getString("url");
} else {
throw new IOException("Response was not successful: " + url + "\n" + body);
}

View File

@ -51,7 +51,7 @@ public class LiveJasminTippingWebSocket {
Request request = new Request.Builder()
.url("https://" + relayHost + "/")
.header("Origin", "https://www.livejasmin.com")
.header("Origin", LiveJasmin.baseUrl)
.header("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0")
.header("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
.header("Accept-Language", "de,en-US;q=0.7,en;q=0.3")
@ -65,7 +65,7 @@ public class LiveJasminTippingWebSocket {
+ "\",\"connectionData\":{\"jasmin2App\":true,\"isMobileClient\":false,\"platform\":\"desktop\",\"chatID\":\"freechat\","
+ "\"sessionID\":\"" + sessionId + "\"," + "\"jsm2SessionId\":\"" + jsm2SessionId + "\",\"userType\":\"user\"," + "\"performerId\":\""
+ model
+ "\",\"clientRevision\":\"\",\"proxyIP\":\"\",\"playerVer\":\"nanoPlayerVersion: 3.10.3 appCodeName: Mozilla appName: Netscape appVersion: 5.0 (X11) platform: Linux x86_64\",\"livejasminTvmember\":false,\"newApplet\":true,\"livefeedtype\":null,\"gravityCookieId\":\"\",\"passparam\":\"\",\"brandID\":\"jasmin\",\"cobrandId\":\"\",\"subbrand\":\"livejasmin\",\"siteName\":\"LiveJasmin\",\"siteUrl\":\"https://www.livejasmin.com\","
+ "\",\"clientRevision\":\"\",\"proxyIP\":\"\",\"playerVer\":\"nanoPlayerVersion: 3.10.3 appCodeName: Mozilla appName: Netscape appVersion: 5.0 (X11) platform: Linux x86_64\",\"livejasminTvmember\":false,\"newApplet\":true,\"livefeedtype\":null,\"gravityCookieId\":\"\",\"passparam\":\"\",\"brandID\":\"jasmin\",\"cobrandId\":\"\",\"subbrand\":\"livejasmin\",\"siteName\":\"LiveJasmin\",\"siteUrl\":\""+LiveJasmin.baseUrl+"\","
+ "\"clientInstanceId\":\"" + clientInstanceId + "\",\"armaVersion\":\"34.10.0\",\"isPassive\":false}}");
response.close();
}
@ -136,13 +136,13 @@ public class LiveJasminTippingWebSocket {
}
protected void getPerformerDetails(String name) throws IOException {
String url = "https://m.livejasmin.com/en/chat-html5/" + name;
String url = "https://m." + LiveJasmin.baseDomain + "/en/chat-html5/" + name;
Request req = new Request.Builder()
.url(url)
.header("User-Agent", "Mozilla/5.0 (iPhone; CPU OS 10_14 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.1 Mobile/14E304 Safari/605.1.15")
.header("Accept", "application/json,*/*")
.header("Accept-Language", "en")
.header("Referer", "https://www.livejasmin.com")
.header("Referer", LiveJasmin.baseUrl)
.header("X-Requested-With", "XMLHttpRequest")
.build();
try (Response response = client.execute(req)) {

View File

@ -76,7 +76,7 @@ public class LiveJasminWebSocketDownload implements Download {
Request request = new Request.Builder()
.url("https://" + relayHost + "/")
.header("Origin", "https://www.livejasmin.com")
.header("Origin", LiveJasmin.baseUrl)
.header("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0")
.header("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
.header("Accept-Language", "de,en-US;q=0.7,en;q=0.3")
@ -91,7 +91,7 @@ public class LiveJasminWebSocketDownload implements Download {
+ "\",\"connectionData\":{\"jasmin2App\":true,\"isMobileClient\":false,\"platform\":\"desktop\",\"chatID\":\"freechat\","
+ "\"sessionID\":\"" + sessionId + "\"," + "\"jsm2SessionId\":\"" + jsm2SessionId + "\",\"userType\":\"user\"," + "\"performerId\":\""
+ model
+ "\",\"clientRevision\":\"\",\"proxyIP\":\"\",\"playerVer\":\"nanoPlayerVersion: 3.10.3 appCodeName: Mozilla appName: Netscape appVersion: 5.0 (X11) platform: Linux x86_64\",\"livejasminTvmember\":false,\"newApplet\":true,\"livefeedtype\":null,\"gravityCookieId\":\"\",\"passparam\":\"\",\"brandID\":\"jasmin\",\"cobrandId\":\"\",\"subbrand\":\"livejasmin\",\"siteName\":\"LiveJasmin\",\"siteUrl\":\"https://www.livejasmin.com\","
+ "\",\"clientRevision\":\"\",\"proxyIP\":\"\",\"playerVer\":\"nanoPlayerVersion: 3.10.3 appCodeName: Mozilla appName: Netscape appVersion: 5.0 (X11) platform: Linux x86_64\",\"livejasminTvmember\":false,\"newApplet\":true,\"livefeedtype\":null,\"gravityCookieId\":\"\",\"passparam\":\"\",\"brandID\":\"jasmin\",\"cobrandId\":\"\",\"subbrand\":\"livejasmin\",\"siteName\":\"LiveJasmin\",\"siteUrl\":\""+LiveJasmin.baseUrl+"\","
+ "\"clientInstanceId\":\"" + clientInstanceId + "\",\"armaVersion\":\"34.10.0\",\"isPassive\":false}}");
response.close();
}
@ -218,13 +218,13 @@ public class LiveJasminWebSocketDownload implements Download {
}
protected void getPerformerDetails(String name) throws IOException {
String url = "https://m.livejasmin.com/en/chat-html5/" + name;
String url = "https://m." + LiveJasmin.baseDomain + "/en/chat-html5/" + name;
Request req = new Request.Builder()
.url(url)
.header("User-Agent", "Mozilla/5.0 (iPhone; CPU OS 10_14 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.1 Mobile/14E304 Safari/605.1.15")
.header("Accept", "application/json,*/*")
.header("Accept-Language", "en")
.header("Referer", "https://www.livejasmin.com")
.header("Referer", LiveJasmin.baseUrl)
.header("X-Requested-With", "XMLHttpRequest")
.build();
try (Response response = client.execute(req)) {
@ -260,7 +260,9 @@ public class LiveJasminWebSocketDownload implements Download {
LOG.trace(rtmpUrl);
LOG.trace(url);
Request request = new Request.Builder().url(url).header("Origin", "https://www.livejasmin.com")
Request request = new Request.Builder()
.url(url)
.header("Origin", LiveJasmin.baseUrl)
.header("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0")
.header("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8").header("Accept-Language", "de,en-US;q=0.7,en;q=0.3")
.build();

View File

@ -118,19 +118,19 @@
</script>
<div class="row text-center">
<div class="col">
<a class="btn btn-xl btn-outline-dark" href="#donate" onclick="downloadFile('https://github.com/0xboobface/ctbrec/releases/download/1.16.0/ctbrec-1.16.0-win64-jre.zip');">
<a class="btn btn-xl btn-outline-dark" href="#donate" onclick="downloadFile('https://github.com/0xboobface/ctbrec/releases/download/1.17.0/ctbrec-1.17.0-win64-jre.zip');">
<i class="fa fa-windows mr-2"></i>
Download for Windows!
</a>
</div>
<div class="col">
<a class="btn btn-xl btn-outline-dark" href="#donate" onclick="downloadFile('https://github.com/0xboobface/ctbrec/releases/download/1.16.0/ctbrec-1.16.0-macos-jre.zip');">
<a class="btn btn-xl btn-outline-dark" href="#donate" onclick="downloadFile('https://github.com/0xboobface/ctbrec/releases/download/1.17.0/ctbrec-1.17.0-macos-jre.zip');">
<i class="fa fa-apple mr-2"></i>
Download for macOS!
</a>
</div>
<div class="col">
<a class="btn btn-xl btn-outline-dark" href="#donate" onclick="downloadFile('https://github.com/0xboobface/ctbrec/releases/download/1.16.0/ctbrec-1.16.0-linux-jre.zip');">
<a class="btn btn-xl btn-outline-dark" href="#donate" onclick="downloadFile('https://github.com/0xboobface/ctbrec/releases/download/1.17.0/ctbrec-1.17.0-linux-jre.zip');">
<i class="fa fa-linux mr-2"></i>
Download for Linux!
</a>

View File

@ -6,7 +6,7 @@
<groupId>ctbrec</groupId>
<artifactId>master</artifactId>
<packaging>pom</packaging>
<version>1.17.0</version>
<version>1.17.1</version>
<modules>
<module>../common</module>

View File

@ -8,7 +8,7 @@
<parent>
<groupId>ctbrec</groupId>
<artifactId>master</artifactId>
<version>1.17.0</version>
<version>1.17.1</version>
<relativePath>../master</relativePath>
</parent>

View File

@ -68,13 +68,13 @@ public class HttpServer {
LOG.info("HMAC authentication is enabled");
}
recorder = new LocalRecorder(config);
OnlineMonitor monitor = new OnlineMonitor(recorder);
monitor.start();
for (Site site : sites) {
if(site.isEnabled()) {
site.init();
}
}
OnlineMonitor monitor = new OnlineMonitor(recorder);
monitor.start();
startHttpServer();
}