aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/yt_data_extract
diff options
context:
space:
mode:
Diffstat (limited to 'youtube/yt_data_extract')
-rw-r--r--youtube/yt_data_extract/common.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/youtube/yt_data_extract/common.py b/youtube/yt_data_extract/common.py
index 3dda8eb..8d91f26 100644
--- a/youtube/yt_data_extract/common.py
+++ b/youtube/yt_data_extract/common.py
@@ -376,8 +376,12 @@ def extract_items_from_renderer(renderer, item_types=_item_types):
# mode 2: dig into the current renderer
key, value = list(renderer.items())[0]
+ # the renderer is an item
+ if key in item_types:
+ items.append(renderer)
+
# has a list in it, add it to the iter stack
- if key in nested_renderer_list_dispatch:
+ elif key in nested_renderer_list_dispatch:
renderer_list, continuation = nested_renderer_list_dispatch[key](value)
if renderer_list:
iter_stack.append(current_iter)
@@ -390,10 +394,6 @@ def extract_items_from_renderer(renderer, item_types=_item_types):
renderer = nested_renderer_dispatch[key](value)
continue # don't reset renderer to None
- # the renderer is an item
- elif key in item_types:
- items.append(renderer)
-
renderer = None
def extract_items(response, item_types=_item_types):