Implement "add by name" and "add by url"

This commit is contained in:
0xboobface 2019-04-15 16:39:09 +02:00
parent f1d11c07b5
commit 94460d1e94
2 changed files with 13 additions and 6 deletions

View File

@ -171,12 +171,18 @@ public class Flirt4Free extends AbstractSite {
@Override @Override
public Model createModelFromUrl(String url) { public Model createModelFromUrl(String url) {
Matcher m = Pattern.compile("https?://(?:www\\.)?camsoda.com/([^/]*?)/?").matcher(url); String[] patterns = {
if(m.matches()) { "https?://(?:www\\.)?flirt4free.com/\\?model=(.*?)",
String modelName = m.group(1); "https?://(?:www\\.)?flirt4free.com/rooms/(.*?)/?",
return createModel(modelName); "https?://(?:www\\.)?flirt4free.com/models/bios/(.*?)/about.php"
} else { };
return super.createModelFromUrl(url); for (String p : patterns) {
Matcher m = Pattern.compile(p).matcher(url);
if(m.matches()) {
String modelName = m.group(1);
return createModel(modelName);
}
} }
return super.createModelFromUrl(url);
} }
} }

View File

@ -64,6 +64,7 @@ public class Flirt4FreeModel extends AbstractModel {
if(response.isSuccessful()) { if(response.isSuccessful()) {
JSONObject json = new JSONObject(response.body().string()); JSONObject json = new JSONObject(response.body().string());
online = Objects.equals(json.optString("status"), "online"); online = Objects.equals(json.optString("status"), "online");
id = json.getString("model_id");
if(online) { if(online) {
try { try {
loadStreamUrl(); loadStreamUrl();