-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImGUI-Extractor.js
More file actions
282 lines (260 loc) · 8.2 KB
/
ImGUI-Extractor.js
File metadata and controls
282 lines (260 loc) · 8.2 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
(function () {
const fontLink = document.createElement('link');
fontLink.href = 'https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600&display=swap';
fontLink.rel = 'stylesheet';
document.head.appendChild(fontLink);
const style = document.createElement('style');
style.textContent = `
#m3u8-catcher-panel {
position: fixed;
bottom: 30px;
right: 30px;
width: 480px;
height: 500px;
background: rgba(25, 35, 45, 0.35);
border-radius: 24px;
backdrop-filter: blur(18px);
-webkit-backdrop-filter: blur(18px);
border: 1.8px solid rgba(0, 255, 255, 0.25);
box-shadow:
0 8px 32px 0 rgba(0, 255, 255, 0.2),
inset 0 0 12px rgba(0, 255, 255, 0.15);
display: flex;
flex-direction: column;
font-family: 'Montserrat', sans-serif;
color: #a0f0ff;
user-select: none;
z-index: 9999999;
}
#m3u8-catcher-panel header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 22px 28px;
border-bottom: 1px solid rgba(0, 255, 255, 0.15);
font-weight: 600;
font-size: 22px;
color: #00ffffcc;
text-shadow: 0 0 14px #00ffffaa;
user-select: text;
}
#m3u8-catcher-panel header #close-btn {
cursor: pointer;
font-weight: 700;
font-size: 26px;
color: #00ffffcc;
transition: color 0.3s ease;
user-select: none;
}
#m3u8-catcher-panel header #close-btn:hover {
color: #00ffff;
text-shadow: 0 0 20px #00ffff;
}
#m3u8-urls-list {
flex-grow: 1;
overflow-y: auto;
padding: 20px 28px;
scrollbar-width: thin;
scrollbar-color: #00ffff44 transparent;
user-select: text;
}
#m3u8-urls-list::-webkit-scrollbar {
width: 10px;
}
#m3u8-urls-list::-webkit-scrollbar-track {
background: transparent;
border-radius: 6px;
}
#m3u8-urls-list::-webkit-scrollbar-thumb {
background-color: #00ffff44;
border-radius: 6px;
}
.url-entry {
background: rgba(0, 255, 255, 0.08);
border-radius: 14px;
padding: 14px 20px;
margin-bottom: 16px;
box-shadow: 0 0 12px 1px rgba(0, 255, 255, 0.2);
cursor: pointer;
transition: background 0.3s ease, box-shadow 0.3s ease;
display: flex;
flex-direction: column;
user-select: text;
position: relative;
}
.url-entry:hover {
background: rgba(0, 255, 255, 0.15);
box-shadow:
0 0 20px 3px rgba(0, 255, 255, 0.6);
}
.url-title {
font-weight: 600;
font-size: 15px;
color: #7effffcc;
margin-bottom: 6px;
text-shadow: 0 0 6px rgba(0, 255, 255, 0.7);
user-select: text;
}
.url-link {
font-size: 13px;
color: #a0f0ffcc;
word-break: break-all;
user-select: text;
}
.copy-btn {
position: absolute;
top: 14px;
right: 20px;
background: rgba(0, 255, 255, 0.12);
border-radius: 50%;
width: 26px;
height: 26px;
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
color: #00ffffcc;
cursor: pointer;
transition: background 0.3s ease, color 0.3s ease;
user-select: none;
box-shadow: 0 0 8px rgba(0, 255, 255, 0.25);
}
.copy-btn:hover {
background: rgba(0, 255, 255, 0.3);
color: #00ffff;
box-shadow:
0 0 12px 3px #00ffffcc,
0 0 18px 6px #00ffff88;
}
.tooltip {
position: fixed;
background: #00ffffdd;
color: #003333;
padding: 4px 12px;
border-radius: 12px;
font-size: 12px;
font-weight: 700;
pointer-events: none;
opacity: 0;
transition: opacity 0.3s ease;
user-select: none;
white-space: nowrap;
z-index: 10000001;
box-shadow: 0 0 10px #00ffffbb;
}
.tooltip.visible {
opacity: 1;
}
`;
document.head.appendChild(style);
const panel = document.createElement('div');
panel.id = 'm3u8-catcher-panel';
panel.innerHTML = `
<header>
<div>🎬 Captured .m3u8 URLs</div>
<div id="close-btn" title="Close panel">×</div>
</header>
<div id="m3u8-urls-list" aria-live="polite" aria-relevant="additions"></div>
`;
document.body.appendChild(panel);
const closeBtn = panel.querySelector('#close-btn');
const urlsList = panel.querySelector('#m3u8-urls-list');
closeBtn.onclick = () => panel.remove();
let tooltip;
function showTooltip(text, x, y) {
if (!tooltip) {
tooltip = document.createElement('div');
tooltip.className = 'tooltip';
document.body.appendChild(tooltip);
}
tooltip.textContent = text;
tooltip.style.left = x + 'px';
tooltip.style.top = y + 'px';
tooltip.classList.add('visible');
setTimeout(() => tooltip.classList.remove('visible'), 1200);
}
const seenUrls = new Set();
const pageTitle = document.title.trim() || 'Unknown title';
function addUrl(url) {
if (!url || !/^https?:\/\/.+\.m3u8/.test(url)) return;
if (seenUrls.has(url)) return;
seenUrls.add(url);
const entry = document.createElement('div');
entry.className = 'url-entry';
const titleDiv = document.createElement('div');
titleDiv.className = 'url-title';
titleDiv.textContent = pageTitle;
const linkDiv = document.createElement('div');
linkDiv.className = 'url-link';
linkDiv.textContent = url;
const copyBtn = document.createElement('div');
copyBtn.className = 'copy-btn';
copyBtn.title = 'Copy to clipboard';
copyBtn.innerHTML = '📋';
copyBtn.onclick = (e) => {
e.stopPropagation();
navigator.clipboard.writeText(url).then(() => {
const rect = copyBtn.getBoundingClientRect();
showTooltip('Copied!', rect.left + rect.width / 2, rect.top - 28);
}).catch(() => alert('Failed to copy URL!'));
};
entry.appendChild(titleDiv);
entry.appendChild(linkDiv);
entry.appendChild(copyBtn);
entry.onclick = () => {
navigator.clipboard.writeText(url).then(() => {
const rect = entry.getBoundingClientRect();
showTooltip('Copied!', rect.left + rect.width / 2, rect.top - 28);
}).catch(() => alert('Failed to copy URL!'));
};
urlsList.appendChild(entry);
if (seenUrls.size === 1) {
console.clear();
console.log(`✅ First .m3u8 URL captured and copied:\n${url}`);
navigator.clipboard.writeText(url).catch(() => {});
} else {
console.log(`ℹ️ .m3u8 URL captured:\n${url}`);
}
}
if (!window._m3u8CatcherFetchHooked) {
window._m3u8CatcherFetchHooked = true;
const originalFetch = window.fetch;
window.fetch = async function (...args) {
const url = args[0];
if (typeof url === 'string' && url.includes('.m3u8')) {
addUrl(url);
}
return originalFetch.apply(this, args);
};
}
if (!window._m3u8CatcherXHRHooked) {
window._m3u8CatcherXHRHooked = true;
const originalOpen = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function (method, url, ...rest) {
if (typeof url === 'string' && url.includes('.m3u8')) {
addUrl(url);
}
return originalOpen.call(this, method, url, ...rest);
};
}
let autoplayAttempts = 0;
function tryAutoplay() {
if (autoplayAttempts > 1) return;
autoplayAttempts++;
const vids = document.getElementsByTagName('video');
if (!vids.length) return;
const video = vids[0];
['pointerdown', 'mousedown', 'mouseup', 'click', 'focus'].forEach(evtName => {
const evt = new Event(evtName, { bubbles: true, cancelable: true });
video.dispatchEvent(evt);
document.body.dispatchEvent(evt);
});
video.play().then(() => {
console.log('▶️ Video auto-played after user gesture simulation.');
}).catch(e => {
console.warn('❌ Auto-play failed:', e);
});
}
setTimeout(tryAutoplay, 1000);
setTimeout(tryAutoplay, 3000);
})();