import sbs
sbs.fill_nodes(root_node)
- import brightcove
- brightcove.fill_nodes(root_node)
+ import ten
+ ten.fill_nodes(root_node)
return root_node
logging.debug("grab_html(%r)", url)
request = http_session.prepare_request(requests.Request("GET", url))
response = http_session.send(request, stream=True)
- doc = lxml.html.parse(io.StringIO(response.text), lxml.html.HTMLParser(encoding="utf-8", recover=True))
+ doc = lxml.html.parse(io.BytesIO(response.content), lxml.html.HTMLParser(encoding="utf-8", recover=True))
response.close()
return doc
logging.debug("grab_xml(%r)", url)
request = http_session.prepare_request(requests.Request("GET", url))
response = http_session.send(request, stream=True)
- doc = lxml.etree.parse(io.StringIO(response.text), lxml.etree.XMLParser(encoding="utf-8", recover=True))
+ doc = lxml.etree.parse(io.BytesIO(response.content), lxml.etree.XMLParser(encoding="utf-8", recover=True))
response.close()
return doc
raise Exception("You must install ffmpeg or libav-tools")
+def find_streamlink():
+ for streamlink in ["streamlink", "livestreamer"]:
+ if check_command_exists([streamlink, "--help"]):
+ return streamlink
+
+ raise Exception("You must install streamlink or livestreamer")
+
def get_duration(filename):
ffprobe = find_ffprobe()
def download_hds(filename, video_url, pvswf=None):
+ streamlink = find_streamlink()
+
filename = sanify_filename(filename)
logging.info("Downloading: %s", filename)
param = video_url
cmd = [
- "livestreamer",
+ streamlink,
"-f",
"-o", filename,
param,
return False
def download_hls(filename, video_url):
+ streamlink = find_streamlink()
+
filename = sanify_filename(filename)
video_url = "hlsvariant://" + video_url
logging.info("Downloading: %s", filename)
cmd = [
- "livestreamer",
+ streamlink,
"-f",
"-o", filename,
video_url,