diff options
| author | Markus Heiser <markus.heiser@darmarit.de> | 2021-04-21 13:09:50 +0200 |
|---|---|---|
| committer | Markus Heiser <markus.heiser@darmarit.de> | 2021-04-22 12:09:09 +0200 |
| commit | e9a6ab4015ff0dbc6f617a5f643428c62421dde0 (patch) | |
| tree | a849fc8b1ac9d2a547c5ec05fbfeeb4962c8b7dc | |
| parent | f251a9718e16d74714082af12f3edcc47d810d73 (diff) | |
[fix] youtube - send CONSENT Cookie to not be redirected
In the EU there exists a "General Data Protection Regulation" [1] aka GDPR (BTW:
very user friendly!) which requires consent to tracking. To get the consent
from the user, youtube requests are redirected to confirm and get a CONSENT
Cookie from https://consent.youtube.com
This patch adds a CONSENT Cookie to the youtube request to avoid redirection.
[1] https://en.wikipedia.org/wiki/General_Data_Protection_Regulation
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Reported-by: https://github.com/searx/searx/issues/2774
| -rw-r--r-- | searx/engines/youtube_noapi.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/searx/engines/youtube_noapi.py b/searx/engines/youtube_noapi.py index 0933eec68..68b75bc72 100644 --- a/searx/engines/youtube_noapi.py +++ b/searx/engines/youtube_noapi.py @@ -3,6 +3,7 @@ Youtube (Videos) """ +from datetime import datetime from functools import reduce from json import loads, dumps from urllib.parse import quote_plus @@ -56,6 +57,7 @@ def request(query, params): }) 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 |