diff options
author | Joseph Graham <joseph@fibreglass.tunachunks> | 2013-07-28 09:37:38 +0100 |
---|---|---|
committer | Joseph Graham <joseph@fibreglass.tunachunks> | 2013-07-28 09:37:38 +0100 |
commit | ee12ef58ef2dbe3cb47c39f519e8f1708dcdf29e (patch) | |
tree | 69384975eccaaad3fa0ed76f6acaa34b56721bb7 | |
parent | 4c989b46170fbd4b7e0ce86b2e4a55321a70db79 (diff) |
improvement
-rw-r--r-- | hack_of_all_hacks | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/hack_of_all_hacks b/hack_of_all_hacks index 1c87f68..3592e51 100644 --- a/hack_of_all_hacks +++ b/hack_of_all_hacks @@ -117,6 +117,40 @@ EOF # Record that the person has been seen, and when. touch "announcements/people/${personoslash}/seen" + ##################### + # Page title getter # + ##################### + + # If pbot is present record it. + #[[ ${sender%%!*} == pbot ]] && echo yes > pbot_present # commented out because pbot-ng now uses the pbot nickname + + # We don't want to get the page title if it's injected data. + if [[ ${line} =~ http://[^\ ]+ ]] || [[ ${line} =~ https://[^\ ]+ ]] && + (( ! injected_data )) + then + url_to_get="${BASH_REMATCH}" + + # If pbot is not present. + if grep no pbot_present > /dev/null + then + the_title=$( + curl -L --compressed "${url_to_get}" 2> /dev/null | + while rdom + do + if [[ ${element} = title ]] + then + echo "${content}" | replace_wierd_html_chars + fi + done + ) + + if ! [[ -z ${the_title} ]] + then + send_msg "${channel_it_came_from}" "Page title: \`${the_title}'" + fi + fi + fi + ######## # Seen # ######## @@ -159,42 +193,8 @@ EOF fi fi - ##################### - # Page title getter # - ##################### - - # If pbot is present record it. - [[ ${sender%%!*} == pbot ]] && echo yes > pbot_present - - # We don't want to get the page title if it's injected data. - if [[ ${line} =~ http://[^\ ]+ ]] || [[ ${line} =~ https://[^\ ]+ ]] && - (( ! injected_data )) - then - url_to_get="${BASH_REMATCH}" - - # If pbot is not present. - if grep no pbot_present > /dev/null - then - the_title=$( - curl -L --compressed "${url_to_get}" 2> /dev/null | - while rdom - do - if [[ ${element} = title ]] - then - echo "${content}" | replace_wierd_html_chars - fi - done - ) - - if ! [[ -z ${the_title} ]] - then - send_msg "${channel_it_came_from}" "Page title: \`${the_title}'" - fi - fi - fi - # TODO: add a birthday announcement feature, cointoss feature, timer - # feature. + # feature, tell so and so this feature, store phrase feature. ######### # Tests # |