- mobj = re.match(self._VALID_URL, url)
- title = mobj.group('title')
-
- webpage = self._download_webpage(url, title)
-
- article_id = self._html_search_regex(r"<article id=\"post-(\d+)\"", webpage, '0')
- title = self._html_search_regex(r'<h1 class=\"entry-title\">(.*?)</h1>', webpage, 'title')
- description = self._html_search_regex(r"property=\"og:description\" content=\"(.*?)\"", webpage, 'description', fatal=False)
-
- rtmp_url = self._html_search_regex(r"file: \"(rtmp://\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d{1,5}/vod/mp4:\" \+ \"\w+\" \+ \".mp4)\"", webpage, 'url')
- rtmp_url = rtmp_url.replace("\" + \"", "")
-
- return {
- 'id': article_id,
- 'title': title,
- 'description': description,
- 'url': rtmp_url,
- 'ext': 'flv',
- 'rtmp_live': True # if rtmpdump is not called with "--live" argument, the download is blocked and can be completed
- }
\ No newline at end of file
+ display_id = self._match_id(url)
+ webpage = self._download_webpage(url, display_id)
+
+ article_id = self._html_search_regex(
+ r'<article[^>]+\bid=["\']post-(\d+)', webpage, 'article ID', default=None)
+ title = self._html_search_regex(
+ r'<h1[^>]*>(.+?)</h1>', webpage, 'title',
+ default=None) or self._og_search_title(webpage)
+ description = self._og_search_description(webpage, default=None)
+
+ rtmp_url = self._html_search_regex(
+ r'file["\']?\s*:\s*"(r(?:tm|mt)ps?://[^/]+/(?:vod/mp4:"\s*\+\s*"[^"]+"\s*\+\s*"\.mp4|stream/live))"',
+ webpage, 'RTMP url')
+ # Yes, they have a typo in scheme name for live stream URLs (e.g.
+ # https://bx1.be/lives/direct-tv/)
+ rtmp_url = re.sub(r'^rmtp', 'rtmp', rtmp_url)
+ rtmp_url = re.sub(r'"\s*\+\s*"', '', rtmp_url)
+ formats = self._extract_wowza_formats(rtmp_url, article_id or display_id)
+ self._sort_formats(formats)
+
+ is_live = 'stream/live' in rtmp_url
+
+ return {
+ 'id': article_id or display_id,
+ 'display_id': display_id,
+ 'title': self._live_title(title) if is_live else title,
+ 'description': description,
+ 'formats': formats,
+ 'is_live': is_live,
+ }