aboutsummaryrefslogtreecommitdiffstats
path: root/youtube
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2019-07-21 22:28:57 -0700
committerJames Taylor <user234683@users.noreply.github.com>2019-07-21 22:28:57 -0700
commit86382706fe87afc63b2757a1a133497c75ce3cd2 (patch)
treed029e8d5a5ffd3c9c8b6fec502168d2ee21171ae /youtube
parent2837d9db2b757b1ca54c4523e2644cee6b3798f2 (diff)
downloadyt-local-86382706fe87afc63b2757a1a133497c75ce3cd2.tar.lz
yt-local-86382706fe87afc63b2757a1a133497c75ce3cd2.tar.xz
yt-local-86382706fe87afc63b2757a1a133497c75ce3cd2.zip
Add flask Firefox search engine route
Diffstat (limited to 'youtube')
-rw-r--r--youtube/search.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/youtube/search.py b/youtube/search.py
index 76a814c..39a80bf 100644
--- a/youtube/search.py
+++ b/youtube/search.py
@@ -1,10 +1,12 @@
from youtube import util, yt_data_extract, proto, local_playlist
from youtube import yt_app
+import settings
import json
import urllib
import base64
from math import ceil
+import mimetypes
from flask import request
import flask
@@ -124,4 +126,8 @@ def get_search_page():
parameters_dictionary = request.args,
)
-
+@yt_app.route('/opensearch.xml')
+def get_search_engine_xml():
+ with open("youtube/opensearch.xml", 'rb') as f:
+ content = f.read().replace(b'$port_number', str(settings.port_number).encode())
+ return flask.Response(content, mimetype='application/xml')