diff options
author | James Taylor <user234683@users.noreply.github.com> | 2019-09-08 17:48:02 -0700 |
---|---|---|
committer | James Taylor <user234683@users.noreply.github.com> | 2019-09-08 17:48:02 -0700 |
commit | 216231f9a6ca9ed48389e797a0c30d7d3b01e379 (patch) | |
tree | 1fed2d2b6b4cce1db21f7a27809282b4ac95e4a1 /youtube/channel.py | |
parent | bd343ed71f628e0f1dd1eb3f45fb4e04887f223f (diff) | |
download | yt-local-216231f9a6ca9ed48389e797a0c30d7d3b01e379.tar.lz yt-local-216231f9a6ca9ed48389e797a0c30d7d3b01e379.tar.xz yt-local-216231f9a6ca9ed48389e797a0c30d7d3b01e379.zip |
Extraction: Proper error handling for terminated or non-existant channels
Diffstat (limited to 'youtube/channel.py')
-rw-r--r-- | youtube/channel.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/youtube/channel.py b/youtube/channel.py index 16d0a3f..3a2a0b3 100644 --- a/youtube/channel.py +++ b/youtube/channel.py @@ -186,6 +186,8 @@ def get_channel_page(channel_id, tab='videos'): info = yt_data_extract.extract_channel_info(json.loads(polymer_json), tab) + if info['errors']: + return flask.render_template('error.html', error_message = '\n'.join(info['errors'])) post_process_channel_info(info) if tab in ('videos', 'search'): info['number_of_videos'] = number_of_videos @@ -226,6 +228,9 @@ def get_channel_page_general_url(base_url, tab, request): info = yt_data_extract.extract_channel_info(json.loads(polymer_json), tab) + if info['errors']: + return flask.render_template('error.html', error_message = '\n'.join(info['errors'])) + post_process_channel_info(info) if tab in ('videos', 'search'): info['number_of_videos'] = 1000 |