pull/59/head
okjackcaptain 4 years ago
parent 1469c78847
commit 3386a1e765
  1. 3
      app/src/main/java/com/github/tvbox/osc/ui/activity/PlayActivity.java
  2. 3
      app/src/main/java/com/github/tvbox/osc/ui/fragment/PlayFragment.java
  3. 9
      app/src/main/java/com/github/tvbox/osc/util/DefaultConfig.java

@ -585,8 +585,7 @@ public class PlayActivity extends BaseActivity {
String flag = info.optString("flag");
String url = info.getString("url");
HashMap<String, String> headers = null;
//web给个默认的UA
webUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.54 Safari/537.36";
webUserAgent = null;
webHeaderMap = null;
if (info.has("header")) {
try {

@ -583,8 +583,7 @@ public class PlayFragment extends BaseLazyFragment {
String flag = info.optString("flag");
String url = info.getString("url");
HashMap<String, String> headers = null;
//web给个默认的UA
webUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.54 Safari/537.36";
webUserAgent = null;
webHeaderMap = null;
if (info.has("header")) {
try {

@ -107,11 +107,18 @@ public class DefaultConfig {
//增加对flv|avi|mkv|rm|wmv|mpg等几种视频格式的支持
//private static final Pattern snifferMatch = Pattern.compile("http((?!http).){26,}?\\.(m3u8|mp4)\\?.*|http((?!http).){26,}\\.(m3u8|mp4)|http((?!http).){26,}?/m3u8\\?pt=m3u8.*|http((?!http).)*?default\\.ixigua\\.com/.*|http((?!http).)*?cdn-tos[^\\?]*|http((?!http).)*?/obj/tos[^\\?]*|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).)*?default\\.365yg\\.com/.*|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).)*?default\\.365yg\\.com/.*|http((?!http).){20,}?/m3u8\\?pt=m3u8.*|http((?!http).)*?default\\.ixigua\\.com/.*|http((?!http).)*?dycdn-tos\\.pstatp[^\\?]*|http.*?/player/m3u8play\\.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 normalSnifferMatch = Pattern.compile("http((?!http).){20,}?\\.(m3u8|mp4|flv|avi|mkv|rm|wmv|mpg)\\?.*|http((?!http).){20,}\\.(m3u8|mp4|flv|avi|mkv|rm|wmv|mpg)");
public static boolean isVideoFormat(String url) {
if (url.contains("=http") || url.contains("?http") || url.contains(".html")) {
return false;
}
if (normalSnifferMatch.matcher(url).find()) {
if (url.contains("cdn-tos") && (url.contains(".js") || url.contains(".css"))) {
return false;
}
return true;
}
if (snifferMatch.matcher(url).find()) {
if (url.contains("cdn-tos") && (url.contains(".js") || url.contains(".css"))) {
return false;

Loading…
Cancel
Save