-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnoIMGUI-Extractor.js
More file actions
72 lines (62 loc) · 2.09 KB
/
noIMGUI-Extractor.js
File metadata and controls
72 lines (62 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
(function () {
const seenUrls = new Set();
function logUrl(url) {
if (!/^https?:\/\/.+\.m3u8/.test(url)) return;
if (seenUrls.has(url)) return;
seenUrls.add(url);
window.chrome.webview.postMessage(url);
if (seenUrls.size === 1) {
navigator.clipboard.writeText(url).then(() => {
console.clear();
console.log(`✅ Przechwycono pierwszy .m3u8 URL i skopiowano do schowka:\n${url}`);
}).catch(() => {
console.log(`✅ Przechwycono pierwszy .m3u8 URL:\n${url}`);
});
} else {
console.log(`ℹ️ Przechwycono dodatkowy .m3u8 URL:\n${url}`);
}
}
// Hook fetch
const origFetch = window.fetch;
window.fetch = async function (...args) {
const url = args[0];
if (typeof url === 'string' && url.includes('.m3u8')) {
logUrl(url);
}
return origFetch.apply(this, args);
};
// Hook XHR
const origOpen = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function (method, url, ...rest) {
if (typeof url === 'string' && url.includes('.m3u8')) {
logUrl(url);
}
return origOpen.call(this, method, url, ...rest);
};
// Bypass user gesture
const simulateUserGesture = () => {
const videos = document.getElementsByTagName('video');
if (!videos.length) return false;
const video = videos[0];
const events = ['pointerdown', 'mousedown', 'mouseup', 'click', 'focus'];
for (const evtName of events) {
const evt = new Event(evtName, { bubbles: true, cancelable: true });
video.dispatchEvent(evt);
document.body.dispatchEvent(evt);
}
video.play().then(() => {
console.log('▶️ Video odtwarzane po symulowanym user gesture');
}).catch(err => {
console.warn('❌ Nie udało się wymusić play:', err);
});
return true;
};
const tryStart = () => {
if (simulateUserGesture()) return;
setTimeout(() => {
simulateUserGesture();
}, 2000);
};
tryStart();
console.log('👂 Nasłuchuję fetch/XHR w celu przechwycenia URL .m3u8');
})();