diff options
author | James Taylor <user234683@users.noreply.github.com> | 2019-09-27 19:27:19 -0700 |
---|---|---|
committer | James Taylor <user234683@users.noreply.github.com> | 2019-09-27 19:27:19 -0700 |
commit | 9abb83fdbc05294f186daeefff8c85cfda06b7d2 (patch) | |
tree | 1d04c83f88d67d844624ced65477f88f22d92455 /youtube/search.py | |
parent | e68ac26b4e2c216dad41e22da91067e2ddc80d00 (diff) | |
download | yt-local-9abb83fdbc05294f186daeefff8c85cfda06b7d2.tar.lz yt-local-9abb83fdbc05294f186daeefff8c85cfda06b7d2.tar.xz yt-local-9abb83fdbc05294f186daeefff8c85cfda06b7d2.zip |
Extraction: Fix did_you_mean and showing_results_for
Diffstat (limited to 'youtube/search.py')
-rw-r--r-- | youtube/search.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/youtube/search.py b/youtube/search.py index ba40f0b..cb66744 100644 --- a/youtube/search.py +++ b/youtube/search.py @@ -83,6 +83,17 @@ def get_search_page(): yt_data_extract.prefix_urls(item_info) yt_data_extract.add_extra_html_info(item_info) + corrections = search_info['corrections'] + if corrections['type'] == 'did_you_mean': + corrected_query_string = request.args.to_dict(flat=False) + corrected_query_string['query'] = [corrections['corrected_query']] + corrections['corrected_query_url'] = util.URL_ORIGIN + '/search?' + urllib.parse.urlencode(corrected_query_string, doseq=True) + elif corrections['type'] == 'showing_results_for': + no_autocorrect_query_string = request.args.to_dict(flat=False) + no_autocorrect_query_string['autocorrect'] = ['0'] + no_autocorrect_query_url = util.URL_ORIGIN + '/search?' + urllib.parse.urlencode(no_autocorrect_query_string, doseq=True) + corrections['original_query_url'] = no_autocorrect_query_url + return flask.render_template('search.html', header_playlist_names = local_playlist.get_playlist_names(), query = query, |