summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2019-06-04 18:01:53 +0000
committerLuke Bratch <luke@bratch.co.uk>2019-06-04 18:01:53 +0000
commit6f06a1a49c04f4a4e01744bb95d6a1c3732611d4 (patch)
tree9a7b711a19d53d78a4152f581a62d9bdd381bf6b
parentb6f2ac5debac9e9900e4fcaf270701de62d3b335 (diff)
parent779f8a323842446d0fc92f0c9ab14724d10abced (diff)
Merge branch 'master' into 'master'
Make sure we capture all title tags individually with grep and then take the first with head See merge request l_bratch/blatitle!1
-rwxr-xr-xtitle.bash2
1 files changed, 1 insertions, 1 deletions
diff --git a/title.bash b/title.bash
index 988f544..fcb8a83 100755
--- a/title.bash
+++ b/title.bash
@@ -74,7 +74,7 @@ else
then
grep -m1 . /tmp/$TIME.body
else
- cat /tmp/$TIME.body | tr '\n' ' ' | tr '\r' ' ' | grep -oiE '<title.*>.*</title>' | sed -r 's/<title[^>]*//I; s/^>//I; s/<\/title>$//I' | php -r 'while(($line=fgets(STDIN)) !== FALSE) echo html_entity_decode($line, ENT_QUOTES|ENT_HTML401);'
+ cat /tmp/$TIME.body | tr '\n' ' ' | tr '\r' ' ' | grep -oiE '<title[^>]*>([^<]+)<\/title>' | head -1 | sed -r 's/<title[^>]*//I; s/^>//I; s/<\/title>$//I' | php -r 'while(($line=fgets(STDIN)) !== FALSE) echo html_entity_decode($line, ENT_QUOTES|ENT_HTML401);'
fi
rm /tmp/$TIME.header /tmp/$TIME.body
fi