From 3ee378c0991c1193df5ee5f1d3d24099171f1b48 Mon Sep 17 00:00:00 2001 From: EduTel <15623704+EduTel@users.noreply.github.com> Date: Sun, 23 Jan 2022 14:36:00 -0600 Subject: [PATCH] refactor and fix --- youtube_dl/extractor/platzi.py | 43 ++++++++++++++-------------------- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/youtube_dl/extractor/platzi.py b/youtube_dl/extractor/platzi.py index 9efa51bdd..7fef4d1b1 100644 --- a/youtube_dl/extractor/platzi.py +++ b/youtube_dl/extractor/platzi.py @@ -3,16 +3,13 @@ from __future__ import unicode_literals from .common import InfoExtractor from ..compat import ( - compat_b64decode, compat_str, ) from ..utils import ( - clean_html, ExtractorError, int_or_none, str_or_none, try_get, - url_or_none, urlencode_postdata, urljoin, ) @@ -105,39 +102,35 @@ class PlatziIE(PlatziBaseIE): webpage = self._download_webpage(url, lecture_id) data_preloaded_state = self._parse_json( - self._search_regex((r'window.__PRELOADED_STATE__ = (.*)\<\/script'), webpage, 'client data'), + self._search_regex( + (r'window\s*.\s*__PRELOADED_STATE__\s*=\s*({.*?});?\s*