Avatar
Hund

# emerge life

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>.

Feedback

I don't have a commenting system on my blog since there's no good solutions that works without JavaScript, is user friendly and respects both the users freedom and privacy. So for now, all feedback and hellos can be done via either e-mail, XMPP or Mastodon.