prepend your domain and it works
just add yourdomain.tld/ before the url and it will bypass the paywall!
This commit is contained in:
+13
@@ -1,5 +1,6 @@
|
|||||||
import flask
|
import flask
|
||||||
import requests
|
import requests
|
||||||
|
from flask import request
|
||||||
|
|
||||||
app = flask.Flask(__name__)
|
app = flask.Flask(__name__)
|
||||||
googlebot_headers = {
|
googlebot_headers = {
|
||||||
@@ -94,6 +95,7 @@ def bypass_paywall(url):
|
|||||||
"""
|
"""
|
||||||
response = requests.get(url, headers=googlebot_headers)
|
response = requests.get(url, headers=googlebot_headers)
|
||||||
response.encoding = response.apparent_encoding
|
response.encoding = response.apparent_encoding
|
||||||
|
# response.encoding = 'UTF-8'
|
||||||
return response.text
|
return response.text
|
||||||
|
|
||||||
|
|
||||||
@@ -107,5 +109,16 @@ def show_article():
|
|||||||
link = flask.request.form["link"]
|
link = flask.request.form["link"]
|
||||||
return bypass_paywall(link)
|
return bypass_paywall(link)
|
||||||
|
|
||||||
|
@app.route("/", defaults={"path": ""})
|
||||||
|
@app.route('/<path:path>', methods=["GET"])
|
||||||
|
def get_article(path):
|
||||||
|
full_url = request.url
|
||||||
|
parts = full_url.split('/',4)
|
||||||
|
if len(parts) >= 5:
|
||||||
|
actual_url = 'https://' + parts[4]
|
||||||
|
return bypass_paywall(actual_url)
|
||||||
|
else:
|
||||||
|
return "invalid url", 400
|
||||||
|
|
||||||
|
|
||||||
app.run(debug=True)
|
app.run(debug=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user