Format files
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
@@ -24,11 +25,13 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
label {
|
label {
|
||||||
display: block;
|
display: block;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=text] {
|
input[type=text] {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
@@ -38,6 +41,7 @@
|
|||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type="submit"] {
|
input[type="submit"] {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
background-color: #6a0dad;
|
background-color: #6a0dad;
|
||||||
@@ -50,6 +54,7 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: background-color 0.3s ease;
|
transition: background-color 0.3s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type="submit"]:hover {
|
input[type="submit"]:hover {
|
||||||
background-color: #4e0875;
|
background-color: #4e0875;
|
||||||
}
|
}
|
||||||
@@ -59,12 +64,14 @@
|
|||||||
form {
|
form {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
font-size: 1.2rem;
|
font-size: 1.2rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<form action="/article" method="post">
|
<form action="/article" method="post">
|
||||||
<h1>Enter Website Link</h1>
|
<h1>Enter Website Link</h1>
|
||||||
@@ -73,4 +80,5 @@
|
|||||||
<input type="submit" value="Submit">
|
<input type="submit" value="Submit">
|
||||||
</form>
|
</form>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
+6
-3
@@ -22,6 +22,7 @@ def bypass_paywall(url):
|
|||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
return bypass_paywall("http://" + url)
|
return bypass_paywall("http://" + url)
|
||||||
|
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
def main_page():
|
def main_page():
|
||||||
return flask.send_from_directory(".", "index.html")
|
return flask.send_from_directory(".", "index.html")
|
||||||
@@ -37,14 +38,15 @@ def show_article():
|
|||||||
except e:
|
except e:
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
|
|
||||||
@app.route("/", defaults={"path": ""})
|
@app.route("/", defaults={"path": ""})
|
||||||
@app.route('/<path:path>', methods=["GET"])
|
@app.route("/<path:path>", methods=["GET"])
|
||||||
def get_article(path):
|
def get_article(path):
|
||||||
print(path)
|
print(path)
|
||||||
full_url = request.url
|
full_url = request.url
|
||||||
parts = full_url.split('/',4)
|
parts = full_url.split("/", 4)
|
||||||
if len(parts) >= 5:
|
if len(parts) >= 5:
|
||||||
actual_url = 'https://' + parts[4].lstrip('/')
|
actual_url = "https://" + parts[4].lstrip("/")
|
||||||
print(actual_url)
|
print(actual_url)
|
||||||
try:
|
try:
|
||||||
return bypass_paywall(actual_url)
|
return bypass_paywall(actual_url)
|
||||||
@@ -55,4 +57,5 @@ def get_article(path):
|
|||||||
else:
|
else:
|
||||||
return "Invalid URL", 400
|
return "Invalid URL", 400
|
||||||
|
|
||||||
|
|
||||||
app.run(debug=False)
|
app.run(debug=False)
|
||||||
|
|||||||
+6
-4
@@ -85,6 +85,7 @@ html = """
|
|||||||
</html>
|
</html>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def bypass_paywall(url):
|
def bypass_paywall(url):
|
||||||
"""
|
"""
|
||||||
Bypass paywall for a given url
|
Bypass paywall for a given url
|
||||||
@@ -109,13 +110,14 @@ def show_article():
|
|||||||
except e:
|
except e:
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
|
|
||||||
@app.route("/", defaults={"path": ""})
|
@app.route("/", defaults={"path": ""})
|
||||||
@app.route('/<path:path>', methods=["GET"])
|
@app.route("/<path:path>", methods=["GET"])
|
||||||
def get_article(path):
|
def get_article(path):
|
||||||
full_url = request.url
|
full_url = request.url
|
||||||
parts = full_url.split('/',4)
|
parts = full_url.split("/", 4)
|
||||||
if len(parts) >= 5:
|
if len(parts) >= 5:
|
||||||
actual_url = 'https://' + parts[4].lstrip('/')
|
actual_url = "https://" + parts[4].lstrip("/")
|
||||||
try:
|
try:
|
||||||
return bypass_paywall(actual_url)
|
return bypass_paywall(actual_url)
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
@@ -126,4 +128,4 @@ def get_article(path):
|
|||||||
return "Invalid URL", 400
|
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user