ow
This commit is contained in:
1 parent
ac0112b4a3
commit
90bb20e75f
24 files changed
+2722
No files matched your search
@@ -0,0 +1,60 @@
|
||||
// 点击"下载视频"时执行:读取当前 <video> 的播放源,并把嗅探到的候选地址一起返回给宿主。
|
||||
(function () {
|
||||
try {
|
||||
var vids = Array.prototype.slice.call(document.querySelectorAll("video"));
|
||||
var best = null;
|
||||
for (var i = 0; i < vids.length; i++) {
|
||||
var v = vids[i];
|
||||
if (v.videoWidth > 0 || !isNaN(v.duration)) {
|
||||
best = v;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!best) best = vids[0];
|
||||
|
||||
var current = "";
|
||||
var playable = true;
|
||||
if (best) {
|
||||
current = best.currentSrc || best.src || "";
|
||||
if (!current) {
|
||||
var s = best.querySelector && best.querySelector("source");
|
||||
if (s) current = s.src || s.getAttribute("src") || "";
|
||||
}
|
||||
if (best.networkState === 0 || (best.msKeySystemLoaded && !best.src))
|
||||
playable = false;
|
||||
}
|
||||
|
||||
var title = document.title || "";
|
||||
var h1 = document.querySelector("h1");
|
||||
if (h1 && h1.innerText) title = h1.innerText;
|
||||
|
||||
var anchors = [];
|
||||
var links = document.querySelectorAll("a[href]");
|
||||
for (var j = 0; j < links.length; j++) {
|
||||
var h = links[j].href;
|
||||
if (
|
||||
window.__reportMedia &&
|
||||
/\.(mp4|flv|m3u8|mov|mkv|webm|ts)(\?|#|$)/i.test(h)
|
||||
)
|
||||
anchors.push(h);
|
||||
}
|
||||
|
||||
return JSON.stringify({
|
||||
current: current || "",
|
||||
playable: playable,
|
||||
usesMse: !!window.__usesMse || /^blob:/i.test(current),
|
||||
title: title,
|
||||
pageUrl: location.href,
|
||||
sniffed: (window.__mediaUrls || []).slice(-60),
|
||||
anchors: anchors.slice(-20),
|
||||
m3u8Blobs: (window.__m3u8Blobs || []).slice(-1),
|
||||
});
|
||||
} catch (e) {
|
||||
return JSON.stringify({
|
||||
current: "",
|
||||
title: document.title || "",
|
||||
pageUrl: location.href,
|
||||
error: String(e),
|
||||
});
|
||||
}
|
||||
})();
|
||||
Reference in new issue
Block a user