Extraction: refactor response extraction to work with both mobile & desktop respones, also improve errors

This commit is contained in:
James Taylor
2019-09-18 21:39:53 -07:00
parent 89e5761f8d
commit dc6c370152
5 changed files with 54 additions and 23 deletions

View File

@@ -186,8 +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']))
if info['error']:
return flask.render_template('error.html', error_message = info['error'])
post_process_channel_info(info)
if tab in ('videos', 'search'):
info['number_of_videos'] = number_of_videos
@@ -228,8 +228,8 @@ 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']))
if info['error']:
return flask.render_template('error.html', error_message = info['error'])
post_process_channel_info(info)
if tab in ('videos', 'search'):