mirror of
https://github.com/UrloMythus/UnHided.git
synced 2026-04-11 03:40:54 +00:00
Add files via upload
This commit is contained in:
32
mediaflow_proxy/extractors/streamtape.py
Normal file
32
mediaflow_proxy/extractors/streamtape.py
Normal file
@@ -0,0 +1,32 @@
|
||||
import re
|
||||
from typing import Dict, Any
|
||||
|
||||
from mediaflow_proxy.extractors.base import BaseExtractor, ExtractorError
|
||||
|
||||
|
||||
class StreamtapeExtractor(BaseExtractor):
|
||||
"""Streamtape URL extractor."""
|
||||
|
||||
async def extract(self, url: str, **kwargs) -> Dict[str, Any]:
|
||||
"""Extract Streamtape URL."""
|
||||
response = await self._make_request(url)
|
||||
|
||||
# Extract and decode URL
|
||||
matches = re.findall(r"id=.*?(?=')", response.text)
|
||||
if not matches:
|
||||
raise ExtractorError("Failed to extract URL components")
|
||||
final_url = next(
|
||||
(
|
||||
f"https://streamtape.com/get_video?{matches[i + 1]}"
|
||||
for i in range(len(matches) - 1)
|
||||
if matches[i] == matches[i + 1]
|
||||
),
|
||||
None,
|
||||
)
|
||||
|
||||
self.base_headers["referer"] = url
|
||||
return {
|
||||
"destination_url": final_url,
|
||||
"request_headers": self.base_headers,
|
||||
"mediaflow_endpoint": self.mediaflow_endpoint,
|
||||
}
|
||||
Reference in New Issue
Block a user