|
@@ -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)
|