Streamlink: Handle different YouTube live links

Created on 3 Jun 2017  路  3Comments  路  Source: streamlink/streamlink

  • [x] This is a plugin (improvement) request.
  • [x] I have read the contribution guidelines.

Description

Currently handles /c/<channel>/live but YouTube also supports that link without the /c part. Too small for a pull request.

Expected / Actual behavior

Now able to match YouTube links without the /c prefix.

Reproduction steps / Explicit stream URLs to test

  1. youtube.com/c/<channel>/live
  2. youtube.com/<channel>/live
  3. gaming.youtube.com/<channel>/live
bug

Most helpful comment

No fix is too small for a PR! Well done for fixing your own issue @ahtcx ;)

All 3 comments

Here's a patch

diff --git a/src/streamlink/plugins/youtube.py b/src/streamlink/plugins/youtube.py
index 7907aca..23a15c8 100644
--- a/src/streamlink/plugins/youtube.py
+++ b/src/streamlink/plugins/youtube.py
@@ -107,7 +107,7 @@ _url_re = re.compile(r"""
         )
         |
         (?:
-            /c/(?P<liveChannel>[^/?]+)/live
+            /(c/)?(?P<liveChannel>[^/?]+)/live
         )
     )
 """, re.VERBOSE)

Looks good, do you want to open a PR for it?

No fix is too small for a PR! Well done for fixing your own issue @ahtcx ;)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SanyaIV picture SanyaIV  路  3Comments

fabiomcarneiro picture fabiomcarneiro  路  3Comments

shahar603 picture shahar603  路  3Comments

gravyboat picture gravyboat  路  3Comments

wastrel333 picture wastrel333  路  3Comments