-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2.删除无用的文件,调整目录结构 3.调整了提示,提示变得友好
- Loading branch information
Showing
18 changed files
with
86 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
# m3u8Sniffer | ||
## 中文 | ||
一个可以扫描页面m3u8链接的Chrome扩展。 | ||
一个可以嗅探网页发起的m3u8链接请求的Chrome扩展。 | ||
|
||
## English | ||
A Chrome plug-in that scans the m3u8 link in a web page. | ||
A Chrome extension that can sniff requests for m3u8 links from web pages. | ||
|
||
|
||
![image](https://user-images.githubusercontent.com/27936579/109785249-e830cf80-7c46-11eb-8a89-e015ee18ae20.png) | ||
![image](img/img1.jpg) | ||
|
||
![image](https://user-images.githubusercontent.com/27936579/109785314-f848af00-7c46-11eb-91be-a59cb4df8b4b.png) | ||
![image](img/img2.jpg) | ||
|
||
![image](img/img3.png) | ||
|
||
Manifest V3版本:https://github.com/Leenshady/m3u8Sniffer2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,30 @@ | ||
var m3u8list=[]; | ||
var filename=[]; | ||
var tabs={}; | ||
var pattern = /http[s]?[://]{1}[-A-Za-z0-9+&@#/%?=~_|!:,.;]*[-A-Za-z0-9+&@#/%=~_|]*.m3u8$/ | ||
//拦截网络请求 | ||
chrome.webRequest.onBeforeSendHeaders.addListener(details => { | ||
var tmp; | ||
//去除url中的参数 | ||
if(/\?/.test(details.url)){ | ||
tmp = details.url.slice(0,details.url.indexOf("?")); | ||
}else{ | ||
tmp = details.url; | ||
} | ||
//console.log(details.url); | ||
//console.log(tmp); | ||
//匹配m3u8链接 | ||
if(pattern.test(tmp)){ | ||
console.log(details.tabId); | ||
//console.log(details.tabId); | ||
//如果tabs[tabId]不存在,先新建 | ||
if(!(details.tabId in tabs)){ | ||
tabs[details.tabId] ={}; | ||
tabs[details.tabId].m3u8list=[]; | ||
tabs[details.tabId].filename=[]; | ||
} | ||
tabs[details.tabId].m3u8list.push(details.url); | ||
tabs[details.tabId].filename.push(tmp.slice(tmp.lastIndexOf("/")+1,tmp.length)); | ||
//插入数组 | ||
var m3u8 = {name:tmp.slice(tmp.lastIndexOf("/")+1,tmp.length),url:details.url} | ||
//去重 | ||
if(!tabs[details.tabId].m3u8list.some(item=>item.url===details.url)){ | ||
tabs[details.tabId].m3u8list.push(m3u8); | ||
} | ||
//tabs[details.tabId].filename.push(tmp.slice(tmp.lastIndexOf("/")+1,tmp.length)); | ||
} | ||
}, {urls: ["<all_urls>"]},["requestHeaders"]); |
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,29 @@ | ||
var tabID; | ||
$(function(){ | ||
//获取background,方便访问background的变量 | ||
var bg = chrome.extension.getBackgroundPage(); | ||
chrome.tabs.getSelected(null, function (tab) { // 先获取当前页面的tabID | ||
tabID = tab.id; | ||
console.log(tabID) | ||
for(i=0;i<bg.tabs[tabID].filename.length;i++){ | ||
$("#box").append('<div id=url'+i+' style="width: 250px;margin-top: 5px;"><span style="width: 200px;">'+bg.tabs[tabID].filename[i]+'</span><a href="#" style="float: right;">复制</a></div>'); | ||
$("#url"+i).click({"url":bg.tabs[tabID].m3u8list[i]},copyUrl); | ||
var tabID = tab.id; | ||
//console.log(tabID) | ||
//判空 | ||
if(bg.tabs==undefined || bg.tabs[tabID]==undefined || bg.tabs[tabID].m3u8list==undefined){ | ||
$(".alert-warning").addClass("show") | ||
$(".alert-warning").removeAttr("hidden") | ||
}else{ | ||
for(i=0;i<bg.tabs[tabID].m3u8list.length;i++){ | ||
$("#box").append('<div id="url'+i+'" style="mt-1 mb-1"><span style="max-width: 200px;white-space: nowrap;display: inline-block;overflow: hidden;text-overflow: ellipsis;line-height: 1.5;">'+bg.tabs[tabID].m3u8list[i].name+'</span><a href="#" style="float: right;">复制</a></div>'); | ||
$("#url"+i).click({"url":bg.tabs[tabID].m3u8list[i].url},copyUrl); | ||
} | ||
} | ||
}); | ||
}) | ||
|
||
function copyUrl(obj){ | ||
var oInput = document.createElement('input'); | ||
oInput.value = obj.data.url; | ||
document.body.appendChild(oInput); | ||
oInput.select(); // 选择对象 | ||
document.execCommand("Copy"); // 执行浏览器复制命令 | ||
oInput.className = 'oInput'; | ||
oInput.style.display='none'; | ||
alert('复制成功'); | ||
//复制链接到剪切板 | ||
function copyUrl(obj) { | ||
navigator.clipboard.writeText(obj.data.url); | ||
$(".alert-success").addClass("show") | ||
$(".alert-success").removeAttr("hidden") | ||
window.setTimeout(function(){ | ||
$(".alert-success").removeClass("show") | ||
$(".alert-success").attr("hidden","hidden") | ||
},2000);//2秒后消失 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters