From 9737ffcf827bb04f3f84929cefb9f051c7b5ee95 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Mon, 23 Dec 2019 15:07:03 -0800 Subject: Regression: Fix channel extraction 'items' key not present when there's no items. Examples: Empty channels, no search results --- youtube/yt_data_extract/everything_else.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'youtube') diff --git a/youtube/yt_data_extract/everything_else.py b/youtube/yt_data_extract/everything_else.py index 5194693..ac1ab7d 100644 --- a/youtube/yt_data_extract/everything_else.py +++ b/youtube/yt_data_extract/everything_else.py @@ -52,12 +52,13 @@ def extract_channel_info(polymer_json, tab): else: info['channel_url'] = None + # get items + info['items'] = [] + # empty channel if 'contents' not in response and 'continuationContents' not in response: return info - # get items - info['items'] = [] if tab in ('videos', 'playlists', 'search'): items, ctoken = extract_items(response) additional_info = {'author': info['channel_name'], 'author_url': info['channel_url']} -- cgit v1.2.3