Format files

This commit is contained in:
Wasi Master
2024-08-14 13:17:52 +06:00
parent c641ec68d9
commit d7260ebd7c
3 changed files with 23 additions and 10 deletions
+6 -4
View File
@@ -85,6 +85,7 @@ html = """
</html>
"""
def bypass_paywall(url):
"""
Bypass paywall for a given url
@@ -109,13 +110,14 @@ def show_article():
except e:
raise e
@app.route("/", defaults={"path": ""})
@app.route('/<path:path>', methods=["GET"])
@app.route("/<path:path>", methods=["GET"])
def get_article(path):
full_url = request.url
parts = full_url.split('/',4)
parts = full_url.split("/", 4)
if len(parts) >= 5:
actual_url = 'https://' + parts[4].lstrip('/')
actual_url = "https://" + parts[4].lstrip("/")
try:
return bypass_paywall(actual_url)
except requests.exceptions.RequestException as e:
@@ -126,4 +128,4 @@ def get_article(path):
return "Invalid URL", 400
app.run(host='0.0.0.0', port=5000, debug=False)
app.run(host="0.0.0.0", port=5000, debug=False)