use packer for filemoon

This commit is contained in:
sdaqo
2023-04-09 07:01:11 +02:00
parent d98035b8d0
commit 544adfa7b2
3 changed files with 7 additions and 10 deletions

View File

@ -21,7 +21,7 @@ async function main() {
const url = await match.match(re)
if (match.replace && !url.endsWith('.m3u8')) {
if (match.replace && !url.includes('.m3u8')) {
const player = document.createElement('video')
player.style.width = '100%'
player.style.height = '100%'

View File

@ -57,16 +57,13 @@ class Filemoon implements Match {
domains = [
'filemoon.sx'
]
regex = new RegExp(/(?<=\|)\w{2,}/gm)
regex = new RegExp(/eval\(function\(p,a,c,k,e,d\).*?(?=\<\/script\>)/gms)
async match(match: RegExpMatchArray): Promise<string> {
const start_idx = match.indexOf('moon')
const prefix = `${match[start_idx]}-${match[start_idx-1]}-${match[start_idx-2]}-${match[start_idx-3]}`
const time = match.find(m => m.length === 10 && !isNaN(parseInt(m)))
const offset = !isNaN(parseInt(match[start_idx-12])) && parseInt(match[start_idx-12]).toString().length == match[start_idx-12].length ? 0 : -1
return `https://${prefix}.filemoon.${match[start_idx-4]}/${match[start_idx-5]}/${match[start_idx-6]}/${match[start_idx-7]}/${match[start_idx-8]}/master.m3u8?t=${match[start_idx-11]}${offset != 0 ? `-${match[start_idx-12]}` : ''}&s=${time}&e=${match[start_idx + offset - 12]}&sp=${match[start_idx + offset - 18]}`
let unpacked = unPack(match[0])
let url = unpacked.match(/(?<=file:").*(?=")/)[0]
console.log(url)
return url
}
}

View File

@ -44,7 +44,7 @@ async function main() {
}
document.title = `Stream Bypass (${domain})`
new URL(url).pathname.endsWith('.m3u8') ? await play_hls(url) : await play_native(url)
new URL(url).pathname.contains('.m3u8') ? await play_hls(url) : await play_native(url)
}
main()