aboutsummaryrefslogtreecommitdiffhomepage
path: root/TOOLS
diff options
context:
space:
mode:
authorGravatar Nikoli <nikoli@gmx.us>2013-10-20 02:22:06 +0400
committerGravatar wm4 <wm4@nowhere>2014-04-09 20:41:51 +0200
commit65099833f7c9bd1a626595bb40b614bfa2e3a401 (patch)
tree8c35e81ea48625ab3a97b349baad18c166f28372 /TOOLS
parent17d0609d1e8c36d70b5994e779a364f6df429937 (diff)
TOOLS: add script for using mpv with youtube-dl
Signed-off-by: wm4 <wm4@nowhere>
Diffstat (limited to 'TOOLS')
-rw-r--r--TOOLS/youtube-dl_mpv.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/TOOLS/youtube-dl_mpv.sh b/TOOLS/youtube-dl_mpv.sh
new file mode 100644
index 0000000000..cfa34573bc
--- /dev/null
+++ b/TOOLS/youtube-dl_mpv.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+# Example of script for using mpv with youtube-dl
+set -e
+
+cookies_dir="$(mktemp -d /tmp/youtube-dl_mpv.XXXX)"
+cookies_file="${cookies_dir}/cookies"
+user_agent="$(youtube-dl --dump-user-agent)" # or set whatever you want
+
+video_url="$(youtube-dl \
+ --user-agent="$user_agent" \
+ --cookies="$cookies_file" \
+ --get-url \
+ "$1")"
+
+shift
+
+mpv \
+ --cookies \
+ --cookies-file="$cookies_file" \
+ --user-agent="$user_agent" \
+ "$@" -- $video_url
+
+rm -rf "$cookies_dir"