Extraction: Proper error handling for terminated or non-existant channels

This commit is contained in:
James Taylor
2019-09-08 17:48:02 -07:00
parent bd343ed71f
commit 216231f9a6
3 changed files with 18 additions and 7 deletions

View File

@@ -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