Commit 
							
							·
						
						bb23ef3
	
1
								Parent(s):
							
							79bc394
								
Update main.py
Browse files
    	
        main.py
    CHANGED
    
    | @@ -10,8 +10,6 @@ import logging | |
| 10 | 
             
            import os 
         | 
| 11 | 
             
            import time
         | 
| 12 |  | 
| 13 | 
            -
            logging.basicConfig(level=logging.INFO)
         | 
| 14 | 
            -
             | 
| 15 | 
             
            app = Flask(__name__)
         | 
| 16 | 
             
            app.secret_key = 'green-flounder'
         | 
| 17 |  | 
| @@ -30,7 +28,6 @@ def encode_url(url): | |
| 30 | 
             
                encoded_query_params = [(key, quote(value)) for key, value in query_params]
         | 
| 31 | 
             
                encoded_query_string = urlencode(encoded_query_params)
         | 
| 32 | 
             
                finished = urlunsplit((scheme, netloc, path, encoded_query_string, fragment))
         | 
| 33 | 
            -
                print('ENCODED',finished)
         | 
| 34 | 
             
                return finished
         | 
| 35 |  | 
| 36 | 
             
            from geolite2 import geolite2
         | 
| @@ -76,7 +73,6 @@ def proxy(url): | |
| 76 | 
             
                query_string = request.query_string.decode("utf-8")
         | 
| 77 | 
             
                if query_string:
         | 
| 78 | 
             
                    full_url += "?" + query_string
         | 
| 79 | 
            -
                print("CHOSEN",full_url)
         | 
| 80 |  | 
| 81 | 
             
                headers = {
         | 
| 82 | 
             
                    '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',
         | 
| @@ -102,7 +98,6 @@ def proxy(url): | |
| 102 | 
             
                    return Response(req.iter_content(chunk_size=1024), content_type=req.headers['content-type'])
         | 
| 103 |  | 
| 104 | 
             
                except Exception as e:
         | 
| 105 | 
            -
                    logging.error(f"Error in proxy: {str(e)}")
         | 
| 106 | 
             
                    return Response("Error", status=500)
         | 
| 107 |  | 
| 108 |  | 
| @@ -122,12 +117,10 @@ def index(): | |
| 122 | 
             
                    feed = id
         | 
| 123 | 
             
                    session['current_feed'] = id
         | 
| 124 |  | 
| 125 | 
            -
                print("GENERATED", url)
         | 
| 126 | 
             
                url = encode_url(url)
         | 
| 127 | 
             
                url = url.replace('640x480','1280x960')
         | 
| 128 | 
             
                id = feed
         | 
| 129 | 
             
                ip = ''.join(url.split('//')[-1]).split(':')[0]
         | 
| 130 | 
            -
                print('IP:',ip)
         | 
| 131 | 
             
                info = get_location(ip)
         | 
| 132 | 
             
                country = info['country'].lower()
         | 
| 133 | 
             
                name = (info['city'] + ", " + info['region']).lower()
         | 
|  | |
| 10 | 
             
            import os 
         | 
| 11 | 
             
            import time
         | 
| 12 |  | 
|  | |
|  | |
| 13 | 
             
            app = Flask(__name__)
         | 
| 14 | 
             
            app.secret_key = 'green-flounder'
         | 
| 15 |  | 
|  | |
| 28 | 
             
                encoded_query_params = [(key, quote(value)) for key, value in query_params]
         | 
| 29 | 
             
                encoded_query_string = urlencode(encoded_query_params)
         | 
| 30 | 
             
                finished = urlunsplit((scheme, netloc, path, encoded_query_string, fragment))
         | 
|  | |
| 31 | 
             
                return finished
         | 
| 32 |  | 
| 33 | 
             
            from geolite2 import geolite2
         | 
|  | |
| 73 | 
             
                query_string = request.query_string.decode("utf-8")
         | 
| 74 | 
             
                if query_string:
         | 
| 75 | 
             
                    full_url += "?" + query_string
         | 
|  | |
| 76 |  | 
| 77 | 
             
                headers = {
         | 
| 78 | 
             
                    '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',
         | 
|  | |
| 98 | 
             
                    return Response(req.iter_content(chunk_size=1024), content_type=req.headers['content-type'])
         | 
| 99 |  | 
| 100 | 
             
                except Exception as e:
         | 
|  | |
| 101 | 
             
                    return Response("Error", status=500)
         | 
| 102 |  | 
| 103 |  | 
|  | |
| 117 | 
             
                    feed = id
         | 
| 118 | 
             
                    session['current_feed'] = id
         | 
| 119 |  | 
|  | |
| 120 | 
             
                url = encode_url(url)
         | 
| 121 | 
             
                url = url.replace('640x480','1280x960')
         | 
| 122 | 
             
                id = feed
         | 
| 123 | 
             
                ip = ''.join(url.split('//')[-1]).split(':')[0]
         | 
|  | |
| 124 | 
             
                info = get_location(ip)
         | 
| 125 | 
             
                country = info['country'].lower()
         | 
| 126 | 
             
                name = (info['city'] + ", " + info['region']).lower()
         | 
