def parse_stream_url(self, url):
logger.debug('Extracting URIs from %s', url)
extension = urlparse(url).path[-4:]
if extension in ['.mp3', '.wma']:
logger.debug('Got %s', url)
return [url] # Catch these easy ones
results = []
playlist, content_type = self._get_playlist(url)
if playlist:
parser = find_playlist_parser(extension, content_type)
if parser:
playlist_data = StringIO.StringIO(playlist)
try:
results = [u for u in parser(playlist_data)
if u and u != url]
except Exception as exp: # pylint: disable=broad-except
logger.error('TuneIn playlist parsing failed %s', exp)
if not results:
logger.debug('Parsing failure, '
'malformed playlist: %s', playlist)
elif content_type:
results = [url]
logger.debug('Got %s', results)
return list(OrderedDict.fromkeys(results))
评论列表
文章目录