()
| 466 | let shownUrls = []; |
| 467 | |
| 468 | function doVideos() { |
| 469 | for (let v of Array.from(document.querySelectorAll("video"))) { |
| 470 | if ( |
| 471 | v.duration && |
| 472 | v.src && |
| 473 | v.src.startsWith("http") && |
| 474 | !shownUrls.includes(v.src) |
| 475 | ) { |
| 476 | const src = v.src; |
| 477 | |
| 478 | shownUrls.push(src); |
| 479 | showVideo({ |
| 480 | type: "video", |
| 481 | url: new URL(src), |
| 482 | duration: `${Math.ceil((v.duration * 10) / 60) / 10} mins`, |
| 483 | download() { |
| 484 | const details = { |
| 485 | url: src, |
| 486 | name: (() => { |
| 487 | let name = new URL(src).pathname.split("/").slice(-1)[0]; |
| 488 | if (!/\.\w+$/.test(name)) { |
| 489 | if (name.match(/^\s*$/)) name = Date.now(); |
| 490 | name = name + ".mp4"; |
| 491 | } |
| 492 | return name; |
| 493 | })(), |
| 494 | headers: { |
| 495 | // referer: location.origin, // 不允许该头 |
| 496 | origin: location.origin, |
| 497 | }, |
| 498 | onerror(e) { |
| 499 | mgmapi.openInTab(src); |
| 500 | }, |
| 501 | }; |
| 502 | mgmapi.download(details); |
| 503 | }, |
| 504 | }); |
| 505 | } |
| 506 | } |
| 507 | } |
| 508 | |
| 509 | async function doM3U({ url, content }) { |
| 510 | url = new URL(url); |
nothing calls this directly
no test coverage detected