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 { 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(
async (details) => {
// check if redirects origins from a previous redirect

View File

@ -1,5 +1,6 @@
import { matches } from '~/lib/match';
import Hls from 'hls.js';
import { storageSet } from '~/lib/settings';
async function playNative(url: string, videoElem: HTMLVideoElement) {
videoElem.src = url;
@ -31,6 +32,8 @@ export async function play(videoElem: HTMLVideoElement) {
}
document.title = `Stream Bypass (${domain})`;
await storageSet('referer', { domain: domain });
if (new URL(url).pathname.endsWith('.m3u8')) {
await playHls(url, videoElem);
} 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 = {
name: 'Vidoza',
id: 'vidoza',
@ -262,6 +274,7 @@ export const matches = {
[Streamzz.id]: Streamzz,
[SuperVideo.id]: SuperVideo,
[Upstream.id]: Upstream,
[Vidmoly.id]: Vidmoly,
[Vidoza.id]: Vidoza,
[Voe.id]: Voe,
[Vupload.id]: Vupload

View File

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