Repository: streamlink/streamlink

Issue:
Plugin LivecodingTV fails to load on Python 3.6.0b2 on Windows 10 x64
Just running streamlink raises the following error on my system with a fresh install:

```
C:\WINDOWS\system32>streamlink
Failed to load plugin livecodingtv:
  File "c:\program files\python36\lib\imp.py", line 234, in load_module
    return load_source(name, filename, file)
  File "c:\program files\python36\lib\imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 675, in _load
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 677, in exec_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "c:\program files\python36\lib\site-packages\streamlink\plugins\livecodingtv.py", line 9, in <module>
    _url_re = re.compile('http(s)?://(?:\w+.)?\livecoding\.tv')
  File "c:\program files\python36\lib\re.py", line 233, in compile
    return _compile(pattern, flags)
  File "c:\program files\python36\lib\re.py", line 301, in _compile
    p = sre_compile.compile(pattern, flags)
  File "c:\program files\python36\lib\sre_compile.py", line 562, in compile
    p = sre_parse.parse(p, flags)
  File "c:\program files\python36\lib\sre_parse.py", line 856, in parse
    p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, False)
  File "c:\program files\python36\lib\sre_parse.py", line 415, in _parse_sub
    itemsappend(_parse(source, state, verbose))
  File "c:\program files\python36\lib\sre_parse.py", line 501, in _parse
    code = _escape(source, this, state)
  File "c:\program files\python36\lib\sre_parse.py", line 401, in _escape
    raise source.error("bad escape %s" % escape, len(escape))
sre_constants.error: bad escape \l at position 20

usage: streamlink [OPTIONS] [URL] [STREAM]

Use -h/--help to see the available options or read the manual at http://docs.streamlink.io/

C:\WINDOWS\system32>python --version
Python 3.6.0b2
```



Discussion:
change https://github.com/streamlink/streamlink/blob/master/src/streamlink/plugins/livecodingtv.py#L9 to

```
_url_re = re.compile(r"http(s)?://(?:\w+\.)?livecoding\.tv")
```


Resolving patch:
diff --git a/src/streamlink/plugins/livecodingtv.py b/src/streamlink/plugins/livecodingtv.py
--- a/src/streamlink/plugins/livecodingtv.py
+++ b/src/streamlink/plugins/livecodingtv.py
@@ -1,12 +1,20 @@
 import re
 from streamlink.plugin import Plugin
+from streamlink.stream import HLSStream
 from streamlink.stream import RTMPStream, HTTPStream
 from streamlink.plugin.api import http
 
 
-_vod_re = re.compile('\"(http(s)?://.*\.mp4\?t=.*)\"')
-_rtmp_re = re.compile('rtmp://[^"]+/(?P<channel>\w+)+[^/"]+')
-_url_re = re.compile('http(s)?://(?:\w+.)?\livecoding\.tv')
+_streams_re = re.compile(r"""
+    src:\s+"(
+        rtmp://.*?\?t=.*?|                      # RTMP stream
+        https?://.*?playlist.m3u8.*?\?t=.*?|    # HLS stream
+        https?://.*?manifest.mpd.*?\?t=.*?|     # DASH stream
+        https?://.*?.mp4\?t=.*?                 # HTTP stream
+        )".*?
+     type:\s+"(.*?)"                            # which stream type it is
+     """, re.M | re.DOTALL | re.VERBOSE)
+_url_re = re.compile(r"http(s)?://(?:\w+\.)?livecoding\.tv")
 
 
 class LivecodingTV(Plugin):
@@ -16,18 +24,19 @@ def can_handle_url(cls, url):
 
     def _get_streams(self):
         res = http.get(self.url)
-        match = _rtmp_re.search(res.content.decode('utf-8'))
-        if match:
-            params = {
-                "rtmp": match.group(0),
-                "pageUrl": self.url,
-                "live": True,
-            }
-            yield 'live', RTMPStream(self.session, params)
-            return
-
-        match = _vod_re.search(res.content.decode('utf-8'))
-        if match:
-            yield 'vod', HTTPStream(self.session, match.group(1))
+        match = _streams_re.findall(res.content.decode('utf-8'))
+        for url, stream_type in match:
+            if stream_type == "rtmp/mp4" and RTMPStream.is_usable(self.session):
+                params = {
+                    "rtmp": url,
+                    "pageUrl": self.url,
+                    "live": True,
+                }
+                yield 'live', RTMPStream(self.session, params)
+            elif stream_type == "application/x-mpegURL":
+                for s in HLSStream.parse_variant_playlist(self.session, url).items():
+                    yield s
+            elif stream_type == "video/mp4":
+                yield 'vod', HTTPStream(self.session, url)
 
 __plugin__ = LivecodingTV


Test patch: