From 298e9308ce91dd658ad478813f7236e607f703b2 Mon Sep 17 00:00:00 2001 From: bytedream Date: Sun, 28 Jul 2024 17:54:41 +0200 Subject: [PATCH] Add streama2z.com (#19) --- src/entries/contentScript/main.ts | 4 ++++ src/lib/match.ts | 20 ++++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/entries/contentScript/main.ts b/src/entries/contentScript/main.ts index a0606e1..c5caa22 100644 --- a/src/entries/contentScript/main.ts +++ b/src/entries/contentScript/main.ts @@ -35,6 +35,10 @@ async function main() { return; } + if (!url) { + return; + } + // send the url to the ff2mpv (https://github.com/woodruffw/ff2mpv) application if (await Other.getFf2mpv()) { await chrome.runtime.sendMessage({ action: 'ff2mpv', url: url }); diff --git a/src/lib/match.ts b/src/lib/match.ts index 16b3466..87e65d4 100644 --- a/src/lib/match.ts +++ b/src/lib/match.ts @@ -1,5 +1,5 @@ import { unpack } from './utils'; -import { Hosters } from './settings'; +import { Hosters, Redirect } from './settings'; export interface Match { name: string; @@ -9,7 +9,7 @@ export interface Match { regex: RegExp; notice?: string; - match(match: RegExpMatchArray): Promise; + match(match: RegExpMatchArray): Promise; } export const Doodstream: Match = { @@ -141,6 +141,21 @@ export const Newgrounds: Match = { } }; +export const StreamA2z: Match = { + name: 'Stream2Az', + id: 'stream2az', + domains: ['streama2z.com', 'streama2z.xyz'], + regex: /https?:\/\/\S*m3u8.+(?=['"])/gm, + + match: async (match: RegExpMatchArray) => { + if (StreamA2z.domains.indexOf(window.location.hostname) !== -1) { + await Redirect.set(StreamA2z); + return null; + } + return match[0]; + } +}; + export const Streamtape: Match = { name: 'Streamtape', id: 'streamtape', @@ -252,6 +267,7 @@ export const matches = { [Mixdrop.id]: Mixdrop, [Mp4Upload.id]: Mp4Upload, [Newgrounds.id]: Newgrounds, + [StreamA2z.id]: StreamA2z, [Streamtape.id]: Streamtape, [Streamzz.id]: Streamzz, [SuperVideo.id]: SuperVideo,