Repository: streamlink/streamlink

Issue:
Bug report: Changes in cdnbg plugin - streams not opening and 2 new channels
### Checklist

- [x] This is a bug report.
- [x] This is a feature request.
- [ ] This is a plugin (improvement) request.
- [ ] I have read the contribution guidelines.

### Description
No playable streams found on these URLs.
These channels seem to be using a new video player, while content is still coming in from cdn.bg. Other cdn links seem to be working with the old code for the time being, I'm not sure if/when they will migrate to this new videoplayer.

http://www.bgonair.bg/tvonline
http://kanal3.bg/live
http://tv.bnt.bg/bnt2/16x9/
http://tv.bnt.bg/bnt1/16x9/

Also, **Bloomberg Bulgaria and TV Evropa have migrated to CDN.bg**, so they can be added to this plugin. The original request for Bloomberg (#921) can be closed if this is done. The live channel can be found at this link: http://www.bloombergtv.bg/video
TV Evropa can be found at this link: http://www.tvevropa.com/na-zhivo/

### Additional problems encountered
http://tv.bnt.bg/bnt1/4x3 - there seems to be nothing on this URL any longer, even though there's a link in the website. Either they haven't updated the website, or they've deprecated the non-HD 4x3 stream. 

http://tv.bnt.bg/bnt1/hd/ - slight delay between the video and the audio (audio seems to be lagging by a fraction of a second, as you can see that the newscasters' lips aren't in sync). Not sure if this is a plugin problem, decided to share anyway. 

### Comments
These streams may be and probably are geo-restricted to Bulgaria. Here are some proxy options:
1. http://bgproxy.org/
2. https://nqma.net/
3. http://www.bgproxy.net/bg/index.php
4. http://www.php-proxy.net/
Plugin Request: Bloomberg Bulgaria

----

### Checklist

- [ ] This is a bug report.
- [ ] This is a feature request.
- [x] This is a plugin (improvement) request.
- [ ] I have read the contribution guidelines.

### Description
A simple plugin for Bloomberg Bulgaria, hosted at http://www.bloombergtv.bg/video which uses https://flowplayer.org/ to livestream and post videos.


Discussion:

Resolving patch:
diff --git a/src/streamlink/plugins/cdnbg.py b/src/streamlink/plugins/cdnbg.py
--- a/src/streamlink/plugins/cdnbg.py
+++ b/src/streamlink/plugins/cdnbg.py
@@ -1,13 +1,14 @@
 from __future__ import print_function
+
 import re
 
-from streamlink import PluginError
+from streamlink.compat import urlparse
 from streamlink.plugin import Plugin
 from streamlink.plugin.api import http
 from streamlink.plugin.api import useragents
 from streamlink.plugin.api import validate
 from streamlink.stream import HLSStream
-from streamlink.compat import urlparse
+from streamlink.utils import update_scheme
 
 
 class CDNBG(Plugin):
@@ -17,12 +18,14 @@ class CDNBG(Plugin):
             bitelevision\.com/live|
             nova\.bg/live|
             kanal3\.bg/live|
-            bgonair\.bg/tvonline
+            bgonair\.bg/tvonline|
+            tvevropa\.com/na-zhivo|
+            bloombergtv.bg/video
         )/?
     """, re.VERBOSE)
     iframe_re = re.compile(r"iframe .*?src=\"((?:https?:)?//(?:\w+\.)?cdn.bg/live[^\"]+)\"", re.DOTALL)
     sdata_re = re.compile(r"sdata\.src.*?=.*?(?P<q>[\"'])(?P<url>http.*?)(?P=q)")
-    hls_file_re = re.compile(r"file: (?P<q>[\"'])(?P<url>http.+?m3u8.*?)(?P=q)")
+    hls_file_re = re.compile(r"(src|file): (?P<q>[\"'])(?P<url>(https?:)?//.+?m3u8.*?)(?P=q)")
     hls_src_re = re.compile(r"video src=(?P<url>http[^ ]+m3u8[^ ]*)")
 
     stream_schema = validate.Schema(
@@ -54,11 +57,9 @@ def _get_streams(self):
         if iframe_url:
             self.logger.debug("Found iframe: {0}", iframe_url)
             res = http.get(iframe_url, headers={"Referer": self.url})
-            try:
-                return HLSStream.parse_variant_playlist(self.session,
-                                                        self.stream_schema.validate(res.text),
-                                                        headers={"User-Agent": useragents.CHROME})
-            except PluginError:
-                return
+            stream_url = update_scheme(self.url, self.stream_schema.validate(res.text))
+            return HLSStream.parse_variant_playlist(self.session,
+                                                    stream_url,
+                                                    headers={"User-Agent": useragents.CHROME})
 
 __plugin__ = CDNBG


Test patch: