From b83d287a42345ad7e31093f1e7acfbc20dd6cfa2 Mon Sep 17 00:00:00 2001 From: bytedream Date: Fri, 4 Feb 2022 15:40:00 +0100 Subject: [PATCH] Added newgrounds.com --- SUPPORTED | 1 + src/match.ts | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/SUPPORTED b/SUPPORTED index 52bf5b4..43d4d99 100644 --- a/SUPPORTED +++ b/SUPPORTED @@ -1,6 +1,7 @@ evoload.io mcloud.to mixdrop.co +newgrounds.com streamtape.com streamzz.to thevideome.com diff --git a/src/match.ts b/src/match.ts index 9df83f8..7a376b2 100644 --- a/src/match.ts +++ b/src/match.ts @@ -44,6 +44,19 @@ class Mixdrop implements Match { } } +class Newgrounds implements Match { + async match(match: RegExpMatchArray): Promise { + let id = window.location.pathname.split('/').slice(-1)[0] + let response = await fetch(`https://www.newgrounds.com/portal/video/${id}`, { + headers: { + 'X-Requested-With': 'XMLHttpRequest' + } + }) + let json = await response.json() + return decodeURI(json['sources'][Object.keys(json['sources'])[0]][0]['src']) + } +} + class Streamtape implements Match { async match(match: RegExpMatchArray): Promise { return `https://streamtape.com/get_video?${match[0]}` @@ -111,6 +124,7 @@ const matches = [ ['evoload.io', null, new Evoload(), Reliability.NORMAL], ['mcloud.to', new RegExp(/(?<=')\w+(?=';)/gm), new MCloud(), Reliability.NORMAL], ['mixdrop.co', new RegExp(/(?<=\|)\w{2,}/gm), new Mixdrop(), Reliability.HIGH], + ['newgrounds.com', null, new Newgrounds(), Reliability.HIGH], ['streamtape.com', new RegExp(/id=\S*(?=')/gm), new Streamtape(), Reliability.NORMAL], ['streamzz.to', new RegExp(/https?:\/\/get.streamz.tw\/getlink-\w+\.dll/gm), null, Reliability.NORMAL], ['thevideome.com', new RegExp(/(?<=\|)\w{2,}/gm), new TheVideoMe(), Reliability.NORMAL],