Fix CheckURL for SC (WinkRU)

This commit is contained in:
Jafea7 2025-09-27 16:05:20 +10:00
parent fa609157c5
commit 7409bb8fa9
2 changed files with 28 additions and 22 deletions

View File

@ -6,7 +6,7 @@ import com.iheartradio.m3u8.data.MasterPlaylist;
import com.iheartradio.m3u8.data.Playlist; import com.iheartradio.m3u8.data.Playlist;
import com.iheartradio.m3u8.data.PlaylistData; import com.iheartradio.m3u8.data.PlaylistData;
import ctbrec.AbstractModel; import ctbrec.AbstractModel;
// import ctbrec.Config; import ctbrec.Config;
import ctbrec.StringUtil; import ctbrec.StringUtil;
import ctbrec.io.HttpException; import ctbrec.io.HttpException;
import ctbrec.io.json.ObjectMapperFactory; import ctbrec.io.json.ObjectMapperFactory;
@ -383,21 +383,23 @@ public class ChaturbateModel extends AbstractModel {
@Override @Override
public boolean exists() throws IOException { public boolean exists() throws IOException {
Request req = new Request.Builder() // @formatter:off Request req = new Request.Builder()
.url(getUrl()) .url(getUrl())
.header(USER_AGENT, site.getHttpClient().getEffectiveUserAgent()) .header("Accept", "*/*")
.header(ACCEPT_LANGUAGE, Locale.ENGLISH.getLanguage()) .header("Accept-Language", Locale.ENGLISH.getLanguage())
.build(); // @formatter:on .header("User-Agent", Config.getInstance().getSettings().httpUserAgent)
.header("Referer", getUrl())
.header("Origin", getSite().getBaseUrl())
.build();
try (Response response = getSite().getHttpClient().execute(req)) { try (Response response = getSite().getHttpClient().execute(req)) {
if (!response.isSuccessful() && response.code() == 404) { if (response.code() == 404) {
return false; return false;
} else {
String body = response.body().string();
boolean banned = body.contains("This room has been banned");
boolean deleted = body.contains("This account has been deleted");
boolean redirectedToRoot = Objects.equals("/", response.request().url().encodedPath());
return !(banned || deleted || redirectedToRoot);
} }
String body = response.body().string();
boolean banned = body.contains("This room has been banned");
boolean deleted = body.contains("This account has been deleted");
boolean redirectedToRoot = Objects.equals("/", response.request().url().encodedPath());
return !banned && !deleted && !redirectedToRoot;
} }
} }

View File

@ -426,17 +426,21 @@ public class StripchatModel extends AbstractModel {
@Override @Override
public boolean exists() throws IOException { public boolean exists() throws IOException {
JSONObject jsonResponse = getModelInfo(); try {
if (jsonResponse.optString("error").equals("Not Found")) { JSONObject jsonResponse = getModelInfo();
log.info("Model not found: {}", getName()); if (jsonResponse.has("user")) {
return false; JSONObject user = jsonResponse.getJSONObject("user").getJSONObject("user");
} if (isBanned(user)) {
if (jsonResponse.has("user")) { log.info("Model inactive or deleted: {}", getName());
JSONObject user = jsonResponse.getJSONObject("user"); return false;
if (isBanned(user)) { }
log.info("Model inactive or deleted: {}", getName()); }
} catch (HttpException e) {
if (e.getResponseCode() == 404) {
log.info("Model not found: {}", getName());
return false; return false;
} }
throw e;
} }
return true; return true;
} }