aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/search.py
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2019-01-06 01:33:52 -0800
committerJames Taylor <user234683@users.noreply.github.com>2019-01-06 01:33:52 -0800
commitbb2d40ac83f222678ed5b4265355b9f146f2ba3e (patch)
tree836262b08777a3ad9e23c700d1c4f81d45ffe73c /youtube/search.py
parenteea16e5ac32696ea711fbc3846c113ccdfd2928b (diff)
downloadyt-local-bb2d40ac83f222678ed5b4265355b9f146f2ba3e.tar.lz
yt-local-bb2d40ac83f222678ed5b4265355b9f146f2ba3e.tar.xz
yt-local-bb2d40ac83f222678ed5b4265355b9f146f2ba3e.zip
rename env['fields'] to env['parameters'] and rename fields to parameters in general
Diffstat (limited to 'youtube/search.py')
-rw-r--r--youtube/search.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/youtube/search.py b/youtube/search.py
index 2b90998..4ffa2ba 100644
--- a/youtube/search.py
+++ b/youtube/search.py
@@ -68,22 +68,22 @@ did_you_mean = Template('''
''')
def get_search_page(env, start_response):
start_response('200 OK', [('Content-type','text/html'),])
- fields = env['fields']
- if len(fields) == 0:
+ parameters = env['parameters']
+ if len(parameters) == 0:
return common.yt_basic_template.substitute(
page_title = "Search",
header = common.get_header(),
style = '',
page = '',
).encode('utf-8')
- query = fields["query"][0]
- page = fields.get("page", "1")[0]
- autocorrect = int(fields.get("autocorrect", "1")[0])
- sort = int(fields.get("sort", "0")[0])
+ query = parameters["query"][0]
+ page = parameters.get("page", "1")[0]
+ autocorrect = int(parameters.get("autocorrect", "1")[0])
+ sort = int(parameters.get("sort", "0")[0])
filters = {}
- filters['time'] = int(fields.get("time", "0")[0])
- filters['type'] = int(fields.get("type", "0")[0])
- filters['duration'] = int(fields.get("duration", "0")[0])
+ filters['time'] = int(parameters.get("time", "0")[0])
+ filters['type'] = int(parameters.get("type", "0")[0])
+ filters['duration'] = int(parameters.get("duration", "0")[0])
info = get_search_json(query, page, autocorrect, sort, filters)
estimated_results = int(info[1]['response']['estimatedResults'])
@@ -98,7 +98,7 @@ def get_search_page(env, start_response):
continue
if type == 'didYouMeanRenderer':
renderer = renderer[type]
- corrected_query_string = fields.copy()
+ corrected_query_string = parameters.copy()
corrected_query_string['query'] = [renderer['correctedQueryEndpoint']['searchEndpoint']['query']]
corrected_query_url = URL_ORIGIN + '/search?' + urllib.parse.urlencode(corrected_query_string, doseq=True)
corrections = did_you_mean.substitute(
@@ -108,7 +108,7 @@ def get_search_page(env, start_response):
continue
if type == 'showingResultsForRenderer':
renderer = renderer[type]
- no_autocorrect_query_string = fields.copy()
+ no_autocorrect_query_string = parameters.copy()
no_autocorrect_query_string['autocorrect'] = ['0']
no_autocorrect_query_url = URL_ORIGIN + '/search?' + urllib.parse.urlencode(no_autocorrect_query_string, doseq=True)
corrections = showing_results_for.substitute(