forked from j62/ctbrec
1
0
Fork 0

Add createModelFromUrl for MVLive

This commit is contained in:
0xb00bface 2020-08-18 20:25:05 +02:00
parent 096ed7a734
commit 335cdb8cb4
2 changed files with 18 additions and 8 deletions

View File

@ -6,6 +6,8 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
@ -240,4 +242,20 @@ public class MVLive extends AbstractSite {
} }
return result; return result;
} }
@Override
public Model createModelFromUrl(String url) {
Matcher m = Pattern.compile("https://live.manyvids.com/stream/(.*?)(?:/.*?)?").matcher(url.trim());
if(m.matches()) {
return createModel(m.group(1));
}
m = Pattern.compile("https://www.manyvids.com/MVLive/(.*?)/\\d+/?").matcher(url.trim());
if(m.matches()) {
return createModel(m.group(1));
}
return super.createModelFromUrl(url);
}
} }

View File

@ -32,14 +32,6 @@ public class MVLiveMergedHlsDownload extends MergedFfmpegHlsDownload {
return t; return t;
}); });
scheduler.scheduleAtFixedRate(() -> updateCloudFlareCookies(), 2, 2, TimeUnit.MINUTES); scheduler.scheduleAtFixedRate(() -> updateCloudFlareCookies(), 2, 2, TimeUnit.MINUTES);
try {
((MVLiveModel)getModel()).getRoomLocation();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
updateCloudFlareCookies(); updateCloudFlareCookies();
super.start(); super.start();
} finally { } finally {