21 lines
792 B
Bash
21 lines
792 B
Bash
#!/bin/sh
|
|
|
|
yttitle=$(yt-dlp -e "$1")
|
|
|
|
yt-dlp -o "$PWD/%(title)s.%(ext)s" --write-thumbnail --convert-thumbnails jpg --skip-download --write-description "$1"
|
|
|
|
mogrify -resize 640x360 ~/"$yttitle".jpg
|
|
|
|
#clickable link, comment out to disable
|
|
echo "[size=120][url=$(echo $1 | sed -e 's/m.youtube.com/yewtu.be/;s/www.youtube.com/yewtu.be/;s/youtu.be/yewtu.be/')]$yttitle[/url][/size]" > ~/"$yttitle".txt
|
|
#thumbnail image, comment out to disable
|
|
echo "[attachment=0]$yttitle.jpg[/attachment]" >> ~/"$yttitle".txt
|
|
#description quote, comment out to disable
|
|
if [ -s "$yttitle".description ] ; then
|
|
echo "[quote]$(head -n 6 ~/"$yttitle".description)...[/quote]" >> ~/"$yttitle".txt
|
|
else
|
|
echo "[quote]No description available.[/quote]" >> ~/"$yttitle".txt
|
|
fi
|
|
rm -v ~/"$yttitle".description
|
|
|
|
exit 0 |