-
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.
- Loading branch information
Showing
12 changed files
with
133 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"/> | ||
<title>background</title> | ||
<script type="text/javascript" src="js/jquery.min.js"></script> | ||
<script type="text/javascript" src="js/background.js"></script> | ||
</head> | ||
<body style="width:300px;min-height:150px;"> | ||
<h3>m3u8Sniffer</h3> | ||
<div id="box" class="box" style="width:250px;min-height:100px;margin:20px auto;padding: 15px;border:gray solid 1px;"> | ||
<div style="width: 250px;margin-top: 5px;"><span style="width: 200px;">main.m3u8</span><a href="#" style="float: right;">复制</a></div> | ||
<div style="width: 250px;margin-top: 5px;"><span style="width: 200px;">main.m3u8</span><a href="#" style="float: right;">复制</a></div> | ||
</div> | ||
</body> | ||
</html> |
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.
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
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; | ||
if(/\?/.test(details.url)){ | ||
tmp = details.url.slice(0,details.url.indexOf("?")); | ||
}else{ | ||
tmp = details.url; | ||
} | ||
//console.log(details.url); | ||
//console.log(tmp); | ||
if(pattern.test(tmp)){ | ||
console.log(details.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)); | ||
} | ||
}, {urls: ["<all_urls>"]},["requestHeaders"]); |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
var m3u8list=[]; | ||
var filename=[]; | ||
var pattern = /http[s]?[://]{1}[-A-Za-z0-9+&@#/%?=~_|!:,.;]*[-A-Za-z0-9+&@#/%=~_|]*.m3u8$/ | ||
chrome.webRequest.onBeforeRequest.addListener(details => { | ||
var tmp; | ||
if(/\?/.test(details.url)){ | ||
tmp = details.url.slice(0,details.url.indexOf("?")); | ||
}else{ | ||
tmp = details.url; | ||
} | ||
//console.log(details.url); | ||
//console.log(tmp); | ||
if(pattern.test(tmp)){ | ||
m3u8list.push(details.url); | ||
filename.push(tmp.slice(tmp.lastIndexOf("/")+1,tmp.length)); | ||
} | ||
}, {urls: ["<all_urls>"]},["extraHeaders"]); | ||
|
||
chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) | ||
{ | ||
if(request.cmd == 'm3u8' && request.value == 'popup'){ | ||
var resp = {m3u8list:m3u8list,filename:filename}; | ||
sendResponse(resp); | ||
} | ||
}); |
Large diffs are not rendered by default.
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
var tabID; | ||
$(function(){ | ||
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); | ||
} | ||
}); | ||
}) | ||
|
||
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('复制成功'); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"manifest_version": 2, | ||
"name": "m3u8Sniffer", | ||
"version": "1.0.0", | ||
"description": "m3u8嗅探器,可以列出页面的m3u8文件", | ||
"icons": | ||
{ | ||
"16": "img/icon_16.png", | ||
"48": "img/icon_48.png", | ||
"128": "img/icon_128.png" | ||
}, | ||
"browser_action": | ||
{ | ||
"default_icon": "img/icon_19.png", | ||
"default_popup": "popup.html" | ||
}, | ||
"permissions": | ||
[ | ||
"webRequest", | ||
"tabs", | ||
"http://*/*", | ||
"https://*/*" | ||
], | ||
"background": | ||
{ | ||
"page": "background.html" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>m3u8Sniffer</title> | ||
<script type="text/javascript" src="js/jquery.min.js"></script> | ||
<script type="text/javascript" src="js/popup.js"></script> | ||
</head> | ||
<body style="width:300px;min-height:150px;"> | ||
<h3>m3u8Sniffer</h3> | ||
<div id="box" class="box" style="width:250px;min-height:100px;margin:20px auto;padding: 15px;border:gray solid 1px;"> | ||
|
||
</div> | ||
</body> | ||
</html> |