Spaces:
Running
Running
BraydenMoore
commited on
Commit
·
2a30750
1
Parent(s):
c620f9f
Update main.py
Browse files
main.py
CHANGED
@@ -5,6 +5,7 @@ import pickle as pkl
|
|
5 |
import pycountry
|
6 |
import datetime as dt
|
7 |
import pytz
|
|
|
8 |
|
9 |
app = Flask(__name__)
|
10 |
app.secret_key = 'green-flounder'
|
@@ -18,13 +19,6 @@ with open('live_urls.pkl', 'rb') as f:
|
|
18 |
with open('active_urls.pkl', 'rb') as f:
|
19 |
live_urls = pkl.load(f)
|
20 |
|
21 |
-
from io import BytesIO
|
22 |
-
url = 'https://storage.googleapis.com/bmllc-data-bucket/exceptions.pkl'
|
23 |
-
response = requests.get(url)
|
24 |
-
exceptions = pkl.loads(BytesIO(response.content).read())
|
25 |
-
|
26 |
-
live_urls = [i for i in live_urls if i not in exceptions]
|
27 |
-
|
28 |
def get_ip_info(ip_address):
|
29 |
try:
|
30 |
response = requests.get(f"http://ipinfo.io/{ip_address}/json")
|
@@ -45,6 +39,10 @@ from urllib.parse import urlparse, parse_qs
|
|
45 |
|
46 |
@app.route('/proxy/<path:url>')
|
47 |
def proxy(url):
|
|
|
|
|
|
|
|
|
48 |
headers = {
|
49 |
'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',
|
50 |
'Accept-Encoding': 'gzip, deflate',
|
@@ -81,6 +79,13 @@ def proxy(url):
|
|
81 |
|
82 |
@app.route('/')
|
83 |
def index():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
if 'current_feed' in session and request.args.get('new', 'false') == 'false':
|
85 |
feed = session['current_feed']
|
86 |
else:
|
|
|
5 |
import pycountry
|
6 |
import datetime as dt
|
7 |
import pytz
|
8 |
+
from io import BytesIO
|
9 |
|
10 |
app = Flask(__name__)
|
11 |
app.secret_key = 'green-flounder'
|
|
|
19 |
with open('active_urls.pkl', 'rb') as f:
|
20 |
live_urls = pkl.load(f)
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
def get_ip_info(ip_address):
|
23 |
try:
|
24 |
response = requests.get(f"http://ipinfo.io/{ip_address}/json")
|
|
|
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',
|
48 |
'Accept-Encoding': 'gzip, deflate',
|
|
|
79 |
|
80 |
@app.route('/')
|
81 |
def index():
|
82 |
+
url = 'https://storage.googleapis.com/bmllc-data-bucket/exceptions.pkl'
|
83 |
+
response = requests.get(url)
|
84 |
+
exceptions = pkl.loads(BytesIO(response.content).read())
|
85 |
+
print(exceptions)
|
86 |
+
|
87 |
+
live_urls = [i for i in live_urls if i not in exceptions]
|
88 |
+
|
89 |
if 'current_feed' in session and request.args.get('new', 'false') == 'false':
|
90 |
feed = session['current_feed']
|
91 |
else:
|