Skip to content
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

plugins.youtube: video_id not found by regexp #3668

Closed
2 tasks done
etam opened this issue Apr 1, 2021 · 3 comments · Fixed by #3672
Closed
2 tasks done

plugins.youtube: video_id not found by regexp #3668

etam opened this issue Apr 1, 2021 · 3 comments · Fixed by #3672
Labels
plugin issue A Plugin does not work correctly

Comments

@etam
Copy link

etam commented Apr 1, 2021

Plugin Issue

  • This is a plugin issue and I have read the contribution guidelines.
  • I am using the latest development version from the master branch: current master is c7bd7ec

Description

Streamlink fails to get stream url of a live stream. It used to do it fine few days ago.

Reproduction steps / Explicit stream URLs to test

  1. Try to play https://www.youtube.com/c/Urz%C4%85dTransportuKolejowego/live

Log output

> ./bin/streamlink --loglevel debug "https://www.youtube.com/c/Urz%C4%85dTransportuKolejowego/live" 720p --stream-url
Traceback (most recent call last):
  File "./bin/streamlink", line 33, in <module>
    sys.exit(load_entry_point('streamlink==2.1.1+1.gc7bd7ec', 'console_scripts', 'streamlink')())
  File "/home/etam/tmp/streamlink_master/lib64/python3.8/site-packages/streamlink_cli/main.py", line 1075, in main
    handle_url()
  File "/home/etam/tmp/streamlink_master/lib64/python3.8/site-packages/streamlink_cli/main.py", line 566, in handle_url
    streams = fetch_streams(plugin)
  File "/home/etam/tmp/streamlink_master/lib64/python3.8/site-packages/streamlink_cli/main.py", line 459, in fetch_streams
    return plugin.streams(stream_types=args.stream_types,
  File "/home/etam/tmp/streamlink_master/lib64/python3.8/site-packages/streamlink/plugin/plugin.py", line 317, in streams
    ostreams = self._get_streams()
  File "/home/etam/tmp/streamlink_master/lib64/python3.8/site-packages/streamlink/plugins/youtube.py", line 301, in _get_streams
    self.video_id = self._find_video_id(self.url)
  File "/home/etam/tmp/streamlink_master/lib64/python3.8/site-packages/streamlink/plugins/youtube.py", line 262, in _find_video_id
    return self._find_video_id(canon_link)
  File "/home/etam/tmp/streamlink_master/lib64/python3.8/site-packages/streamlink/plugins/youtube.py", line 227, in _find_video_id
    if m.group("video_id"):
AttributeError: 'NoneType' object has no attribute 'group'

Additional comments, etc.

If in

if m.group("video_id"):

I change it to

if m and m.group("video_id"):

I get

error: Unable to open URL: https://consent.youtube.com/m (400 Client Error: Bad Request for url: https://consent.youtube.com/m)
@etam etam added the plugin issue A Plugin does not work correctly label Apr 1, 2021
@etam
Copy link
Author

etam commented Apr 1, 2021

If I open in my browser a new private window and go to youtube.com I get redirected to https://consent.youtube.com/m?continue=https%3A%2F%2Fwww.youtube.com%2F&gl=PL&m=0&pc=yt&uxe=23983172&hl=pl&src=1

@bastimeyer
Copy link
Member

$ streamlink -l debug 'https://www.youtube.com/c/Urz%C4%85dTransportuKolejowego/live'
[cli][debug] OS:         Linux-5.11.10-arch1-1-x86_64-with-glibc2.33
[cli][debug] Python:     3.9.2
[cli][debug] Streamlink: 2.1.1+0.g6a30ed7
[cli][debug] Requests(2.25.1), Socks(1.7.1), Websocket(0.58.0)
[cli][debug] Arguments:
[cli][debug]  url=https://www.youtube.com/c/Urz%C4%85dTransportuKolejowego/live
[cli][debug]  --loglevel=debug
[cli][debug]  --player=mpv
[cli][info] Found matching plugin youtube for URL https://www.youtube.com/c/Urz%C4%85dTransportuKolejowego/live
[plugins.youtube][debug] Re-directing to canonical URL: https://consent.youtube.com/m
Traceback (most recent call last):
  File "/home/basti/.local/bin/streamlink", line 33, in <module>
    sys.exit(load_entry_point('streamlink', 'console_scripts', 'streamlink')())
  File "/home/basti/repos/streamlink/src/streamlink_cli/main.py", line 1073, in main
    handle_url()
  File "/home/basti/repos/streamlink/src/streamlink_cli/main.py", line 564, in handle_url
    streams = fetch_streams(plugin)
  File "/home/basti/repos/streamlink/src/streamlink_cli/main.py", line 457, in fetch_streams
    return plugin.streams(stream_types=args.stream_types,
  File "/home/basti/repos/streamlink/src/streamlink/plugin/plugin.py", line 317, in streams
    ostreams = self._get_streams()
  File "/home/basti/repos/streamlink/src/streamlink/plugins/youtube.py", line 301, in _get_streams
    self.video_id = self._find_video_id(self.url)
  File "/home/basti/repos/streamlink/src/streamlink/plugins/youtube.py", line 262, in _find_video_id
    return self._find_video_id(canon_link)
  File "/home/basti/repos/streamlink/src/streamlink/plugins/youtube.py", line 227, in _find_video_id
    if m.group("video_id"):
AttributeError: 'NoneType' object has no attribute 'group'

[plugins.youtube][debug] Re-directing to canonical URL: https://consent.youtube.com/m

This is new on YT and the plugin doesn't support handling the consent dialog/page yet.

@etam
Copy link
Author

etam commented Apr 4, 2021

I confirm that the merged code fixes this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin issue A Plugin does not work correctly
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants