Merge pull request #17 from Joao620/auto-protocol

Adding default protocol to URL inputs
This commit is contained in:
Wasi Master
2024-08-14 12:57:22 +06:00
committed by GitHub
+5
View File
@@ -12,10 +12,15 @@ def bypass_paywall(url):
""" """
Bypass paywall for a given url Bypass paywall for a given url
""" """
if url.startswith("http"):
response = requests.get(url, headers=googlebot_headers) response = requests.get(url, headers=googlebot_headers)
response.encoding = response.apparent_encoding response.encoding = response.apparent_encoding
return response.text return response.text
try:
return bypass_paywall("https://" + url)
except requests.exceptions.RequestException as e:
return bypass_paywall("http://" + url)
@app.route("/") @app.route("/")
def main_page(): def main_page():