1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-07-23 21:58:29 +00:00

touch up regex

Authored by: bashonly
This commit is contained in:
bashonly 2025-07-12 16:36:35 -05:00
parent a58f047b7f
commit 861c487b1f
No known key found for this signature in database
GPG Key ID: 783F096F253D15B0

View File

@ -1808,7 +1808,7 @@ def flatten(flight_data):
flight_text = ''
# The pattern for the surrounding JS/tag should be strict as it's a hardcoded string in the next.js source
# Ref: https://github.com/vercel/next.js/blob/5a4a08fdc/packages/next/src/server/app-render/use-flight-response.tsx#L189
for flight_segment in re.findall(r'<script[^>]*>self\.__next_f\.push\((\[.+?\])\)</script>', webpage):
for flight_segment in re.findall(r'<script\b[^>]*>self\.__next_f\.push\((\[.+?\])\)</script>', webpage):
segment = self._parse_json(flight_segment, video_id, fatal=fatal, errnote=None if fatal else False)
# Some earlier versions of next.js "optimized" away this array structure; this is unsupported
# Ref: https://github.com/vercel/next.js/commit/0123a9d5c9a9a77a86f135b7ae30b46ca986d761