October 20, 2018

Automatically setting the relevant title for YouTube videos in mpv

I was annoyed with the static title “mpv” when I watch YouTube videos via mpv, so I made this little script that automatically sets the relevant title in mpv for me.

#!/bin/bash

title=$(curl -Ss $1 | grep -oE "<title>.*</title>" | sed 's/<title>//;s/- YouTube<\/title>//')
mpv $1 --ytdl --title "mpv -- $title"

I named it p.sh and you call it with p.sh <url>.

Comments

I'm looking into a good way of implementing comments on my blog that works without JavaScript, respects the users privacy and is reasonably user friendly. If you have any ideas or just want to give me some feedback on this blog post or if you just want to say hello, feel free to do so either via e-mail, XMPP or Mastodon.