1
mirror of https://github.com/mpv-player/mpv synced 2024-09-09 01:16:56 +02:00

TOOLS: add script for using mpv with youtube-dl

Signed-off-by: wm4 <wm4@nowhere>
This commit is contained in:
Nikoli 2013-10-20 02:22:06 +04:00 committed by wm4
parent 17d0609d1e
commit 65099833f7

23
TOOLS/youtube-dl_mpv.sh Normal file
View File

@ -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"