
功能介绍
简单快速提取当前页面或全部页面的M3U8链接
支持显示抓取结果,格式为:标题,链接
支持复制所有结果,格式为:标题,链接,可用于m3u8批量下载软件的模板
关键代码:
- // 抓取当前页面M3U8链接
- currentPageBtn.addEventListener('click', async () => {
- setStatus('正在抓取当前页面链接...', true);
- try {
- // 获取当前活动标签页
- const [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
- // 注入内容脚本并执行抓取
- const results = await chrome.scripting.executeScript({
- target: { tabId: tab.id },
- function: findM3U8Links
- });
- // 结果 显示时去重
- const m3u8Links = results[0].result;
- ...
- // 在页面中查找M3U8链接的函数
- function findM3U8Links() {
- const m3u8Links = new Set();
- // 查找所有可能的M3U8链接来源
- const sources = [
- // 1. 查找<script>标签中的M3U8链接
- ...Array.from(document.scripts).map(script => script.innerHTML),
- // 2. 查找JSON数据
- ...Array.from(document.querySelectorAll('*')).map(el => el.innerHTML),
- // 3. 查找视频标签
- ...Array.from(document.querySelectorAll('video source')).map(source => source.src),
- // 4. 查找所有链接
- ...Array.from(document.querySelectorAll('a')).map(a => a.href)
- ];
- // M3U8链接正则表达式
- const m3u8Regex = /https?:\/\/[^\s"']+\.m3u8(?:\?[^\s"']*)?/gi;
- // 在所有来源中搜索M3U8链接
- sources.forEach(source => {
- if (typeof source === 'string') {
- const matches = source.match(m3u8Regex);
- if (matches) {
- matches.forEach(match => m3u8Links.add(match));
- }
- }
- });
- ...
- THE END -
下载地址
同类软件
微信视频号下载助手工具wx_channel v5.0.0绿色版
更新时间: 2025-11-08
电脑定时锁屏软件V1.0
更新时间: 2025-11-08
土狗浏览器1.5支持添加各种插件内置多种组建
更新时间: 2025-11-08
视频去重电脑手机软件安卓版AI自动剪辑工具软件 推文过原创混剪
更新时间: 2025-11-08
微信视频号下载工具 v251130 中文绿色版
更新时间: 2025-11-08
R-Studio(电脑驱动级数据恢复软件)V9.5.191648破解版
更新时间: 2025-11-08
Prompt Optimizer v2.2.1:AI提示词优化工具
更新时间: 2025-11-08
Traktor Pro 4 v4.3.0.7 自动对拍 DJ打碟软件 WIN+MAC 混音/搓碟
更新时间: 2025-11-08
html图标生成器-文字转PNG和ICO
更新时间: 2025-11-08
视频号下载神器界面美观效果更强大支持智能识别分类
更新时间: 2025-11-08
