forked from j62/ctbrec
Merge branch 'dev'
This commit is contained in:
commit
80f4e53ed2
|
@ -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
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -132,6 +132,7 @@ public class ExternalBrowser implements AutoCloseable {
|
|||
BufferedReader br = new BufferedReader(new InputStreamReader(in));
|
||||
String line;
|
||||
while( !Thread.interrupted() && (line = br.readLine()) != null ) {
|
||||
LOG.debug("Browser output: {}", line);
|
||||
if(!line.startsWith("{")) {
|
||||
System.err.println(line);
|
||||
} else {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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/")) {
|
||||
|
|
|
@ -38,9 +38,13 @@ public class LiveJasminFollowedUpdateService extends PaginatedScheduledService {
|
|||
return new Task<List<Model>>() {
|
||||
@Override
|
||||
public List<Model> call() throws IOException {
|
||||
if(!liveJasmin.credentialsAvailable()) {
|
||||
throw new RuntimeException("Credentials missing");
|
||||
}
|
||||
|
||||
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);
|
||||
|
|
|
@ -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,7 +56,6 @@ public class LiveJasminTab extends ThumbOverviewTab {
|
|||
if(Config.getInstance().getSettings().livejasminBetaAcknowledged) {
|
||||
grid.getChildren().remove(status);
|
||||
grid.getChildren().remove(acknowledge);
|
||||
grid.getChildren().remove(createAccount);
|
||||
super.onSuccess();
|
||||
}
|
||||
}
|
||||
|
@ -72,9 +63,8 @@ public class LiveJasminTab extends ThumbOverviewTab {
|
|||
@Override
|
||||
protected void onFail(WorkerStateEvent event) {
|
||||
if(Config.getInstance().getSettings().livejasminBetaAcknowledged) {
|
||||
status.setText("Login failed");
|
||||
status.setText("Error");
|
||||
grid.getChildren().remove(acknowledge);
|
||||
grid.getChildren().remove(createAccount);
|
||||
super.onFail(event);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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(!liveJasmin.credentialsAvailable() || !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)) {
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
package ctbrec.ui.sites.jasmin;
|
||||
|
||||
public class NotLoggedInExcetion extends Exception {
|
||||
|
||||
}
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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 = "";
|
||||
|
@ -103,4 +104,5 @@ public class Settings {
|
|||
public String recordingsSortColumn = "";
|
||||
public String recordingsSortType = "";
|
||||
public double[] recordingsColumnWidths = new double[0];
|
||||
public boolean generatePlaylist = true;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public class CookieJarImpl implements CookieJar {
|
|||
String name = oldCookie.name();
|
||||
for (Cookie newCookie : cookies) {
|
||||
if(newCookie.name().equalsIgnoreCase(name)) {
|
||||
LOG.debug("Replacing cookie {} {} -> {} [{}]", oldCookie.name(), oldCookie.value(), newCookie.value(), oldCookie.domain());
|
||||
LOG.trace("Replacing cookie {} {} -> {} [{}]", oldCookie.name(), oldCookie.value(), newCookie.value(), oldCookie.domain());
|
||||
iterator.remove();
|
||||
break;
|
||||
}
|
||||
|
@ -42,11 +42,11 @@ public class CookieJarImpl implements CookieJar {
|
|||
}
|
||||
cookiesForUrl.addAll(cookies);
|
||||
cookieStore.put(host, cookiesForUrl);
|
||||
LOG.debug("Adding cookie: {} for {}", cookiesForUrl, host);
|
||||
LOG.trace("Adding cookie: {} for {}", cookiesForUrl, host);
|
||||
}
|
||||
else {
|
||||
cookieStore.put(host, cookies);
|
||||
LOG.debug("Storing cookie: {} for {}", cookies, host);
|
||||
LOG.trace("Storing cookie: {} for {}", cookies, host);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,9 +54,9 @@ public class CookieJarImpl implements CookieJar {
|
|||
public List<Cookie> loadForRequest(HttpUrl url) {
|
||||
String host = getDomain(url);
|
||||
List<Cookie> cookies = cookieStore.get(host);
|
||||
LOG.debug("Cookies for {}", url);
|
||||
LOG.trace("Cookies for {}", url);
|
||||
Optional.ofNullable(cookies).ifPresent(cookiez -> cookiez.forEach(c -> {
|
||||
LOG.debug(" {} expires on:{}", c, c.expiresAt());
|
||||
LOG.trace(" {} expires on:{}", c, c.expiresAt());
|
||||
}));
|
||||
//LOG.debug("Cookies for {}: {}", url.host(), cookies);
|
||||
return cookies != null ? cookies : new ArrayList<Cookie>();
|
||||
|
@ -72,6 +72,19 @@ public class CookieJarImpl implements CookieJar {
|
|||
throw new NoSuchElementException("No cookie named " + name + " for " + url.host() + " available");
|
||||
}
|
||||
|
||||
public void deleteCookie(HttpUrl url, String name) {
|
||||
List<Cookie> cookies = loadForRequest(url);
|
||||
for (Iterator<Cookie> iterator = cookies.iterator(); iterator.hasNext();) {
|
||||
Cookie cookie = iterator.next();
|
||||
if(Objects.equals(cookie.name(), name)) {
|
||||
iterator.remove();
|
||||
LOG.debug("Removed cookie \"{}\" for {}", name, url.toString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new NoSuchElementException("No cookie named " + name + " for " + url.host() + " available");
|
||||
}
|
||||
|
||||
private String getDomain(HttpUrl url) {
|
||||
// String host = url.host();
|
||||
// if (host.startsWith("www.")) {
|
||||
|
|
|
@ -398,6 +398,10 @@ public class LocalRecorder implements Recorder {
|
|||
}
|
||||
|
||||
private void generatePlaylist(File recDir) {
|
||||
if(!config.getSettings().generatePlaylist) {
|
||||
return;
|
||||
}
|
||||
|
||||
PlaylistGenerator playlistGenerator = new PlaylistGenerator();
|
||||
playlistGenerators.put(recDir, playlistGenerator);
|
||||
try {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -20,6 +20,12 @@ public class LiveJasminHttpClient extends HttpClient {
|
|||
|
||||
protected LiveJasminHttpClient() {
|
||||
super("livejasmin");
|
||||
|
||||
// delete all cookies, if we are guests, because old guest sessions cause
|
||||
// endless redirects
|
||||
if(Config.getInstance().getSettings().livejasminUsername.isEmpty()) {
|
||||
getCookieJar().clear();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -44,13 +50,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 +70,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 {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue