aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/search.py
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2018-07-31 17:03:47 -0700
committerJames Taylor <user234683@users.noreply.github.com>2018-07-31 17:03:47 -0700
commit1dc2cb0ab6025af4d5e4c705eb0134108c53c024 (patch)
tree225ac6c05e67e60b78c8a3a700e05a0376f3f87a /youtube/search.py
parentdcc3183411e3173c570ceab0b7a5d9534b3b284b (diff)
downloadyt-local-1dc2cb0ab6025af4d5e4c705eb0134108c53c024.tar.lz
yt-local-1dc2cb0ab6025af4d5e4c705eb0134108c53c024.tar.xz
yt-local-1dc2cb0ab6025af4d5e4c705eb0134108c53c024.zip
Return blank page for searching when visiting just localhost/youtube.com
Diffstat (limited to 'youtube/search.py')
-rw-r--r--youtube/search.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/youtube/search.py b/youtube/search.py
index 406dc82..8bb3aff 100644
--- a/youtube/search.py
+++ b/youtube/search.py
@@ -9,9 +9,6 @@ from youtube import common, proto
with open("yt_search_results_template.html", "r") as file:
yt_search_results_template = file.read()
-
-with open("yt_search_template.html", "r") as file:
- yt_search_template = file.read()
page_button_template = Template('''<a class="page-button" href="$href">$page</a>''')
current_page_button_template = Template('''<div class="page-button">$page</div>''')
@@ -83,7 +80,12 @@ did_you_mean = Template('''
def get_search_page(query_string, parameters=()):
qs_query = urllib.parse.parse_qs(query_string)
if len(qs_query) == 0:
- return yt_search_template
+ return common.yt_basic_template.substitute(
+ page_title = "Search",
+ header = common.get_header(),
+ style = '',
+ page = '',
+ )
query = qs_query["query"][0]
page = qs_query.get("page", "1")[0]
autocorrect = int(qs_query.get("autocorrect", "1")[0])