|
|
|
|
@ -21,6 +21,7 @@ public class Sniffer { |
|
|
|
|
public static final Pattern RULE = Pattern.compile("http((?!http).){12,}?\\.(m3u8|mp4|flv|avi|mkv|rm|wmv|mpg|m4a|mp3)\\?.*|http((?!http).){12,}\\.(m3u8|mp4|flv|avi|mkv|rm|wmv|mpg|m4a|mp3)|http((?!http).)*?video/tos*"); |
|
|
|
|
public static final List<String> VIDEO = Arrays.asList("avi", "flv", "mkv", "mov", "mp4", "mpeg", "mpe", "mpg", "wmv"); |
|
|
|
|
public static final List<String> AUDIO = Arrays.asList("aac", "ape", "flac", "mp3", "m4a", "ogg"); |
|
|
|
|
public static final List<String> PUSH = Arrays.asList("http", "https", "smb", "ftp", "ed2k", "magnet", "thunder"); |
|
|
|
|
|
|
|
|
|
private static boolean matchOrContain(String url) { |
|
|
|
|
for (String regex : getRegex(Uri.parse(url))) return Pattern.compile(regex).matcher(url).find() || url.contains(regex); |
|
|
|
|
@ -36,6 +37,10 @@ public class Sniffer { |
|
|
|
|
return VIDEO.contains(ext) || AUDIO.contains(ext); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static boolean isPush(Uri uri) { |
|
|
|
|
return PUSH.contains(uri.getScheme()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static boolean isVideoFormat(String url) { |
|
|
|
|
return isVideoFormat(url, new HashMap<>()); |
|
|
|
|
} |
|
|
|
|
|