mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-06-28 01:18:30 +00:00
cleanup
Authored by: bashonly
This commit is contained in:
parent
7894a0e98b
commit
9986c49ac6
@ -1784,10 +1784,6 @@ def _search_nextjs_v13_data(self, webpage, video_id, fatal=True):
|
|||||||
nextjs_data = []
|
nextjs_data = []
|
||||||
if not fatal and not isinstance(webpage, str):
|
if not fatal and not isinstance(webpage, str):
|
||||||
return nextjs_data
|
return nextjs_data
|
||||||
# This regex pattern can afford to be and should be strict
|
|
||||||
# Ref: https://github.com/vercel/next.js/commit/5a4a08fdce91a038f2ed3a70568d3ed040403150
|
|
||||||
# /packages/next/src/server/app-render/use-flight-response.tsx
|
|
||||||
flight_segments = re.findall(r'<script[^>]*>self\.__next_f\.push\((\[.+?\])\)</script>', webpage)
|
|
||||||
|
|
||||||
def flatten(flight_data):
|
def flatten(flight_data):
|
||||||
if not isinstance(flight_data, list) or not flight_data:
|
if not isinstance(flight_data, list) or not flight_data:
|
||||||
@ -1805,7 +1801,10 @@ def flatten(flight_data):
|
|||||||
for f in flight_data:
|
for f in flight_data:
|
||||||
flatten(f)
|
flatten(f)
|
||||||
|
|
||||||
for flight_segment in flight_segments:
|
# The flight segments regex pattern can afford to be (and should be) strict
|
||||||
|
# Ref: https://github.com/vercel/next.js/commit/5a4a08fdce91a038f2ed3a70568d3ed040403150
|
||||||
|
# /packages/next/src/server/app-render/use-flight-response.tsx
|
||||||
|
for flight_segment in re.findall(r'<script[^>]*>self\.__next_f\.push\((\[.+?\])\)</script>', webpage):
|
||||||
segment = self._parse_json(flight_segment, video_id, fatal=fatal, errnote=None if fatal else False)
|
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
|
# Some earlier versions of next.js "optimized" away this array structure; this is unsupported
|
||||||
# Ref: https://github.com/vercel/next.js/commit/0123a9d5c9a9a77a86f135b7ae30b46ca986d761
|
# Ref: https://github.com/vercel/next.js/commit/0123a9d5c9a9a77a86f135b7ae30b46ca986d761
|
||||||
|
Loading…
Reference in New Issue
Block a user