forked from rDrama/rDrama
geoblock
parent
b0801d6bfa
commit
9955fc8f11
|
@ -438,8 +438,9 @@ if SITE == 'watchpeopledie.tv':
|
||||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
|
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
|
||||||
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
|
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
|
||||||
def geoblock():
|
def geoblock():
|
||||||
print('wtf', flush=True)
|
ip = request.headers.get("X-Forwarded-For")
|
||||||
print(request.headers.get("Cf-Ipcountry"), flush=True)
|
req = requests.get(f'http://ipinfo.io/{ip}/json')
|
||||||
if request.headers.get("Cf-Ipcountry") == 'AU':
|
country = json.loads(req.text)['country']
|
||||||
abort(403)
|
if country == 'AU':
|
||||||
|
abort(403, "This video is blocked in Australia")
|
||||||
return send_file('/videos/1706708037797343.mp4')
|
return send_file('/videos/1706708037797343.mp4')
|
||||||
|
|
Loading…
Reference in New Issue