Fix filemoon.to

This commit is contained in:
bytedream 2024-12-15 17:13:30 +01:00
parent b9514284da
commit e522916585
5 changed files with 69 additions and 36 deletions

View File

@ -80,10 +80,10 @@ 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.sx](https://filemoon.sx) | ✔ | ✔ | | [filemoon.to](https://filemoon.to) | ✔ | ✔ |
| [goodstream.uno](https://goodstream.uno) | ✔ | ✔ | | [goodstream.uno](https://goodstream.uno) | ✔ | ✔ |
| [mixdrop.co](https://mixdrop.co) | ✔ | ✔ | | [mixdrop.co](https://mixdrop.co) | ✔ | ✔ |
| [mp4upload.com](https://mp4upload.com) | ✔ | ✔ | | [mp4upload.com](https://mp4upload.com) | ✔ | ✔ |

View File

@ -20,10 +20,16 @@ async function main() {
return; return;
} }
const re = document.body.innerHTML.match(match.regex); let re = null;
for (const regex of match.regex) {
if ((re = document.body.innerHTML.match(regex)) !== null) {
break;
}
}
if (re === null) { if (re === null) {
return; return;
} }
if (redirect) { if (redirect) {
await Redirect.delete(); await Redirect.delete();
} }

View File

@ -1,12 +1,12 @@
import { unpack } from './utils'; import { unpack } from './utils';
import { Hosters, Redirect } from './settings'; import { Hosters, Redirect, TmpHost } from './settings';
export interface Match { export interface Match {
name: string; name: string;
id: string; id: string;
domains: string[]; domains: string[];
replace?: boolean; replace?: boolean;
regex: RegExp; regex: RegExp[];
notice?: string; notice?: string;
match(match: RegExpMatchArray): Promise<string | null>; match(match: RegExpMatchArray): Promise<string | null>;
@ -35,7 +35,7 @@ export const Doodstream: Match = {
'd000d.com' 'd000d.com'
], ],
replace: true, replace: true,
regex: /(\/pass_md5\/.*?)'.*(\?token=.*?expiry=)/s, regex: [/(\/pass_md5\/.*?)'.*(\?token=.*?expiry=)/s],
match: async (match: RegExpMatchArray) => { match: async (match: RegExpMatchArray) => {
const response = await fetch(`https://${window.location.host}${match[1]}`, { const response = await fetch(`https://${window.location.host}${match[1]}`, {
@ -54,7 +54,7 @@ export const DropLoad: Match = {
name: 'Dropload', name: 'Dropload',
id: 'dropload', id: 'dropload',
domains: ['dropload.ui'], domains: ['dropload.ui'],
regex: /eval\(function\(p,a,c,k,e,d\).*?(?=<\/script>)/gms, regex: [/eval\(function\(p,a,c,k,e,d\).*?(?=<\/script>)/gms],
match: async (match: RegExpMatchArray) => { match: async (match: RegExpMatchArray) => {
const unpacked = await unpack(match[0]); const unpacked = await unpack(match[0]);
@ -65,12 +65,20 @@ export const DropLoad: Match = {
export const Filemoon: Match = { export const Filemoon: Match = {
name: 'Filemoon', name: 'Filemoon',
id: 'filemoon', id: 'filemoon',
domains: ['filemoon.sx', 'filemoon.in'], domains: ['filemoon.sx', 'filemoon.to', 'filemoon.in'],
regex: /eval\(function\(p,a,c,k,e,d\).*?(?=<\/script>)/gms, regex: [/(?<=<iframe\s*src=")\S*(?=")/s, /eval\(function\(p,a,c,k,e,d\).*?(?=<\/script>)/gms],
replace: true,
match: async (match: RegExpMatchArray) => { match: async (match: RegExpMatchArray) => {
if (window.location.host.startsWith('filemoon')) {
await TmpHost.set(new URL(match[0]).host, Filemoon);
return null;
}
await TmpHost.delete();
const unpacked = await unpack(match[0]); const unpacked = await unpack(match[0]);
return unpacked.match(/(?<=file:").*(?=")/)![0]; return unpacked.match(/(?<=file:")\S*(?=")/)![0];
} }
}; };
@ -78,7 +86,7 @@ export const GoodStream: Match = {
name: 'Goodstream', name: 'Goodstream',
id: 'goodstream', id: 'goodstream',
domains: ['goodstream.uno'], domains: ['goodstream.uno'],
regex: /(?<=file:\s+").*(?=")/g, regex: [/(?<=file:\s+").*(?=")/g],
match: async (match: RegExpMatchArray) => { match: async (match: RegExpMatchArray) => {
return match[0]; return match[0];
@ -89,7 +97,7 @@ export const Kwik: Match = {
name: 'Kwik', name: 'Kwik',
id: 'kwik', id: 'kwik',
domains: ['kwik.cx'], domains: ['kwik.cx'],
regex: /eval\(function\(p,a,c,k,e,d\).*?(?=<\/script>)/gms, regex: [/eval\(function\(p,a,c,k,e,d\).*?(?=<\/script>)/gms],
match: async (match: RegExpMatchArray) => { match: async (match: RegExpMatchArray) => {
const unpacked = await unpack(match[0]); const unpacked = await unpack(match[0]);
@ -101,7 +109,7 @@ export const Mixdrop: Match = {
name: 'Mixdrop', name: 'Mixdrop',
id: 'mixdrop', id: 'mixdrop',
domains: ['mixdrop.co', 'mixdrop.to', 'mixdrop.ch', 'mixdrop.bz', 'mixdrop.gl'], domains: ['mixdrop.co', 'mixdrop.to', 'mixdrop.ch', 'mixdrop.bz', 'mixdrop.gl'],
regex: /eval\(function\(p,a,c,k,e,d\).*?(?=<\/script>)/gms, regex: [/eval\(function\(p,a,c,k,e,d\).*?(?=<\/script>)/gms],
match: async (match: RegExpMatchArray) => { match: async (match: RegExpMatchArray) => {
const unpacked = await unpack(match[0]); const unpacked = await unpack(match[0]);
@ -115,7 +123,7 @@ export const Mp4Upload: Match = {
id: 'mp4upload', id: 'mp4upload',
domains: ['mp4upload.com'], domains: ['mp4upload.com'],
replace: true, replace: true,
regex: /eval\(function\(p,a,c,k,e,d\).*?(?=<\/script>)/gms, regex: [/eval\(function\(p,a,c,k,e,d\).*?(?=<\/script>)/gms],
match: async (match: RegExpMatchArray) => { match: async (match: RegExpMatchArray) => {
const unpacked = await unpack(match[0]); const unpacked = await unpack(match[0]);
@ -127,7 +135,7 @@ export const Newgrounds: Match = {
name: 'Newgrounds', name: 'Newgrounds',
id: 'newgrounds', id: 'newgrounds',
domains: ['newgrounds.com'], domains: ['newgrounds.com'],
regex: /.*/gm, regex: [/.*/gm],
match: async () => { match: async () => {
const id = window.location.pathname.split('/').slice(-1)[0]; const id = window.location.pathname.split('/').slice(-1)[0];
@ -145,7 +153,7 @@ export const StreamA2z: Match = {
name: 'Stream2Az', name: 'Stream2Az',
id: 'stream2az', id: 'stream2az',
domains: ['streama2z.com', 'streama2z.xyz'], domains: ['streama2z.com', 'streama2z.xyz'],
regex: /https?:\/\/\S*m3u8.+(?=['"])/gm, regex: [/https?:\/\/\S*m3u8.+(?=['"])/gm],
match: async (match: RegExpMatchArray) => { match: async (match: RegExpMatchArray) => {
if (StreamA2z.domains.indexOf(window.location.hostname) !== -1) { if (StreamA2z.domains.indexOf(window.location.hostname) !== -1) {
@ -160,7 +168,7 @@ export const Streamtape: Match = {
name: 'Streamtape', name: 'Streamtape',
id: 'streamtape', id: 'streamtape',
domains: ['streamtape.com', 'streamtape.net', 'shavetape.cash'], domains: ['streamtape.com', 'streamtape.net', 'shavetape.cash'],
regex: /id=.*(?=')/gm, regex: [/id=.*(?=')/gm],
match: async (match: RegExpMatchArray) => { match: async (match: RegExpMatchArray) => {
let i = 0; let i = 0;
@ -179,7 +187,7 @@ export const Streamzz: Match = {
name: 'Streamzz', name: 'Streamzz',
id: 'streamzz', id: 'streamzz',
domains: ['streamzz.to', 'streamz.ws'], domains: ['streamzz.to', 'streamz.ws'],
regex: /(?<=\|)\w{2,}/gm, regex: [/(?<=\|)\w{2,}/gm],
match: async (match: RegExpMatchArray) => { match: async (match: RegExpMatchArray) => {
return `https://get.${location.hostname.split('.')[0]}.tw/getlink-${ return `https://get.${location.hostname.split('.')[0]}.tw/getlink-${
@ -192,7 +200,7 @@ export const SuperVideo: Match = {
name: 'Supervideo', name: 'Supervideo',
id: 'supervideo', id: 'supervideo',
domains: ['supervideo.tv'], domains: ['supervideo.tv'],
regex: /eval\(function\(p,a,c,k,e,d\).*?(?=<\/script>)/gms, regex: [/eval\(function\(p,a,c,k,e,d\).*?(?=<\/script>)/gms],
match: async (match: RegExpMatchArray) => { match: async (match: RegExpMatchArray) => {
const unpacked = await unpack(match[0]); const unpacked = await unpack(match[0]);
@ -204,7 +212,7 @@ export const Upstream: Match = {
name: 'Upstream', name: 'Upstream',
id: 'upstream', id: 'upstream',
domains: ['upstream.to'], domains: ['upstream.to'],
regex: /eval\(function\(p,a,c,k,e,d\).*?(?=<\/script>)/gms, regex: [/eval\(function\(p,a,c,k,e,d\).*?(?=<\/script>)/gms],
match: async (match: RegExpMatchArray) => { match: async (match: RegExpMatchArray) => {
const unpacked = await unpack(match[0]); const unpacked = await unpack(match[0]);
@ -216,10 +224,9 @@ export const Vidmoly: Match = {
name: 'Vidmoly', name: 'Vidmoly',
id: 'vidmoly', id: 'vidmoly',
domains: ['vidmoly.me', 'vidmoly.to'], domains: ['vidmoly.me', 'vidmoly.to'],
regex: /(?<=file:").+\.m3u8/gm, regex: [/(?<=file:").+\.m3u8/gm],
match: async (match: RegExpMatchArray) => { match: async (match: RegExpMatchArray) => {
alert('a');
return match[0]; return match[0];
} }
}; };
@ -228,7 +235,7 @@ export const Vidoza: Match = {
name: 'Vidoza', name: 'Vidoza',
id: 'vidoza', id: 'vidoza',
domains: ['vidoza.net'], domains: ['vidoza.net'],
regex: /(?<=src:\s?").+?(?=")/gm, regex: [/(?<=src:\s?").+?(?=")/gm],
replace: true, replace: true,
match: async (match: RegExpMatchArray) => { match: async (match: RegExpMatchArray) => {
@ -240,7 +247,7 @@ export const Voe: Match = {
name: 'Voe', name: 'Voe',
id: 'voe', id: 'voe',
domains: ['voe.sx'], domains: ['voe.sx'],
regex: /(?<='hls':\s*')\S*(?=')/gm, regex: [/(?<='hls':\s*')\S*(?=')/gm],
match: async (match: RegExpMatchArray) => { match: async (match: RegExpMatchArray) => {
return atob(match[0]); return atob(match[0]);
@ -251,7 +258,7 @@ export const Vupload: Match = {
name: 'Vupload', name: 'Vupload',
id: 'vupload', id: 'vupload',
domains: ['vupload.com'], domains: ['vupload.com'],
regex: /(?<=src:\s?").+?(?=")/gm, regex: [/(?<=src:\s?").+?(?=")/gm],
match: async (match: RegExpMatchArray) => { match: async (match: RegExpMatchArray) => {
return match[0]; return match[0];
@ -292,5 +299,10 @@ export async function getMatch(domain: string): Promise<Match | null> {
} }
} }
const tmpHost = await TmpHost.get();
if (tmpHost && tmpHost[0] === domain) {
return tmpHost[1];
}
return null; return null;
} }

View File

@ -42,6 +42,22 @@ export const Redirect = {
} }
}; };
export const TmpHost = {
get: async (): Promise<[string, Match] | null> => {
const tmphost = await storageGet<[string, number]>('tmphost');
if (tmphost === undefined) {
return null;
}
return [tmphost[0], matches[tmphost[1]]];
},
set: async (domain: string, match: Match) => {
await storageSet('tmphost', [domain, match.id]);
},
delete: async () => {
await storageDelete('tmphost');
}
};
export const Other = { export const Other = {
getFf2mpv: async () => { getFf2mpv: async () => {
return await storageGet('other.ff2mpv', false); return await storageGet('other.ff2mpv', false);

View File

@ -16,7 +16,7 @@ export async function unpack(packed: string): Promise<string> {
${packed} ${packed}
}; };
return packed; return packed;
}' }
`; `;
const res = (await runInPageContext(toExecute)) as string; const res = (await runInPageContext(toExecute)) as string;
@ -48,9 +48,8 @@ async function runInPageContext<T>(toExecute: string): Promise<T | null> {
scriptElm.textContent = ` scriptElm.textContent = `
( (
async function () { async function () {
const response = { const response = {
id: ${resultMessageId} id: '${resultMessageId}'
}; };
try { try {