diff options
author | James Taylor <user234683@users.noreply.github.com> | 2019-12-23 15:07:03 -0800 |
---|---|---|
committer | James Taylor <user234683@users.noreply.github.com> | 2019-12-23 15:07:03 -0800 |
commit | 9737ffcf827bb04f3f84929cefb9f051c7b5ee95 (patch) | |
tree | 07734f129b459d6e8f2159f89870188157bd84ae /youtube/yt_data_extract | |
parent | 777ed756dcfd01845451937fb38559ee57ec44e9 (diff) | |
download | yt-local-9737ffcf827bb04f3f84929cefb9f051c7b5ee95.tar.lz yt-local-9737ffcf827bb04f3f84929cefb9f051c7b5ee95.tar.xz yt-local-9737ffcf827bb04f3f84929cefb9f051c7b5ee95.zip |
Regression: Fix channel extraction 'items' key not present when there's no items.
Examples: Empty channels, no search results
Diffstat (limited to 'youtube/yt_data_extract')
-rw-r--r-- | youtube/yt_data_extract/everything_else.py | 5 |
1 files changed, 3 insertions, 2 deletions
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']} |