Skip to content

plugins.youtube: fix consent dialog #3672

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 3, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/streamlink/plugins/youtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,15 @@ def _get_stream_info(self, video_id):
return info_parsed

def _get_streams(self):
res = self.session.http.get(self.url)
if "consent.youtube" in res.url:
c_data = {}
for _i in itertags(res.text, "input"):
if _i.attributes.get("type") == "hidden":
c_data[_i.attributes.get("name")] = _i.attributes.get("value")
log.debug(f"c_data_keys: {', '.join(c_data.keys())}")
self.session.http.post("https://consent.youtube.com/s", data=c_data)

is_live = False

self.video_id = self._find_video_id(self.url)
Expand Down