Spaces:
Paused
Paused
Update headers to consistent lowercase format to fix duplicate headers
Browse files
mediaflow_proxy/extractors/base.py
CHANGED
|
@@ -12,10 +12,10 @@ class BaseExtractor(ABC):
|
|
| 12 |
def __init__(self, proxy_enabled: bool, request_headers: dict):
|
| 13 |
self.proxy_url = settings.proxy_url if proxy_enabled else None
|
| 14 |
self.base_headers = {
|
| 15 |
-
"
|
| 16 |
-
"
|
| 17 |
-
**request_headers,
|
| 18 |
}
|
|
|
|
| 19 |
|
| 20 |
async def _make_request(
|
| 21 |
self, url: str, headers: Optional[Dict] = None, follow_redirects: bool = True, **kwargs
|
|
@@ -23,9 +23,11 @@ class BaseExtractor(ABC):
|
|
| 23 |
"""Make HTTP request with error handling."""
|
| 24 |
try:
|
| 25 |
async with httpx.AsyncClient(proxy=self.proxy_url) as client:
|
|
|
|
|
|
|
| 26 |
response = await client.get(
|
| 27 |
url,
|
| 28 |
-
headers=
|
| 29 |
follow_redirects=follow_redirects,
|
| 30 |
timeout=30,
|
| 31 |
**kwargs,
|
|
|
|
| 12 |
def __init__(self, proxy_enabled: bool, request_headers: dict):
|
| 13 |
self.proxy_url = settings.proxy_url if proxy_enabled else None
|
| 14 |
self.base_headers = {
|
| 15 |
+
"user-agent": settings.user_agent,
|
| 16 |
+
"accept-language": "en-US,en;q=0.5",
|
|
|
|
| 17 |
}
|
| 18 |
+
self.base_headers.update(request_headers)
|
| 19 |
|
| 20 |
async def _make_request(
|
| 21 |
self, url: str, headers: Optional[Dict] = None, follow_redirects: bool = True, **kwargs
|
|
|
|
| 23 |
"""Make HTTP request with error handling."""
|
| 24 |
try:
|
| 25 |
async with httpx.AsyncClient(proxy=self.proxy_url) as client:
|
| 26 |
+
request_headers = self.base_headers
|
| 27 |
+
request_headers.update(headers or {})
|
| 28 |
response = await client.get(
|
| 29 |
url,
|
| 30 |
+
headers=request_headers,
|
| 31 |
follow_redirects=follow_redirects,
|
| 32 |
timeout=30,
|
| 33 |
**kwargs,
|
mediaflow_proxy/extractors/doodstream.py
CHANGED
|
@@ -25,7 +25,7 @@ class DoodStreamExtractor(BaseExtractor):
|
|
| 25 |
# Build final URL
|
| 26 |
pass_url = f"{self.base_url}{match[1]}"
|
| 27 |
referer = f"{self.base_url}/"
|
| 28 |
-
headers = {"
|
| 29 |
|
| 30 |
rebobo_response = await self._make_request(pass_url, headers=headers)
|
| 31 |
timestamp = str(int(time.time()))
|
|
|
|
| 25 |
# Build final URL
|
| 26 |
pass_url = f"{self.base_url}{match[1]}"
|
| 27 |
referer = f"{self.base_url}/"
|
| 28 |
+
headers = {"range": "bytes=0-", "referer": referer}
|
| 29 |
|
| 30 |
rebobo_response = await self._make_request(pass_url, headers=headers)
|
| 31 |
timestamp = str(int(time.time()))
|