Example #1
0
 def _get_streams(self):
     bp = BrightcovePlayer(self.session, self.account_id)
     m = self.url_re.match(self.url)
     base = m and m.group(1)
     if base == "live":
         return bp.get_streams(self.live_channel_id)
     else:
         res = http.get(self.url)
         m = self.video_id_re.search(res.text)
         video_id = m and m.group(1)
         if video_id:
             return bp.get_streams(video_id)
Example #2
0
 def _get_streams(self):
     # Retrieve URL page and search for Brightcove video data
     res = http.get(self.url)
     match = self._brightcove_video_re.search(res.text) or self._brightcove_video_alt_re.search(res.text)
     if match is not None:
         account_id = match.group('account_id')
         video_id = match.group('video_id')
         player = BrightcovePlayer(self.session, account_id)
         for stream in player.get_streams(video_id):
             yield stream
     else:
         # Try to get the stream URL in the page
         match = self._embed_video_url_re.search(res.text)
         if match is not None:
             video_url = match.group('video_url')
             if '.m3u8' in video_url:
                 for stream in HLSStream.parse_variant_playlist(self.session, video_url).items():
                     yield stream
Example #3
0
 def _get_streams(self):
     # Retrieve URL page and search for Brightcove video data
     res = self.session.http.get(self.url)
     match = self._brightcove_video_re.search(res.text) or self._brightcove_video_alt_re.search(res.text)
     if match is not None:
         account_id = match.group('account_id')
         video_id = match.group('video_id')
         player = BrightcovePlayer(self.session, account_id)
         for stream in player.get_streams(video_id):
             yield stream
     else:
         # Try to get the stream URL in the page
         match = self._embed_video_url_re.search(res.text)
         if match is not None:
             video_url = match.group('video_url')
             if '.m3u8' in video_url:
                 for stream in HLSStream.parse_variant_playlist(self.session, video_url).items():
                     yield stream
Example #4
0
 def _get_streams(self):
     # Retrieve URL page and search for Brightcove video data
     res = self.session.http.get(self.url)
     match = self._brightcove_video_re.search(res.text) or self._brightcove_video_alt_re.search(res.text)
     if match is not None:
         account_id = match.group('account_id')
         log.debug(f'Account ID: {account_id}')
         video_id = match.group('video_id')
         log.debug(f'Video ID: {video_id}')
         player = BrightcovePlayer(self.session, account_id)
         yield from player.get_streams(video_id)
     else:
         # Try to find the Dailymotion video ID
         match = self._embed_video_id_re.search(res.text)
         if match is not None:
             video_id = match.group('video_id')
             log.debug(f'Video ID: {video_id}')
             yield from self.session.streams(self._dailymotion_url.format(video_id)).items()
Example #5
0
    def _get_streams(self):
        res = self.session.http.get(self.url)

        # check two different styles to include the video id in the page
        video_id_m = self.render_re.search(res.text) or self.video_id_re.search(res.text)
        video_id = video_id_m and video_id_m.group("id")

        if not video_id:
            self.logger.error("Could not find a video ID on this page")
            return

        # Use BrightcovePlayer class to get the streams
        self.logger.debug("Found video ID: {0}", video_id)
        bp = BrightcovePlayer(self.session, self.account_id)

        for q, s in bp.get_streams(video_id):
            # RTMP Streams are listed, but they do not appear to work
            if not isinstance(s, RTMPStream):
                yield q, s
Example #6
0
    def _get_streams(self):
        res = self.session.http.get(self.url)

        # check two different styles to include the video id in the page
        video_id_m = self.render_re.search(
            res.text) or self.video_id_re.search(res.text)
        video_id = video_id_m and video_id_m.group("id")

        if not video_id:
            self.logger.error("Could not find a video ID on this page")
            return

        # Use BrightcovePlayer class to get the streams
        self.logger.debug("Found video ID: {0}", video_id)
        bp = BrightcovePlayer(self.session, self.account_id)

        for q, s in bp.get_streams(video_id):
            # RTMP Streams are listed, but they do not appear to work
            if not isinstance(s, RTMPStream):
                yield q, s
    def _get_streams(self):
        page = http.get(self.url)
        object_m = self.object_re.search(page.text)
        if object_m:
            object_t = object_m.group(1)
            params = {}
            for param_m in self.param_re.finditer(object_t):
                params[param_m.group(1)] = param_m.group(2)

            return BrightcovePlayer.from_player_key(self.session,
                                                    params.get("playerID"),
                                                    params.get("playerKey"),
                                                    params.get("videoID"),
                                                    url=self.url)
Example #8
0
    def _get_streams(self):
        res = self.session.http.get(self.url)

        m = self._brightcove_video_re.search(res.text) or self._brightcove_video_alt_re.search(res.text)
        if m:
            account_id = m.group('account_id')
            log.debug(f'Account ID: {account_id}')
            video_id = m.group('video_id')
            log.debug(f'Video ID: {video_id}')
            player = BrightcovePlayer(self.session, account_id)
            yield from player.get_streams(video_id)
            return

        # Try to find the Dailymotion video ID
        m = self._embed_video_id_re.search(res.text)
        if m:
            video_id = m.group('video_id')
            log.debug(f'Video ID: {video_id}')
            yield from self.session.streams(self._dailymotion_url.format(video_id)).items()
            return

        # Try the JS for Brightcove video data
        m = self._main_js_url_re.search(res.text)
        if m:
            log.debug(f'JS URL: {urljoin(self.url, m.group(1))}')
            res = self.session.http.get(urljoin(self.url, m.group(1)))
            m = self._js_brightcove_video_re.search(res.text)
            if m:
                account_id = m.group('account_id')
                log.debug(f'Account ID: {account_id}')
                video_id = m.group('video_id')
                log.debug(f'Video ID: {video_id}')
                player = BrightcovePlayer(self.session, account_id)
                yield from player.get_streams(video_id)
                return

        # Audio Live
        audio_url = None
        for source in itertags(res.text, 'source'):
            url = source.attributes.get('src')
            if url:
                p_url = urlparse(url)
                if p_url.path.endswith(('.mp3')):
                    audio_url = url

        # Audio VOD
        for div in itertags(res.text, 'div'):
            if div.attributes.get('class') == 'audio-player':
                audio_url = div.attributes.get('data-media-url')

        if audio_url:
            yield 'audio', HTTPStream(self.session, audio_url)
            return
Example #9
0
    def _brightcove(self, account_id, video_id):
        log.debug(f"Account ID: {account_id}")
        log.debug(f"Video ID: {video_id}")
        player = BrightcovePlayer(self.session, account_id)

        return dict(player.get_streams(video_id))
Example #10
0
    def _brightcove(self, account_id, video_id):
        log.debug("Account ID: {0}".format(account_id))
        log.debug("Video ID: {0}".format(video_id))
        player = BrightcovePlayer(self.session, account_id)

        return dict(player.get_streams(video_id))