Browse Source

Clean up some unnecessary code

Signed-off-by: Skylar "The Cobra" Widulski <cobra@vern.cc>
Skylar "The Cobra" Widulski 1 year ago
parent
commit
b7ab6f9b74
1 changed files with 1 additions and 5 deletions
  1. 1 5
      main.py

+ 1 - 5
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)