Add support for doodstream

This commit is contained in:
bytedream 2022-07-19 11:03:16 +02:00
parent dc42220f09
commit 698ed5ac3c
2 changed files with 16 additions and 1 deletions

View File

@ -1,6 +1,7 @@
import {getMatch} from "./match/match"; import {getMatch} from "./match/match";
import {storageDelete, storageGet} from "./store/store"; import {storageDelete, storageGet} from "./store/store";
import {Match, matches} from "./match/matches"; import {Match, matches} from "./match/matches";
import play = chrome.cast.media.timeout.play;
async function main() { async function main() {
let match: Match; let match: Match;
@ -20,7 +21,18 @@ async function main() {
} }
const url = await match.match(re) 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() main()

View File

@ -9,6 +9,7 @@ export abstract class Match {
id: string id: string
reliability: Reliability reliability: Reliability
domains: string[] domains: string[]
replace?: boolean
regex: RegExp regex: RegExp
abstract match(match: RegExpMatchArray): Promise<string> abstract match(match: RegExpMatchArray): Promise<string>
@ -27,6 +28,7 @@ class Doodstream implements Match {
'doodstream.com', 'doodstream.com',
'dood.pm' 'dood.pm'
] ]
replace = true
regex = new RegExp(/(\/pass_md5\/.*?)'.*(\?token=.*?expiry=)/s) regex = new RegExp(/(\/pass_md5\/.*?)'.*(\?token=.*?expiry=)/s)
async match(match: RegExpMatchArray): Promise<string> { async match(match: RegExpMatchArray): Promise<string> {
@ -242,6 +244,7 @@ class Vupload implements Match {
} }
export const matches = [ export const matches = [
new Doodstream(),
new Evoload(), new Evoload(),
new Mixdrop(), new Mixdrop(),
new Newgrounds(), new Newgrounds(),