Spaces:
Running
Running
Commit
·
c7b2f25
1
Parent(s):
75c1c40
Update main.py
Browse files
main.py
CHANGED
@@ -39,9 +39,6 @@ from urllib.parse import urlparse, parse_qs
|
|
39 |
|
40 |
@app.route('/proxy/<path:url>')
|
41 |
def proxy(url):
|
42 |
-
url = 'https://storage.googleapis.com/bmllc-data-bucket/exceptions.pkl'
|
43 |
-
response = requests.get(url)
|
44 |
-
exceptions = pkl.loads(BytesIO(response.content).read())
|
45 |
|
46 |
headers = {
|
47 |
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
|
@@ -67,27 +64,11 @@ def proxy(url):
|
|
67 |
|
68 |
except:
|
69 |
print(f'Redirecting')
|
70 |
-
exceptions.append(url)
|
71 |
-
byte_stream = BytesIO()
|
72 |
-
pkl.dump(exceptions, byte_stream)
|
73 |
-
byte_stream.seek(0)
|
74 |
-
url = 'https://storage.googleapis.com/bmllc-data-bucket/exceptions.pkl'
|
75 |
-
response = requests.put(url, data=byte_stream.read())
|
76 |
-
print(response)
|
77 |
return send_file('static/error.png', mimetype='image/png')
|
78 |
|
79 |
|
80 |
@app.route('/')
|
81 |
def index():
|
82 |
-
with open('active_urls.pkl', 'rb') as f:
|
83 |
-
live_urls = pkl.load(f)
|
84 |
-
|
85 |
-
url = 'https://storage.googleapis.com/bmllc-data-bucket/exceptions.pkl'
|
86 |
-
response = requests.get(url)
|
87 |
-
exceptions = pkl.loads(BytesIO(response.content).read())
|
88 |
-
print(exceptions)
|
89 |
-
|
90 |
-
live_urls = [i for i in live_urls if i not in exceptions]
|
91 |
|
92 |
if 'current_feed' in session and request.args.get('new', 'false') == 'false':
|
93 |
feed = session['current_feed']
|
|
|
39 |
|
40 |
@app.route('/proxy/<path:url>')
|
41 |
def proxy(url):
|
|
|
|
|
|
|
42 |
|
43 |
headers = {
|
44 |
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
|
|
|
64 |
|
65 |
except:
|
66 |
print(f'Redirecting')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
return send_file('static/error.png', mimetype='image/png')
|
68 |
|
69 |
|
70 |
@app.route('/')
|
71 |
def index():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
|
73 |
if 'current_feed' in session and request.args.get('new', 'false') == 'false':
|
74 |
feed = session['current_feed']
|