0
0

[–] justlogin ago  (edited ago)

Part of a stupid little thing, but it worked at the time...

This title script is modified from another script bundle for directory listing. That other version would use filename if no title present.

Both use cases are obsolete now.

#!/bin/sh

# extract webpage title from a downloaded webpage (via wget)
# intended for youtube pages, a title is always present
# takes first title to ignore titles of related videos
# !!! obsolete !!! use youtube-dl

grep -io '<title[^<]*</[^<>]*>' "$1" | sed -e 's/^[^>]*>//; s/<.*$//' | head -1 | tr -d '\n\r'