From b7ab6f9b74eaf51042d649339dcf3087a2bf3472 Mon Sep 17 00:00:00 2001 From: "Skylar \"The Cobra\" Widulski" Date: Mon, 21 Aug 2023 15:30:38 -0400 Subject: [PATCH] Clean up some unnecessary code Signed-off-by: Skylar "The Cobra" Widulski --- main.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/main.py b/main.py index 00ed5ad..7f7da95 100644 --- a/main.py +++ b/main.py @@ -32,9 +32,6 @@ def scrape(url): pages = "" return (ret, pages) -def render(data): - return render_template('index.html', data=data) - app = Flask(__name__, template_folder="templates", static_folder="static") @app.route('/', defaults={'path': ''}) @@ -43,8 +40,7 @@ def catch_all(path): scraped = scrape(f"https://urbandictionary.com/{re.sub(r'.*://.*/', '/', request.url)}") if type(scraped) == str and scraped.startswith("REDIRECT"): return redirect(scraped.replace("REDIRECT ", ""), 302) - scraped = (scraped[0], str(scraped[1]).replace("»", "»").replace("›", "›").replace("«", "«").replace("‹", "‹")) - return render(scraped) + return render_template('index.html', data=scraped) if __name__ == '__main__': app.run(port=8000)