Skip to content

Commit

Permalink
Update m3u8.user.js
Browse files Browse the repository at this point in the history
  • Loading branch information
gunir committed Jan 31, 2024
1 parent d85b801 commit 77f3b8b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions userscript/m3u8.user.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name MPV-M3U8 Video Detector and Downloader
// @name:en MPV-M3U8 Video Detector and Downloader
// @version 1.5.1
// @version 1.5.2
// @description:en Automatically detect the m3u8 video of the page and download it completely. Once detected the m3u8 link, it will appear in the upper right corner of the page. Click download to jump to the m3u8 downloader.
// @icon https://tools.thatwind.com/favicon.png
// @author -
Expand Down Expand Up @@ -203,13 +203,14 @@
// if (checkUrl(args[0])) doM3U({ url: args[0] });
// return _fetch(...args);
// }
if (location.href.match(/^.*?socolive.*?$/)) {
var sfetch = unsafeWindow.fetch;
unsafeWindow.fetch = new Proxy(sfetch, {
apply: function(target, thisArg, args) {
console.log(target, thisArg, args);
let proceed = true;
try {
if (checkUrl(args[0])) doM3U({ url: args[0], content: args[0] });
if (args[0].indexOf(".flv") != -1) doM3U({ url: args[0], content: args[0] });
} catch(ex) {
console.log(ex);
}
Expand All @@ -218,6 +219,7 @@
: Promise.resolve(new Response());
}
});
}
const _r_text = unsafeWindow.Response.prototype.text;
unsafeWindow.Response.prototype.text = function () {
return new Promise((resolve, reject) => {
Expand All @@ -244,7 +246,7 @@

function checkUrl(url) {
url = new URL(url, location.href);
if (url.pathname.indexOf(".m3u8") != -1 || url.pathname.indexOf(".m3u") != -1 || url.pathname.indexOf(".mpd") != -1 || url.pathname.indexOf(".flv") != -1) {
if (url.pathname.indexOf(".m3u8") != -1 || url.pathname.indexOf(".m3u") != -1) {
// 发现
return true;
}
Expand Down

0 comments on commit 77f3b8b

Please sign in to comment.