Add vidmoly.me

This commit is contained in:
bytedream 2023-12-08 15:50:19 +01:00
parent a10066458f
commit ccfc77167b
4 changed files with 35 additions and 1 deletions

View File

@ -4,6 +4,24 @@ import type { Match } from '~/lib/match';
import { storageDelete, storageGet, storageSet } from '~/lib/settings'; import { storageDelete, storageGet, storageSet } from '~/lib/settings';
import { getMatch } from '~/lib/match'; import { getMatch } from '~/lib/match';
chrome.webRequest.onBeforeSendHeaders.addListener(
async (details) => {
const referer: { domain: string } | undefined = await storageGet('referer');
if (referer === undefined) return;
details.requestHeaders.push({
name: 'Referer',
value: `https://${referer.domain}/`
});
await storageDelete('referer');
return { requestHeaders: details.requestHeaders };
},
{ urls: ['<all_urls>'], types: ['xmlhttprequest'] },
['blocking', 'requestHeaders']
);
chrome.webRequest.onBeforeRedirect.addListener( chrome.webRequest.onBeforeRedirect.addListener(
async (details) => { async (details) => {
// check if redirects origins from a previous redirect // check if redirects origins from a previous redirect

View File

@ -1,5 +1,6 @@
import { matches } from '~/lib/match'; import { matches } from '~/lib/match';
import Hls from 'hls.js'; import Hls from 'hls.js';
import { storageSet } from '~/lib/settings';
async function playNative(url: string, videoElem: HTMLVideoElement) { async function playNative(url: string, videoElem: HTMLVideoElement) {
videoElem.src = url; videoElem.src = url;
@ -31,6 +32,8 @@ export async function play(videoElem: HTMLVideoElement) {
} }
document.title = `Stream Bypass (${domain})`; document.title = `Stream Bypass (${domain})`;
await storageSet('referer', { domain: domain });
if (new URL(url).pathname.endsWith('.m3u8')) { if (new URL(url).pathname.endsWith('.m3u8')) {
await playHls(url, videoElem); await playHls(url, videoElem);
} else { } else {

View File

@ -213,6 +213,18 @@ export const Upstream: Match = {
} }
}; };
export const Vidmoly: Match = {
name: 'Vidmoly',
id: 'vidmoly',
reliability: Reliability.HIGH,
domains: ['vidmoly.me', 'vidmoly.to'],
regex: /(?<=file:").+\.m3u8(?=")/gm,
match: async (match: RegExpMatchArray) => {
return match[0];
}
};
export const Vidoza: Match = { export const Vidoza: Match = {
name: 'Vidoza', name: 'Vidoza',
id: 'vidoza', id: 'vidoza',
@ -262,6 +274,7 @@ export const matches = {
[Streamzz.id]: Streamzz, [Streamzz.id]: Streamzz,
[SuperVideo.id]: SuperVideo, [SuperVideo.id]: SuperVideo,
[Upstream.id]: Upstream, [Upstream.id]: Upstream,
[Vidmoly.id]: Vidmoly,
[Vidoza.id]: Vidoza, [Vidoza.id]: Vidoza,
[Voe.id]: Voe, [Voe.id]: Voe,
[Vupload.id]: Vupload [Vupload.id]: Vupload

View File

@ -41,7 +41,7 @@ const ManifestV2 = {
}, },
content_scripts: [{ ...sharedManifest.content_scripts[0], matches: ['<all_urls>'] }], content_scripts: [{ ...sharedManifest.content_scripts[0], matches: ['<all_urls>'] }],
browser_action: browserAction, browser_action: browserAction,
permissions: [...sharedManifest.permissions, 'webRequest', '<all_urls>'] permissions: [...sharedManifest.permissions, 'webRequest', 'webRequestBlocking', '<all_urls>']
}; };
const ManifestV3 = { const ManifestV3 = {