BraydenMoore commited on
Commit
dacc1bc
·
1 Parent(s): ee2a7bc

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +5 -11
main.py CHANGED
@@ -47,7 +47,7 @@ from urllib.parse import urlparse, parse_qs
47
 
48
  @app.route('/proxy/<path:url>')
49
  def proxy(url):
50
- session['exception_urls'] = load_exception_urls()
51
  headers = {
52
  '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',
53
  'Accept-Encoding': 'gzip, deflate',
@@ -69,27 +69,21 @@ def proxy(url):
69
 
70
  except Exception as e:
71
  logging.error(f"Error in proxy: {str(e)}")
72
- session['exception_urls'].append(url)
73
- save_exception_urls(session['exception_urls'])
74
- print('Added to exceptions:',len(session['exception_urls']))
75
- logging.error(f"Error in proxy.\n\n")
76
  return redirect(url_for('index', new='true'))
77
  #return send_file('static/error.png', mimetype='image/png')
78
 
79
 
80
  @app.route('/')
81
  def index():
82
- session['exception_urls'] = load_exception_urls()
83
 
84
  if 'current_feed' in session and request.args.get('new', 'false') == 'false':
85
  feed = session['current_feed']
86
  url = live_urls[feed]
87
  else:
88
- while True:
89
- feed = random.randint(0, len(live_urls) - 1)
90
- url = live_urls[feed]
91
- if url not in session['exception_urls']:
92
- break
93
  session['current_feed'] = feed
94
 
95
  ip = ''.join(url.split('//')[-1]).split(':')[0]
 
47
 
48
  @app.route('/proxy/<path:url>')
49
  def proxy(url):
50
+
51
  headers = {
52
  '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',
53
  'Accept-Encoding': 'gzip, deflate',
 
69
 
70
  except Exception as e:
71
  logging.error(f"Error in proxy: {str(e)}")
72
+ print('Skipped')
 
 
 
73
  return redirect(url_for('index', new='true'))
74
  #return send_file('static/error.png', mimetype='image/png')
75
 
76
 
77
  @app.route('/')
78
  def index():
 
79
 
80
  if 'current_feed' in session and request.args.get('new', 'false') == 'false':
81
  feed = session['current_feed']
82
  url = live_urls[feed]
83
  else:
84
+
85
+ feed = random.randint(0, len(live_urls) - 1)
86
+ url = live_urls[feed]
 
 
87
  session['current_feed'] = feed
88
 
89
  ip = ''.join(url.split('//')[-1]).split(':')[0]