From 698ed5ac3c0e124b89806a3f875883f93e22a1dd Mon Sep 17 00:00:00 2001 From: bytedream Date: Tue, 19 Jul 2022 11:03:16 +0200 Subject: [PATCH] Add support for doodstream --- src/index.ts | 14 +++++++++++++- src/match/matches.ts | 3 +++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index ba7f9a1..5840fe7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,7 @@ import {getMatch} from "./match/match"; import {storageDelete, storageGet} from "./store/store"; import {Match, matches} from "./match/matches"; +import play = chrome.cast.media.timeout.play; async function main() { let match: Match; @@ -20,7 +21,18 @@ async function main() { } const url = await match.match(re) - window.location.assign(chrome.runtime.getURL(`ui/player/player.html?id=${match.id}&url=${encodeURIComponent(url)}&domains=${window.location.host}`)) + + if (match.replace && !url.endsWith('.m3u8')) { + const player = document.createElement('video') + player.style.width = '100%' + player.controls = true + player.src = url + + document.body.innerHTML = '' + document.body.append(player) + } else { + window.location.assign(chrome.runtime.getURL(`ui/player/player.html?id=${match.id}&url=${encodeURIComponent(url)}&domains=${window.location.host}`)) + } } main() diff --git a/src/match/matches.ts b/src/match/matches.ts index 9861f91..0c881b3 100644 --- a/src/match/matches.ts +++ b/src/match/matches.ts @@ -9,6 +9,7 @@ export abstract class Match { id: string reliability: Reliability domains: string[] + replace?: boolean regex: RegExp abstract match(match: RegExpMatchArray): Promise @@ -27,6 +28,7 @@ class Doodstream implements Match { 'doodstream.com', 'dood.pm' ] + replace = true regex = new RegExp(/(\/pass_md5\/.*?)'.*(\?token=.*?expiry=)/s) async match(match: RegExpMatchArray): Promise { @@ -242,6 +244,7 @@ class Vupload implements Match { } export const matches = [ + new Doodstream(), new Evoload(), new Mixdrop(), new Newgrounds(),