Add support for DLHD playback with MediaFlow & fix debrid playback on external player with MediaFlow (#519)

This commit is contained in:
Mohamed Zumair
2025-06-01 07:27:50 +05:30
committed by GitHub
parent 79599663d4
commit 991d312f5b
5 changed files with 21 additions and 14 deletions
-3
View File
@@ -177,9 +177,6 @@ class DaddyLiveHDChannelsSpider(scrapy.Spider):
"Referer": self.referer,
"Origin": self.referer.rstrip("/"),
},
"response_headers": {
"Content-Type": "application/vnd.apple.mpegurl",
},
"genres": [category],
"languages": languages,
"country": country,
+3 -2
View File
@@ -275,11 +275,12 @@
},
"dlhd": {
"channels_url": "https://daddylive.dad/24-7-channels.php",
"channel_url": "https://daddylive.dad/stream/stream-{channel_number}.php",
"schedule_url": "https://daddylive.dad/schedule/schedule-generated.php",
"server_lookup_url": "https://forcedtoplay.xyz/server_lookup.php?channel_id={server_type}{channel_id}",
"server_lookup_url": "https://allupplay.xyz/server_lookup.php?channel_id={server_type}{channel_id}",
"m3u8_base_url": "https://{server_key}new.newkso.ru/{server_key}/{server_type}{channel_id}/mono.m3u8",
"key_url": "https://key.keylocking.ru",
"referer": "https://forcedtoplay.xyz/",
"referer": "https://allupplay.xyz/",
"category_mapping": {
"Tv Shows": "Other Sports",
"Soccer": "Football",
+2 -4
View File
@@ -212,9 +212,6 @@ class DLHDScheduleService:
"Referer": self.referer,
"Origin": self.referer.rstrip("/"),
},
"response": {
"Content-Type": "application/vnd.apple.mpegurl",
},
},
},
)
@@ -267,7 +264,8 @@ class DLHDScheduleService:
server_response = await client.get(
server_url,
headers={
"Referer": f"{self.referer}premiumtv/daddylivehd.php?id={channel_id}"
"Referer": f"{self.referer}premiumtv/daddylivehd.php?id={channel_id}",
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36",
},
)
+2 -2
View File
@@ -65,7 +65,7 @@ async def get_cached_stream_url_and_redirect(
and user_data.mediaflow_config.proxy_debrid_streams
):
response_headers = {
"Content-Disposition": "attachment, filename={}".format(
"content-disposition": "attachment, filename={}".format(
path.basename(cached_stream_url)
)
}
@@ -153,7 +153,7 @@ def apply_mediaflow_proxy_if_needed(video_url, user_data):
"""
if user_data.mediaflow_config and user_data.mediaflow_config.proxy_debrid_streams:
response_headers = {
"Content-Disposition": "attachment, filename={}".format(
"content-disposition": "attachment, filename={}".format(
path.basename(video_url)
)
}
+14 -3
View File
@@ -7,7 +7,7 @@ import re
from datetime import datetime, timezone
from os.path import basename
from typing import Optional, List, Any
from urllib.parse import quote
from urllib.parse import quote, urlparse
from thefuzz import fuzz
@@ -552,6 +552,13 @@ async def process_stream(
behaviorHints=behavior_hints,
)
def get_dlhd_channel_url(stream: TVStreams) -> str:
parsed_url = urlparse(stream.url)
channel_id = parsed_url.path.split("/")[-2]
channel_number = re.search(r"(\d+)", channel_id).group(1)
channel_url = config_manager.get_scraper_config("dlhd", "channel_url")
return channel_url.format(channel_number=channel_number)
def get_proxy_url(stream: TVStreams, mediaflow_config) -> str:
endpoint = (
@@ -560,11 +567,15 @@ def get_proxy_url(stream: TVStreams, mediaflow_config) -> str:
query_params = {}
if stream.drm_key:
query_params = {"key_id": stream.drm_key_id, "key": stream.drm_key}
elif "dlhd" in stream.source:
elif stream.source == "DaddyLiveHD":
query_params = {
"use_request_proxy": False,
"key_url": config_manager.get_scraper_config("dlhd", "key_url"),
"host": "DLHD",
"redirect_stream": True,
}
stream.url = get_dlhd_channel_url(stream)
endpoint = "/extractor/video"
stream.behaviorHints = {"proxyHeaders": {}}
return encode_mediaflow_proxy_url(
mediaflow_config.proxy_url,