Merge pull request #10 from return42/fix-youtube

[fix] youtube - send CONSENT Cookie to not be redirected
This commit is contained in:
Alexandre Flament 2021-04-22 12:21:31 +02:00 committed by GitHub
commit 981cdb7acf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,7 @@
Youtube (Videos) Youtube (Videos)
""" """
from datetime import datetime
from functools import reduce from functools import reduce
from json import loads, dumps from json import loads, dumps
from urllib.parse import quote_plus from urllib.parse import quote_plus
@ -56,6 +57,7 @@ def request(query, params):
}) })
params['headers']['Content-Type'] = 'application/json' params['headers']['Content-Type'] = 'application/json'
params['headers']['Cookie'] = "CONSENT=YES+cb.%s-17-p0.en+F+941;" % datetime.now().strftime("%Y%m%d")
return params return params