Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -103,57 +103,48 @@ def proxy(url):
|
|
103 |
@app.route('/')
|
104 |
def index():
|
105 |
id = request.args.get('id')
|
106 |
-
|
107 |
-
|
108 |
-
url = live_urls[int(feed)]
|
109 |
-
else:
|
110 |
feed = random.randint(0, len(live_urls) - 1)
|
111 |
-
|
112 |
-
session['current_feed'] = feed
|
113 |
-
|
114 |
-
if id:
|
115 |
-
url = live_urls[int(id)]
|
116 |
-
feed = id
|
117 |
-
session['current_feed'] = id
|
118 |
|
119 |
-
|
120 |
-
url =
|
|
|
|
|
|
|
121 |
|
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()
|
127 |
page_title = (info['city'] + ", " + info['region'] + ", " + country).lower()
|
128 |
timezone = pytz.timezone(info['timezone'])
|
129 |
-
time = dt.datetime.now(timezone)
|
130 |
-
time = time.strftime("%I:%M:%S %p")
|
131 |
loc = info['loc']
|
132 |
X, Y = latlon_to_pixel(info['loc'])
|
133 |
proxy_url = 'proxy/' + url
|
134 |
-
logging.info(f"Generated proxy URL: {proxy_url}")
|
135 |
loc_link = f"https://www.google.com/maps/search/{loc}"
|
136 |
ip_link = url
|
137 |
-
|
138 |
-
|
139 |
-
except:
|
140 |
-
owner = 'unknown'
|
141 |
return render_template('index.html',
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
|
|
157 |
|
158 |
|
159 |
if __name__ == '__main__':
|
|
|
103 |
@app.route('/')
|
104 |
def index():
|
105 |
id = request.args.get('id')
|
106 |
+
|
107 |
+
if id is None:
|
|
|
|
|
108 |
feed = random.randint(0, len(live_urls) - 1)
|
109 |
+
return redirect(f"/?id={feed}")
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
|
111 |
+
id = int(id)
|
112 |
+
url = live_urls[id]
|
113 |
+
session['current_feed'] = id
|
114 |
+
|
115 |
+
url = encode_url(url).replace('640x480','1280x960').replace('COUNTER','')
|
116 |
|
|
|
117 |
ip = ''.join(url.split('//')[-1]).split(':')[0]
|
118 |
info = get_location(ip)
|
119 |
country = info['country'].lower()
|
120 |
name = (info['city'] + ", " + info['region']).lower()
|
121 |
page_title = (info['city'] + ", " + info['region'] + ", " + country).lower()
|
122 |
timezone = pytz.timezone(info['timezone'])
|
123 |
+
time = dt.datetime.now(timezone).strftime("%I:%M:%S %p")
|
|
|
124 |
loc = info['loc']
|
125 |
X, Y = latlon_to_pixel(info['loc'])
|
126 |
proxy_url = 'proxy/' + url
|
|
|
127 |
loc_link = f"https://www.google.com/maps/search/{loc}"
|
128 |
ip_link = url
|
129 |
+
owner = owner_dict.get(ip, 'unknown')
|
130 |
+
|
|
|
|
|
131 |
return render_template('index.html',
|
132 |
+
name=name,
|
133 |
+
url=encode_url(proxy_url),
|
134 |
+
info=info,
|
135 |
+
country=country,
|
136 |
+
time=time,
|
137 |
+
timezone=timezone,
|
138 |
+
ip=ip,
|
139 |
+
ip_link=ip_link,
|
140 |
+
loc=loc,
|
141 |
+
loc_link=loc_link,
|
142 |
+
owner=owner,
|
143 |
+
X=X,
|
144 |
+
Y=Y,
|
145 |
+
id=id,
|
146 |
+
page_title=page_title
|
147 |
+
)
|
148 |
|
149 |
|
150 |
if __name__ == '__main__':
|