add youtube consent logic
This commit is contained in:
parent
82029e2537
commit
b2550a8c1c
@ -126,9 +126,12 @@ class MainHandler(tornado.web.RequestHandler):
|
||||
proxy = proxies.get(provider)
|
||||
src = providers[provider] + self.request.path
|
||||
try:
|
||||
resp = requests.head(src)
|
||||
resp = requests.head(src, allow_redirects=True)
|
||||
if resp is not None:
|
||||
src = resp.url
|
||||
if isinstance(src, str) and "consent.youtube.com" in src:
|
||||
video_id = self.request.path.strip("/")
|
||||
src = f'https://www.youtube.com/watch?v={video_id}'
|
||||
except Exception as e:
|
||||
print(e)
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user