Commit
·
b306f2e
1
Parent(s):
1bc1c22
Update main.py
Browse files
main.py
CHANGED
|
@@ -35,10 +35,14 @@ from urllib.parse import urlparse, parse_qs
|
|
| 35 |
|
| 36 |
@app.route('/proxy/<path:url>')
|
| 37 |
def proxy(url):
|
| 38 |
-
print('URL:', url)
|
| 39 |
headers = {'User-Agent': 'Mozilla/5.0'}
|
| 40 |
try:
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
content_type = req.headers['content-type']
|
| 43 |
|
| 44 |
return Response(req.iter_content(chunk_size=10*1024), content_type=content_type)
|
|
@@ -47,6 +51,7 @@ def proxy(url):
|
|
| 47 |
print(f'MY Error: {e}')
|
| 48 |
return send_file('static/error.png', mimetype='image/png')
|
| 49 |
|
|
|
|
| 50 |
@app.route('/')
|
| 51 |
def index():
|
| 52 |
if 'current_feed' in session and request.args.get('new', 'false') == 'false':
|
|
|
|
| 35 |
|
| 36 |
@app.route('/proxy/<path:url>')
|
| 37 |
def proxy(url):
|
|
|
|
| 38 |
headers = {'User-Agent': 'Mozilla/5.0'}
|
| 39 |
try:
|
| 40 |
+
# Remove 'proxy/' from the url if present
|
| 41 |
+
clean_url = url.replace('proxy/', '')
|
| 42 |
+
|
| 43 |
+
print('Cleaned URL:', clean_url) # For debugging
|
| 44 |
+
|
| 45 |
+
req = requests.get(f'http://{clean_url}', headers=headers, stream=True, timeout=15)
|
| 46 |
content_type = req.headers['content-type']
|
| 47 |
|
| 48 |
return Response(req.iter_content(chunk_size=10*1024), content_type=content_type)
|
|
|
|
| 51 |
print(f'MY Error: {e}')
|
| 52 |
return send_file('static/error.png', mimetype='image/png')
|
| 53 |
|
| 54 |
+
|
| 55 |
@app.route('/')
|
| 56 |
def index():
|
| 57 |
if 'current_feed' in session and request.args.get('new', 'false') == 'false':
|