]>
git.gir.st - subscriptionfeed.git/blob - app/dangerous/__init__.py
1 # this is an alternative to proxying through invidious. the search endpoint has only been (loosely) tested by
2 #17:50 < perflyst[m]> appears to be working
3 #, so i hopeā¢ this works. if not, that's why it's in the 'dangerous' blueprint
5 from flask
import Blueprint
, render_template
, request
, flash
, g
, url_for
7 from ..common
.common
import *
10 frontend
= Blueprint('dangerous', __name__
,
11 template_folder
='templates',
12 static_folder
='static',
13 static_url_path
='/static/ys')
15 @frontend.route('/search')
17 #token = getattr(current_user, 'token', 'guest')
18 q
= request
.args
.get('q')
19 page
= int(request
.args
.get('page', 1))
21 sp
= None #TODO: search filters (protobuf)
22 # https://github.com/iv-org/invidious/blob/452d1e8307d6344dd51c5437ccd032a566291c34/src/invidious/search.cr#L266
25 yt_results
= fetch_searchresults(q
, page
, sp
)
27 results
= prepare_searchresults(yt_results
)
31 return render_template('search.html.j2', rows
=results
, query
=q
, page
=page
)
33 @frontend.before_app_request
35 if not 'header_items' in g
:
37 g
.header_items
.append({
39 'url': url_for('dangerous.search'),
40 'parent': frontend
.name
,