aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/search.py
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2019-09-18 21:39:53 -0700
committerJames Taylor <user234683@users.noreply.github.com>2019-09-19 11:06:34 -0700
commitdc6c370152d063ad4198c747fc12eb06fc1ec0e4 (patch)
treeaf8fe44dd7440fde043040f2f2485aa31e22a6d9 /youtube/search.py
parent89e5761f8d9ae4221c4a97eca3c0fce3405a5bc4 (diff)
downloadyt-local-dc6c370152d063ad4198c747fc12eb06fc1ec0e4.tar.lz
yt-local-dc6c370152d063ad4198c747fc12eb06fc1ec0e4.tar.xz
yt-local-dc6c370152d063ad4198c747fc12eb06fc1ec0e4.zip
Extraction: refactor response extraction to work with both mobile & desktop respones, also improve errors
Diffstat (limited to 'youtube/search.py')
-rw-r--r--youtube/search.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/youtube/search.py b/youtube/search.py
index 81a69f2..ba40f0b 100644
--- a/youtube/search.py
+++ b/youtube/search.py
@@ -76,6 +76,9 @@ def get_search_page():
polymer_json = get_search_json(query, page, autocorrect, sort, filters)
search_info = yt_data_extract.extract_search_info(polymer_json)
+ if search_info['error']:
+ return flask.render_template('error.html', error_message = search_info['error'])
+
for item_info in search_info['items']:
yt_data_extract.prefix_urls(item_info)
yt_data_extract.add_extra_html_info(item_info)