- 嗅探相关(by okjack)

pull/68/head
okjackcaptain 3 years ago
parent 05012f0b0a
commit f2cfb95640
  1. 23
      app/src/main/java/com/github/tvbox/osc/util/DefaultConfig.java

@ -131,11 +131,32 @@ public class DefaultConfig {
// return false;
// }
private static final Pattern snifferMatch = Pattern.compile("http((?!http).){20,}?\\.(m3u8|mp4|flv|avi|mkv|rm|wmv|mpg)\\?.*|http((?!http).){20,}\\.(m3u8|mp4|flv|avi|mkv|rm|wmv|mpg)|http((?!http).){20,}?/m3u8\\?pt=m3u8.*|http((?!http).)*?default\\.ixigua\\.com/.*|http((?!http).)*?dycdn-tos\\.pstatp[^\\?]*|http.*?/play.{0,3}\\?[^url]{2,8}=.*|http.*?/player/m3u8play\\.php\\?url=.*|http.*?/player/.*?[pP]lay\\.php\\?url=.*|http.*?/playlist/m3u8/\\?vid=.*|http.*?\\.php\\?type=m3u8&.*|http.*?/download.aspx\\?.*|http.*?/api/up_api.php\\?.*|https.*?\\.66yk\\.cn.*|http((?!http).)*?netease\\.com/file/.*");
private static final Pattern snifferMatch = Pattern.compile(
"http((?!http).){20,}?\\.(m3u8|mp4|flv|avi|mkv|rm|wmv|mpg)\\?.*|" +
"http((?!http).){20,}\\.(m3u8|mp4|flv|avi|mkv|rm|wmv|mpg)|" +
"http((?!http).){20,}?/m3u8\\?pt=m3u8.*|" +
"http((?!http).)*?default\\.ixigua\\.com/.*|" +
"http((?!http).)*?dycdn-tos\\.pstatp[^\\?]*|" +
"http.*?/player/m3u8play\\.php\\?url=.*|" +
"http.*?/player/.*?[pP]lay\\.php\\?url=.*|" +
"http.*?/playlist/m3u8/\\?vid=.*|http.*?\\.php\\?type=m3u8&.*|" +
"http.*?/download.aspx\\?.*|" +
"http.*?/api/up_api.php\\?.*|" +
"https.*?\\.66yk\\.cn.*|" +
"http((?!http).)*?netease\\.com/file/.*"
);
public static boolean isVideoFormat(String url) {
if (url.contains("=http") || url.contains(".html")) {
return false;
}
Uri uri = Uri.parse(url);
String path = uri.getPath();
if (TextUtils.isEmpty(path)) {
return false;
}
if (path.endsWith(".js") || path.endsWith(".css") || path.endsWith(".html")) {
return false;
}
if (snifferMatch.matcher(url).find()) return true;
return false;
}

Loading…
Cancel
Save