From f2cfb956405cb764f64d83b0a99093c438576de7 Mon Sep 17 00:00:00 2001 From: okjackcaptain <378702538@qq.com> Date: Mon, 24 Oct 2022 18:39:29 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E5=97=85=E6=8E=A2=E7=9B=B8=E5=85=B3(by=20o?= =?UTF-8?q?kjack)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../github/tvbox/osc/util/DefaultConfig.java | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/github/tvbox/osc/util/DefaultConfig.java b/app/src/main/java/com/github/tvbox/osc/util/DefaultConfig.java index ee4273ee..bbf98b4b 100644 --- a/app/src/main/java/com/github/tvbox/osc/util/DefaultConfig.java +++ b/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; }