From d47dd1524bc6d2b99139d197ea262c4c2950ea57 Mon Sep 17 00:00:00 2001 From: Twilight0 Date: Mon, 27 Apr 2026 19:14:57 +0300 Subject: [PATCH] Dailymotion fixes 1) Passes master m3u8 manifest directly to the player (useful for inputstream adaptive getting all respective qualities) 2) Includes "session warm-up", fixing #1310 (while getting necessary cookies) 3) Passes Referer as the main web page url --- .../lib/resolveurl/plugins/dailymotion.py | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/script.module.resolveurl/lib/resolveurl/plugins/dailymotion.py b/script.module.resolveurl/lib/resolveurl/plugins/dailymotion.py index bc3d24e5..3d38bbdb 100644 --- a/script.module.resolveurl/lib/resolveurl/plugins/dailymotion.py +++ b/script.module.resolveurl/lib/resolveurl/plugins/dailymotion.py @@ -17,7 +17,6 @@ """ import json -import re from resolveurl import common from resolveurl.lib import helpers from resolveurl.resolver import ResolveUrl, ResolverError @@ -26,14 +25,23 @@ class DailymotionResolver(ResolveUrl): name = 'Dailymotion' domains = ['dailymotion.com', 'dai.ly'] - pattern = r'(?://|\.)(dailymotion\.com|dai\.ly)(?:/(?:video|embed|sequence|swf|player)' \ - r'(?:/video|/full)?)?/(?:[a-z0-9]+\.html\?video=)?(?!playlist)([0-9a-zA-Z]+)' + pattern = ( + r'(?://|\.)(dailymotion\.com|dai\.ly)(?:/(?:video|embed|sequence|swf|player)' + r'(?:/video|/full)?)?/(?:[a-z0-9]+\.html\?video=)?(?!playlist)([0-9a-zA-Z]+)' + ) def get_media_url(self, host, media_id, subs=False): + + main_page_url = 'https://www.dailymotion.com/video/{}'.format(media_id) + cookies = self.net.http_GET(main_page_url).get_cookies() + web_url = self.get_url(host, media_id) - headers = {'User-Agent': common.RAND_UA, - 'Origin': 'https://www.dailymotion.com', - 'Referer': 'https://www.dailymotion.com/'} + headers = { + 'User-Agent': common.RAND_UA, + 'Origin': 'https://www.dailymotion.com', + 'Referer': main_page_url, + 'Cookies': cookies + } js_result = json.loads(self.net.http_GET(web_url, headers=headers).content) if js_result.get('error'): @@ -48,9 +56,10 @@ def get_media_url(self, host, media_id, subs=False): subtitles[matches[key].get('label')] = matches[key].get('urls', [])[0] if quals: - mbtext = self.net.http_GET(quals.get('auto')[0].get('url'), headers=headers).content - sources = re.findall('NAME="(?P