BraydenMoore
commited on
Commit
•
967f286
1
Parent(s):
d243a62
Update main.py
Browse files
main.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from flask import Flask, Response, render_template, send_file
|
2 |
import requests
|
3 |
import random
|
4 |
import pickle as pkl
|
@@ -27,20 +27,10 @@ def latlon_to_pixel(loc):
|
|
27 |
x = ((longitude+180)/360)
|
28 |
return x*100, y*100
|
29 |
|
30 |
-
@app.route('/video/<path:url>')
|
31 |
-
def video(url):
|
32 |
-
req = requests.get('https://' + url, timeout=10)
|
33 |
-
|
34 |
-
def generate():
|
35 |
-
for chunk in req.iter_content(chunk_size=1024):
|
36 |
-
yield chunk
|
37 |
-
|
38 |
-
return Response(stream_with_context(generate()), content_type=req.headers['content-type'])
|
39 |
-
|
40 |
@app.route('/')
|
41 |
def index():
|
42 |
feed = random.randint(0, len(feed_dict) - 1)
|
43 |
-
url = feed_dict[feed]['url']
|
44 |
ip = ''.join(url.split('//')[-1]).split(':')[0]
|
45 |
info = get_ip_info(ip)
|
46 |
name = (info['city'] + ", " + info['region'] + ", " + pycountry.countries.get(alpha_2=info['country']).name).lower()
|
|
|
1 |
+
from flask import Flask, Response, render_template, send_file
|
2 |
import requests
|
3 |
import random
|
4 |
import pickle as pkl
|
|
|
27 |
x = ((longitude+180)/360)
|
28 |
return x*100, y*100
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
@app.route('/')
|
31 |
def index():
|
32 |
feed = random.randint(0, len(feed_dict) - 1)
|
33 |
+
url = feed_dict[feed]['url'].replace('http://','https://')
|
34 |
ip = ''.join(url.split('//')[-1]).split(':')[0]
|
35 |
info = get_ip_info(ip)
|
36 |
name = (info['city'] + ", " + info['region'] + ", " + pycountry.countries.get(alpha_2=info['country']).name).lower()
|