mirror of
https://github.com/bytedream/stream-bypass.git
synced 2025-05-09 20:25:14 +02:00
Fix vidmoly.to
This commit is contained in:
parent
e522916585
commit
fd3eda9c61
@ -80,7 +80,7 @@ The best way to install the extension are the official browser extension stores:
|
|||||||
## 📜 Supported websites
|
## 📜 Supported websites
|
||||||
|
|
||||||
| Site | Firefox & Firefox for Android | Chrome & Chromium based |
|
| Site | Firefox & Firefox for Android | Chrome & Chromium based |
|
||||||
|-----------------------------------------------------------------------| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
|
| --------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
|
||||||
| [dropload.io](https://dropload.io) | ✔ | ✔ |
|
| [dropload.io](https://dropload.io) | ✔ | ✔ |
|
||||||
| [doodstream.com](doodstream.com) / [dood.pm](https://dood.pm) | ✔️ | ⚠ (redirect probably required) |
|
| [doodstream.com](doodstream.com) / [dood.pm](https://dood.pm) | ✔️ | ⚠ (redirect probably required) |
|
||||||
| [filemoon.to](https://filemoon.to) | ✔ | ✔ |
|
| [filemoon.to](https://filemoon.to) | ✔ | ✔ |
|
||||||
@ -93,7 +93,7 @@ The best way to install the extension are the official browser extension stores:
|
|||||||
| [streamzz.to](https://streamzz.to) / [streamz.ws](https://streamz.ws) | ✔ | ✔ |
|
| [streamzz.to](https://streamzz.to) / [streamz.ws](https://streamz.ws) | ✔ | ✔ |
|
||||||
| [supervideo.tv](https://supervideo.tv) | ✔ | ✔ |
|
| [supervideo.tv](https://supervideo.tv) | ✔ | ✔ |
|
||||||
| [upstream.to](https://upstream.to) | ✔ | ✔ |
|
| [upstream.to](https://upstream.to) | ✔ | ✔ |
|
||||||
| [vidmoly.me](https://vidmoly.me) | ✔ | ✔ |
|
| [vidmoly.to](https://vidmoly.me) | ✔ | ✔ |
|
||||||
| [vidoza.net](https://vidoza.net) | ⚠ (doesn't always work the first time, retrying/reloading the page one or two times fixes it) | ⚠ (doesn't always work the first time, retrying/reloading the page one or two times fixes it) |
|
| [vidoza.net](https://vidoza.net) | ⚠ (doesn't always work the first time, retrying/reloading the page one or two times fixes it) | ⚠ (doesn't always work the first time, retrying/reloading the page one or two times fixes it) |
|
||||||
| [voe.sx](https://voe.sx) | ✔ | ❌ (redirect always required) |
|
| [voe.sx](https://voe.sx) | ✔ | ❌ (redirect always required) |
|
||||||
| [vupload.com](https://vupload.com) | ✔ | ✔ |
|
| [vupload.com](https://vupload.com) | ✔ | ✔ |
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
import './shared';
|
import './shared';
|
||||||
|
|
||||||
import type { Match } from '~/lib/match';
|
import type { Match } from '~/lib/match';
|
||||||
import { Redirect, storageDelete, storageGet } from '~/lib/settings';
|
import { Redirect, UrlReferer } from '~/lib/settings';
|
||||||
import { getMatch } from '~/lib/match';
|
import { getMatch } from '~/lib/match';
|
||||||
|
|
||||||
chrome.webRequest.onBeforeSendHeaders.addListener(
|
chrome.webRequest.onBeforeSendHeaders.addListener(
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
async (details) => {
|
async (details) => {
|
||||||
const referer: { domain: string } | undefined = await storageGet('referer');
|
const referer = await UrlReferer.get(new URL(details.url).hostname);
|
||||||
if (referer === undefined) return;
|
if (!referer) return;
|
||||||
|
|
||||||
|
await UrlReferer.delete(new URL(details.url).hostname);
|
||||||
|
|
||||||
details.requestHeaders!.push({
|
details.requestHeaders!.push({
|
||||||
name: 'Referer',
|
name: 'Referer',
|
||||||
value: `https://${referer.domain}/`
|
value: `https://${referer}/`
|
||||||
});
|
});
|
||||||
|
|
||||||
await storageDelete('referer');
|
|
||||||
|
|
||||||
return { requestHeaders: details.requestHeaders };
|
return { requestHeaders: details.requestHeaders };
|
||||||
},
|
},
|
||||||
{ urls: ['<all_urls>'], types: ['xmlhttprequest'] },
|
{ urls: ['<all_urls>'], types: ['xmlhttprequest'] },
|
||||||
|
@ -1,17 +1,23 @@
|
|||||||
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';
|
import { UrlReferer } from '~/lib/settings';
|
||||||
|
|
||||||
|
async function playNative(url: string, domain: string, videoElem: HTMLVideoElement) {
|
||||||
|
await UrlReferer.set(new URL(url).hostname, domain);
|
||||||
|
|
||||||
async function playNative(url: string, videoElem: HTMLVideoElement) {
|
|
||||||
videoElem.src = url;
|
videoElem.src = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function playHls(url: string, videoElem: HTMLVideoElement) {
|
async function playHls(url: string, domain: string, videoElem: HTMLVideoElement) {
|
||||||
if (videoElem.canPlayType('application/vnd.apple.mpegurl')) {
|
if (videoElem.canPlayType('application/vnd.apple.mpegurl')) {
|
||||||
videoElem.src = url;
|
videoElem.src = url;
|
||||||
} else if (Hls.isSupported()) {
|
} else if (Hls.isSupported()) {
|
||||||
const hls = new Hls({
|
const hls = new Hls({
|
||||||
enableWorker: false
|
enableWorker: false,
|
||||||
|
xhrSetup: async (xhr: XMLHttpRequest, url: string) => {
|
||||||
|
await UrlReferer.set(new URL(url).hostname, domain);
|
||||||
|
xhr.open('GET', url);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
hls.loadSource(url);
|
hls.loadSource(url);
|
||||||
hls.attachMedia(videoElem);
|
hls.attachMedia(videoElem);
|
||||||
@ -32,11 +38,9 @@ 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, domain, videoElem);
|
||||||
} else {
|
} else {
|
||||||
await playNative(url, videoElem);
|
await playNative(url, domain, videoElem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -225,6 +225,7 @@ export const Vidmoly: Match = {
|
|||||||
id: 'vidmoly',
|
id: 'vidmoly',
|
||||||
domains: ['vidmoly.me', 'vidmoly.to'],
|
domains: ['vidmoly.me', 'vidmoly.to'],
|
||||||
regex: [/(?<=file:").+\.m3u8/gm],
|
regex: [/(?<=file:").+\.m3u8/gm],
|
||||||
|
replace: true,
|
||||||
|
|
||||||
match: async (match: RegExpMatchArray) => {
|
match: async (match: RegExpMatchArray) => {
|
||||||
return match[0];
|
return match[0];
|
||||||
|
@ -58,6 +58,18 @@ export const TmpHost = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const UrlReferer = {
|
||||||
|
get: async (url: string): Promise<string | null> => {
|
||||||
|
return (await storageGet(`urlReferer.${url}`)) || null;
|
||||||
|
},
|
||||||
|
set: async (url: string, referer: string) => {
|
||||||
|
await storageSet(`urlReferer.${url}`, referer);
|
||||||
|
},
|
||||||
|
delete: async (url: string) => {
|
||||||
|
await storageDelete(`urlReferer.${url}`);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
export const Other = {
|
export const Other = {
|
||||||
getFf2mpv: async () => {
|
getFf2mpv: async () => {
|
||||||
return await storageGet('other.ff2mpv', false);
|
return await storageGet('other.ff2mpv', false);
|
||||||
@ -67,7 +79,7 @@ export const Other = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function storageGet<T>(key: string, defaultValue?: T): Promise<T | undefined> {
|
async function storageGet<T>(key: string, defaultValue?: T): Promise<T | undefined> {
|
||||||
let resolve: (value: T | undefined) => void;
|
let resolve: (value: T | undefined) => void;
|
||||||
const promise = new Promise<T | undefined>((r) => (resolve = r));
|
const promise = new Promise<T | undefined>((r) => (resolve = r));
|
||||||
|
|
||||||
@ -79,7 +91,7 @@ export async function storageGet<T>(key: string, defaultValue?: T): Promise<T |
|
|||||||
return promise;
|
return promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function storageSet<T>(key: string, value: T) {
|
async function storageSet<T>(key: string, value: T) {
|
||||||
let resolve: () => void;
|
let resolve: () => void;
|
||||||
const promise = new Promise<void>((r) => (resolve = r));
|
const promise = new Promise<void>((r) => (resolve = r));
|
||||||
|
|
||||||
@ -91,7 +103,7 @@ export async function storageSet<T>(key: string, value: T) {
|
|||||||
return promise;
|
return promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function storageDelete(key: string) {
|
async function storageDelete(key: string) {
|
||||||
let resolve: () => void;
|
let resolve: () => void;
|
||||||
const promise = new Promise<void>((r) => (resolve = r));
|
const promise = new Promise<void>((r) => (resolve = r));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user