e
This commit is contained in:
parent
7ebe8368ec
commit
00000d9f51
1 changed files with 5 additions and 5 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
import base64
|
||||||
import re
|
import re
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from urllib.parse import urljoin
|
from urllib.parse import urljoin
|
||||||
|
|
@ -29,14 +30,13 @@ async def process_event(
|
||||||
log.error(f'URL {url_num}) Failed to fetch "{url}": {e}')
|
log.error(f'URL {url_num}) Failed to fetch "{url}": {e}')
|
||||||
return
|
return
|
||||||
|
|
||||||
valid_m3u8 = re.compile(
|
valid_m3u8 = re.compile(r'var\s+(\w+)\s*=\s*"([^"]*)"', re.IGNORECASE)
|
||||||
r'var\s+(\w+)\s*=\s*["\']?(https?:\/\/[^"\'\s>]+\.m3u8(?:\?[^"\'\s>]*)?)["\']?',
|
|
||||||
re.IGNORECASE,
|
|
||||||
)
|
|
||||||
|
|
||||||
if match := valid_m3u8.search(r.text):
|
if match := valid_m3u8.search(r.text):
|
||||||
|
encoded = match[2][::-1]
|
||||||
|
decoded = base64.b64decode(encoded[::-1]).decode("utf-8")
|
||||||
log.info(f"URL {url_num}) Captured M3U8")
|
log.info(f"URL {url_num}) Captured M3U8")
|
||||||
return match[2]
|
return decoded
|
||||||
|
|
||||||
log.info(f"URL {url_num}) No M3U8 found")
|
log.info(f"URL {url_num}) No M3U8 found")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue