diff --git a/common/src/main/java/ctbrec/io/HttpConstants.java b/common/src/main/java/ctbrec/io/HttpConstants.java
index ac46f8fa..62ab903c 100644
--- a/common/src/main/java/ctbrec/io/HttpConstants.java
+++ b/common/src/main/java/ctbrec/io/HttpConstants.java
@@ -6,6 +6,7 @@ public class HttpConstants {
public static final String ACCEPT_ENCODING = "Accept-Encoding";
public static final String ACCEPT_ENCODING_GZIP = "gzip";
public static final String ACCEPT_LANGUAGE = "Accept-Language";
+ public static final String AUTHORIZATION = "Authorization";
public static final String CACHE_CONTROL = "Cache-Control";
public static final String CONNECTION = "Connection";
public static final String CONTENT_ENCODING = "Content-Encoding";
@@ -25,5 +26,6 @@ public class HttpConstants {
public static final String X_XSRF_TOKEN = "X-XSRF-Token";
public static final String X_REQUESTED_WITH = "X-Requested-With";
- private HttpConstants() {}
+ private HttpConstants() {
+ }
}
diff --git a/common/src/main/java/ctbrec/sites/manyvids/MVLive.java b/common/src/main/java/ctbrec/sites/manyvids/MVLive.java
index dc2d8978..8d4a7dd9 100644
--- a/common/src/main/java/ctbrec/sites/manyvids/MVLive.java
+++ b/common/src/main/java/ctbrec/sites/manyvids/MVLive.java
@@ -34,10 +34,8 @@ public class MVLive extends AbstractSite {
public static final String BASE_URL = "https://www.manyvids.com";
public static final String LIVE_URL = BASE_URL + "/mv-live/";
private final Pattern configPattern = Pattern.compile("");
- private final Pattern graphQlUrlPattern = Pattern.compile("api:\\s*\"(https://.+?.appsync-api..+?.amazonaws.com/graphql)\",");
- private final Pattern graphQlApiKeyPattern = Pattern.compile("apiKey:\\s*\"(.*?)\"");
+ private final Pattern graphQlUrlPattern = Pattern.compile("api:\\s*\"(https://.+?.appsync-api..+?.amazonaws.com/graphql)\"");
private String graphqlBaseUri;
- private String apiKey;
private MVLiveHttpClient httpClient;
private String mvtoken;
@@ -149,12 +147,6 @@ public class MVLive extends AbstractSite {
Matcher m = graphQlUrlPattern.matcher(content);
if (m.find()) {
graphqlBaseUri = m.group(1);
- m = graphQlApiKeyPattern.matcher(content);
- if (m.find()) {
- apiKey = m.group(1);
- } else {
- throw new IllegalStateException("GraphQL API key not found");
- }
} else {
throw new IllegalStateException("GraphQL URL not found");
}
@@ -190,7 +182,34 @@ public class MVLive extends AbstractSite {
public List getModels() throws IOException {
String body = new JSONObject()
- .put("query", "query LanderLiveSessions($nextToken: String, $limit: Int, $country: String, $subdivision: String, $audience: String) { liveSessions( nextToken: $nextToken limit: $limit country: $country subdivision: $subdivision audience: $audience ) { presenters { id age avatarSrc city country name previewImgSrc starOfTheDay status sessionType streamingStartDate towerImgSrc profileHandle } nextToken }}")
+ .put("query", """
+ query LanderLiveSessions($nextToken: String, $limit: Int, $country: String, $subdivision: String, $audience: String) {
+ liveSessions(
+ nextToken: $nextToken
+ limit: $limit
+ country: $country
+ subdivision: $subdivision
+ audience: $audience
+ ) {
+ presenters {
+ id
+ age
+ avatarSrc
+ city
+ country
+ name
+ previewImgSrc
+ starOfTheDay
+ status
+ sessionType
+ streamingStartDate
+ towerImgSrc
+ profileHandle
+ }
+ nextToken
+ }
+ }
+ """)
.put("variables", new JSONObject()
.put("audience", "public")
.put("country", Locale.getDefault().getDisplayCountry(Locale.ENGLISH))
@@ -200,14 +219,7 @@ public class MVLive extends AbstractSite {
).toString(2);
RequestBody requestBody = RequestBody.Companion.create(body, MediaType.parse("application/json"));
- Request request = new Request.Builder()
- .url(getGraphQlUrl())
- .header(ACCEPT, "*/*")
- .header(ACCEPT_LANGUAGE, Locale.ENGLISH.getLanguage())
- .header(USER_AGENT, getConfig().getSettings().httpUserAgent)
- .header(ORIGIN, MVLive.BASE_URL)
- .header(REFERER, MVLive.BASE_URL)
- .header("x-api-key", apiKey)
+ Request request = newRequestBuilder()
.post(requestBody)
.build();
try (Response response = getHttpClient().execute(request)) {
@@ -345,5 +357,16 @@ public class MVLive extends AbstractSite {
return super.createModelFromUrl(url);
}
+ private Request.Builder newRequestBuilder() {
+ return new Request.Builder()
+ .url(getGraphQlUrl())
+ .header(ACCEPT, "*/*")
+ .header(ACCEPT_LANGUAGE, Locale.ENGLISH.getLanguage())
+ .header(USER_AGENT, getConfig().getSettings().httpUserAgent)
+ .header(ORIGIN, MVLive.BASE_URL)
+ .header(REFERER, MVLive.BASE_URL)
+ .header(AUTHORIZATION, "GUEST");
+ }
+
}