A Chrome extension to get all network requests in a website and download files and videos from it.
In sanitizeURL
function at background.js:
function sanitizeURL(url) {
...
if (url.match(/googleusercontent\.com\/.*&url=.*/g)) {
return Array.from(
url.matchAll(/googleusercontent\.com\/.*&url=(.*)/g)
)[0][1];
}
...
return url;
}
In matchURL
function at background.js:
function matchURL(data) {
...
if (data.tabURL.match(/https?:\/\/www\.example\.com/g)) {
return (
(data.mimeType && (
data.mimeType === "application/vnd.apple.mpegurl" ||
data.mimeType.match(/^(video|audio)/g))) ||
data.url.match(/^(?!.*\bthumbnails\.vtt\b).*\.(m3u8|aaa|ts|vtt|srt)\b/g) ||
data.url.match(/\bmaster\.txt\b/g)
);
}
...
return false;
}
In matchPlaylistURL
function at background.js:
function matchPlaylistURL(data) {
...
if (data.tabURL.match(/https?:\/\/www\.example\.com/g)) {
return (
data.mimeType === "application/vnd.apple.mpegurl" ||
data.url.includes("master.txt") ||
data.url.includes(".m3u8") ||
data.url.includes("/m3/")
);
}
...
return false;
}