forked from j62/ctbrec
1
0
Fork 0

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 = {
"https?://(?:www\\.)?flirt4free.com/\\?model=(.*?)",
"https?://(?:www\\.)?flirt4free.com/rooms/(.*?)/?",
"https?://(?:www\\.)?flirt4free.com/models/bios/(.*?)/about.php"
};
for (String p : patterns) {
Matcher m = Pattern.compile(p).matcher(url);
if(m.matches()) { if(m.matches()) {
String modelName = m.group(1); String modelName = m.group(1);
return createModel(modelName); return createModel(modelName);
} else { }
}
return super.createModelFromUrl(url); 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();