1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-08-13 16:08:29 +00:00

traverse_obj: allow traversal of dataclasses (for protobug)

This commit is contained in:
garret1317 2025-08-11 08:20:24 +01:00
parent bf366517ef
commit a9df16db47

View File

@ -3,6 +3,7 @@
import collections
import collections.abc
import contextlib
import dataclasses
import functools
import http.cookies
import inspect
@ -233,6 +234,8 @@ def apply_specials(element):
result = list(map(apply_specials, obj.iterfind(xpath)))
else:
result = apply_specials(obj)
elif dataclasses.is_dataclass(obj):
result = getattr(obj, key)
return branching, result if branching else (result,)