BraydenMoore commited on
Commit
5128471
·
1 Parent(s): f4f97f3

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +9 -1
main.py CHANGED
@@ -18,6 +18,11 @@ 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
  def get_ip_info(ip_address):
22
  try:
23
  response = requests.get(f"http://ipinfo.io/{ip_address}/json")
@@ -62,6 +67,9 @@ def proxy(url):
62
 
63
  except:
64
  print(f'Redirecting')
 
 
 
65
  return send_file('static/error.png', mimetype='image/png')
66
 
67
 
@@ -74,7 +82,7 @@ def index():
74
  session['current_feed'] = feed
75
 
76
  #url = feed_dict[feed]['url']
77
- url = live_urls[feed].replace('COUNTER',str(random.randint(0,100000)))
78
  ip = ''.join(url.split('//')[-1]).split(':')[0]
79
  info = get_ip_info(ip)
80
  country = (pycountry.countries.get(alpha_2=info['country']).name).lower()
 
18
  with open('active_urls.pkl', 'rb') as f:
19
  live_urls = pkl.load(f)
20
 
21
+ with open('exceptions.pkl', 'rb') as f:
22
+ exceptions = pkl.load(f)
23
+
24
+ live_urls = [i for i in live_urls if i not in exceptions]
25
+
26
  def get_ip_info(ip_address):
27
  try:
28
  response = requests.get(f"http://ipinfo.io/{ip_address}/json")
 
67
 
68
  except:
69
  print(f'Redirecting')
70
+ exceptions.append(url)
71
+ with open('exceptions.pkl', 'wb') as f:
72
+ pkl.dump(exceptions, f)
73
  return send_file('static/error.png', mimetype='image/png')
74
 
75
 
 
82
  session['current_feed'] = feed
83
 
84
  #url = feed_dict[feed]['url']
85
+ url = live_urls[feed]
86
  ip = ''.join(url.split('//')[-1]).split(':')[0]
87
  info = get_ip_info(ip)
88
  country = (pycountry.countries.get(alpha_2=info['country']).name).lower()