Last active 1 day ago

there was no logo image at that time, but I have one now.

swee revised this gist 1 day ago. Go to revision

2 files changed, 51 insertions

flask_app.py(file created)

@@ -0,0 +1,29 @@
1 + from flask import Flask, send_file, request
2 + from duckduckgo_search import DDGS
3 + app = Flask(__name__)
4 +
5 + @app.route('/use')
6 + def ushome():
7 + return send_file("use.html", mimetype='text/html')
8 +
9 + @app.route('/use/search')
10 + def usearch():
11 + result = DDGS().text(request.args.get('q'))
12 + html = """<!DOCTYPE html>
13 + <html data-bs-theme="dark" class="container text-white bg-dark">
14 + <head>
15 + <title>""" + request.args.get('q') + """ - USE</title>
16 + <meta name="viewport" content="width=device-width, initial-scale=1.0">
17 + <meta name='description' content='Search engine with maximum compatibility.'>
18 + <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet">
19 + <head>
20 + </head>
21 + <body class="container text-white bg-dark">
22 + <a href="/use"><img alt=UnnamedSearchEngine></a>
23 + <form action=/use/search><input class="form-control bg-dark text-white" name=q type=text value=\"""" + request.args.get('q') + """\"><input class="btn btn-primary" type=submit value="Web search"></form><hr>"""
24 + for i in result:
25 + html += """<div class="container bg-dark text-white">
26 + <a href=\""""+i['href']+"""\"><h3>"""+i['title']+"""</h3><p>"""+i['href']+"""</p></a>
27 + <p>"""+i['body']+"""</p>
28 + </div>"""
29 + return html

use.html(file created)

@@ -0,0 +1,22 @@
1 + <!DOCTYPE html>
2 + <html data-bs-theme="dark" class="container text-white bg-dark">
3 + <head>
4 + <title>UnnamedSearchEngine</title>
5 + <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 + <meta name='description' content='Search engine with maximum compatibility.'>
7 + <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet">
8 + <head>
9 + </head>
10 + <body class="container text-white bg-dark">
11 + <center>
12 + <center>
13 + <img alt="Unnamed Search Engine">
14 + <hr>
15 + <form action=/use/search>
16 + <input name=q class="form-control text-white bg-dark" placeholder=Search...>
17 + <br>
18 + <input type=submit value="Web Search" class="btn btn-primary">
19 + </form>
20 + </center>
21 + </body>
22 + </html>
Newer Older