1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-06-28 09:28:33 +00:00

perf: simplify data-exec extraction (switch to regex)

This commit is contained in:
DarkCat09 2025-03-30 14:29:12 +04:00
parent fb342c0a66
commit 95db8d9610
No known key found for this signature in database

View File

@ -877,11 +877,11 @@ def _real_extract(self, url):
if data_audio: if data_audio:
meta = self._parse_json(unescapeHTML(data_audio), track_id) meta = self._parse_json(unescapeHTML(data_audio), track_id)
else: else:
player = get_element_html_by_class('AudioPlayerBlock__root', webpage) data_exec = self._search_regex(
r'class="AudioPlayerBlock__root"[^>]+data-exec="([^"]+)',
webpage, 'AudioPlayerBlock data-exec', group=1)
meta = traverse_obj( meta = traverse_obj(
self._parse_json( self._parse_json(unescapeHTML(data_exec), track_id),
extract_attributes(player).get('data-exec'),
track_id),
('AudioPlayerBlock/init', 'firstAudio')) ('AudioPlayerBlock/init', 'firstAudio'))
one_more_id = meta[24] one_more_id = meta[24]