Implement "add by name" and "add by url"
This commit is contained in:
parent
f1d11c07b5
commit
94460d1e94
|
@ -171,12 +171,18 @@ public class Flirt4Free extends AbstractSite {
|
|||
|
||||
@Override
|
||||
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()) {
|
||||
String modelName = m.group(1);
|
||||
return createModel(modelName);
|
||||
} else {
|
||||
}
|
||||
}
|
||||
return super.createModelFromUrl(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ public class Flirt4FreeModel extends AbstractModel {
|
|||
if(response.isSuccessful()) {
|
||||
JSONObject json = new JSONObject(response.body().string());
|
||||
online = Objects.equals(json.optString("status"), "online");
|
||||
id = json.getString("model_id");
|
||||
if(online) {
|
||||
try {
|
||||
loadStreamUrl();
|
||||
|
|
Loading…
Reference in New Issue