]> code.delx.au - webdl/commitdiff
Switch to streamlink
authorJames Bunton <jamesbunton@delx.net.au>
Sat, 24 Feb 2018 05:48:54 +0000 (16:48 +1100)
committerJames Bunton <jamesbunton@delx.net.au>
Sat, 24 Feb 2018 05:48:54 +0000 (16:48 +1100)
README.md
common.py
requirements.txt

index 1dd4945853714ca3ce7bea7de82174c74a60607d..8ee457cc4f826b9afaea120b47eaf2c5d5299034 100644 (file)
--- a/README.md
+++ b/README.md
@@ -42,11 +42,10 @@ Install Python 3 and needed libraries:
 apt-get install python3 python3-lxml python3-requests python3-requests-cache
 ```
 
+You must also install Streamlink, or if it unavailable, the older Livestreamer. Depending on the age of your distro you'll need either:
 
-Install Livestreamer and PyCrypto. Ubuntu packages this as Python 2:
-```
-apt-get install livestreamer python-crypto
-```
+- `apt-get install streamlink`
+- `apt-get install livestreamer python-crypto`
 
 
 Install ffmpeg:
index 5905a628c6796a3aebe1dc95adbaf10f557ff69f..74e8a9d3e72b9fff4c3054eaaba35b367da43f47 100644 (file)
--- a/common.py
+++ b/common.py
@@ -162,6 +162,13 @@ def find_ffprobe():
 
     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()
 
@@ -233,6 +240,8 @@ def convert_to_mp4(filename):
 
 
 def download_hds(filename, video_url, pvswf=None):
+    streamlink = find_streamlink()
+
     filename = sanify_filename(filename)
     logging.info("Downloading: %s", filename)
 
@@ -243,7 +252,7 @@ def download_hds(filename, video_url, pvswf=None):
         param = video_url
 
     cmd = [
-        "livestreamer",
+        streamlink,
         "-f",
         "-o", filename,
         param,
@@ -255,12 +264,14 @@ def download_hds(filename, video_url, pvswf=None):
         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,
index 6bd4f7b22ee797540cae5b0089d1cfb0365c8970..b97ed6e786b9e2681cf86da0427396eeab257f97 100644 (file)
@@ -1,5 +1,4 @@
-livestreamer
-pycrypto
+streamlink
 lxml
 requests
 requests-cache