mirror of
https://github.com/UrloMythus/UnHided.git
synced 2026-04-11 03:40:54 +00:00
New Version
This commit is contained in:
32
mediaflow_proxy/extractors/fastream.py
Normal file
32
mediaflow_proxy/extractors/fastream.py
Normal file
@@ -0,0 +1,32 @@
|
||||
import re
|
||||
from typing import Dict, Any
|
||||
|
||||
from mediaflow_proxy.extractors.base import BaseExtractor
|
||||
from mediaflow_proxy.utils.packed import eval_solver
|
||||
|
||||
|
||||
|
||||
|
||||
class FastreamExtractor(BaseExtractor):
|
||||
"""Fastream URL extractor."""
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.mediaflow_endpoint = "hls_manifest_proxy"
|
||||
|
||||
async def extract(self, url: str, **kwargs) -> Dict[str, Any]:
|
||||
#Init headers needed for the request.
|
||||
headers = {'Accept': '*/*', 'Connection': 'keep-alive','Accept-Language': 'en-US,en;q=0.5','Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'user-agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:138.0) Gecko/20100101 Firefox/138.0'}
|
||||
"""Extract Fastream URL."""
|
||||
final_url = await eval_solver(self,url,headers)
|
||||
|
||||
self.base_headers["referer"] = f'https://{url.replace('https://','').split('/')[0]}/'
|
||||
self.base_headers["origin"] = f'https://{url.replace('https://','').split('/')[0]}'
|
||||
self.base_headers['Accept-Language'] = 'en-US,en;q=0.5'
|
||||
self.base_headers['Accept'] = '*/*'
|
||||
self.base_headers['user-agent'] = 'Mozilla/5.0 (X11; Linux x86_64; rv:138.0) Gecko/20100101 Firefox/138.0'
|
||||
|
||||
return {
|
||||
"destination_url": final_url,
|
||||
"request_headers": self.base_headers,
|
||||
"mediaflow_endpoint": self.mediaflow_endpoint,
|
||||
}
|
||||
Reference in New Issue
Block a user