From d3d4187da90a6b85f4ebae4bb07693cc9b412d75 Mon Sep 17 00:00:00 2001 From: DmitryScaletta Date: Sat, 9 Mar 2024 18:46:11 +0300 Subject: [PATCH] [ie/duboku] Fix m3u8 formats extraction (#9161) Closes #9159 Authored by: DmitryScaletta --- yt_dlp/extractor/duboku.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/yt_dlp/extractor/duboku.py b/yt_dlp/extractor/duboku.py index fc9564cef..626e577e7 100644 --- a/yt_dlp/extractor/duboku.py +++ b/yt_dlp/extractor/duboku.py @@ -1,4 +1,6 @@ +import base64 import re +import urllib.parse from .common import InfoExtractor from ..compat import compat_urlparse @@ -129,11 +131,15 @@ def _real_extract(self, url): data_url = player_data.get('url') if not data_url: raise ExtractorError('Cannot find url in player_data') - data_from = player_data.get('from') + player_encrypt = player_data.get('encrypt') + if player_encrypt == 1: + data_url = urllib.parse.unquote(data_url) + elif player_encrypt == 2: + data_url = urllib.parse.unquote(base64.b64decode(data_url).decode('ascii')) # if it is an embedded iframe, maybe it's an external source headers = {'Referer': webpage_url} - if data_from == 'iframe': + if player_data.get('from') == 'iframe': # use _type url_transparent to retain the meaningful details # of the video. return {