Skip to content

Commit

Permalink
Automatically consent to YouTube cookies
Browse files Browse the repository at this point in the history
Since Kodi doesn't store any cookies, we can simply consent to
the YouTube cookie-policy by simply sending a consent-cookie with
every request.

Fixes #139 #145
  • Loading branch information
jaylinski committed Jun 19, 2021
1 parent 7ddd520 commit b83c2a1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion resources/lib/youtube_plugin/youtube/helper/video_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,12 +528,14 @@ def get_watch_page(self, video_id):
'hl': self.language,
'gl': self.region}

cookies = {'CONSENT': 'YES+cb.20210615-14-p0.en+FX+294'}

if self._access_token:
params['access_token'] = self._access_token

url = 'https://www.youtube.com/watch'

result = requests.get(url, params=params, headers=headers, verify=self._verify, allow_redirects=True)
result = requests.get(url, params=params, headers=headers, cookies=cookies, verify=self._verify, allow_redirects=True)
return {'html': result.text, 'cookies': result.cookies}

def get_embed_page(self, video_id):
Expand Down

0 comments on commit b83c2a1

Please sign in to comment.