mirror of https://github.com/mpv-player/mpv
28 lines
536 B
Bash
Executable File
28 lines
536 B
Bash
Executable File
#!/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
|
|
|
|
if [ -z "$MPV" ] ; then
|
|
MPV=mpv
|
|
fi
|
|
|
|
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"
|