def _get_streams(self):
    res = http.get(self.url)
    match = _media_id_re.search(res.text)
    if match:
        media_id = match.group(1)
    else:
        return
    res = http.get(MEDIA_URL.format(media_id))
    media = http.json(res, schema=_media_schema)
    for media in media['_mediaArray']:
        for stream in media['_mediaStreamArray']:
            server = stream.get('_server', '').strip()
            stream_ = stream['_stream']
            if isinstance(stream_, list):
                if (not stream_):
                    continue
                stream_ = stream_[0]
            stream_ = stream_.strip()
            if server.startswith('rtmp://'):
                parser = self._get_rtmp_streams
                parser_name = 'RTMP'
            elif stream_.endswith('.f4m'):
                parser = self._get_hds_streams
                parser_name = 'HDS'
            elif stream_.endswith('.smil'):
                parser = self._get_smil_streams
                parser_name = 'SMIL'
            elif stream_.startswith('http'):
                parser = self._get_http_streams
                parser_name = 'HTTP'
            try:
                for stream in parser(stream):
                    (yield stream)
            except IOError as err:
                self.logger.error('Failed to extract {0} streams: {1}', parser_name, err)
def _get_streams(self):
    res = http.get(self.url)
    match = _media_id_re.search(res.text)
    if match:
        media_id = match.group(1)
    else:
        return
    res = http.get(MEDIA_URL.format(media_id))
    media = http.json(res, schema=_media_schema)
    for media in media['_mediaArray']:
        for stream in media['_mediaStreamArray']:
            server = stream.get('_server', ).strip()
            stream_ = stream['_stream']
            if isinstance(stream_, list):
                if (not stream_):
                    continue
                stream_ = stream_[0]
            stream_ = stream_.strip()
            if server.startswith('rtmp://'):
                parser = self._get_rtmp_streams
                parser_name = 'RTMP'
            elif stream_.endswith('.f4m'):
                parser = self._get_hds_streams
                parser_name = 'HDS'
            elif stream_.endswith('.smil'):
                parser = self._get_smil_streams
                parser_name = 'SMIL'
            elif stream_.startswith('http'):
                parser = self._get_http_streams
                parser_name = 'HTTP'
            try:
                for stream in parser(stream):
                    (yield stream)
            except IOError as err:
                self.logger.error('Failed to extract {0} streams: {1}', parser_name, err)