Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def load_m3u8(src, url=None, headers=None):
# is playlist raw text, a path to a file, or a url?
if src.upper().startswith('#EXTM3U'):
m3u8_obj = m3u8.loads(src)
m3u8_obj.playlist_url = url
m3u8_obj.base_uri = _parsed_url(url)
elif os.path.exists(src):
m3u8_obj = m3u8.load(src)
m3u8_obj.playlist_url = url
m3u8_obj.base_uri = _parsed_url(url)
else:
m3u8_obj = m3u8.load(src, headers=headers or DEFAULT_HEADERS)
m3u8_obj.playlist_url = src
return m3u8_obj
def load_m3u8(src, url=None, headers=None):
# is playlist raw text, a path to a file, or a url?
if src.upper().startswith('#EXTM3U'):
m3u8_obj = m3u8.loads(src)
m3u8_obj.playlist_url = url
m3u8_obj.base_uri = _parsed_url(url)
elif os.path.exists(src):
m3u8_obj = m3u8.load(src)
m3u8_obj.playlist_url = url
m3u8_obj.base_uri = _parsed_url(url)
else:
m3u8_obj = m3u8.load(src, headers=headers or DEFAULT_HEADERS)
m3u8_obj.playlist_url = src
return m3u8_obj