Advertisement
Porygon

[ED] Eggdrop isup.me Script

Dec 31st, 2011
459
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
TCL 2.55 KB | None | 0 0
  1. # Isup.me Script by Trixar_za
  2. # Type in partyline: .chanset #channel +isup to enable it.
  3.  
  4. # Sets the user agent
  5. set isup(agent) "Mozilla/4.75 (X11; U; Linux 2.2.17; i586; Nav)"
  6.  
  7. setudef flag isup
  8.  
  9. if {[catch {package require http 2.5} e] != 0} {
  10.   set isup(noutf8) 1
  11.   package require http
  12. }
  13.  
  14. bind pub - !isup proc:isup
  15.  
  16. proc proc:isup {nick uhand handle chan input} {
  17.   if {[channel get $chan isup]} {
  18.      global isup
  19.  
  20.     if {![llength [split $input]]} {
  21.        putquick "PRIVMSG $chan Please supply a website address. Ex: !isup google.com"
  22.     } else {
  23.  
  24.        if {[info exists isup(noutf8)]} {
  25.           set http [::http::config -useragent $isup(agent)]
  26.        } else {
  27.           set http [::http::config -useragent $isup(agent) -urlencoding "utf-8"]
  28.        }
  29.  
  30.        catch { set http [::http::geturl "http://www.isup.me/$input" -timeout 10000]} error
  31.  
  32.        if {![string match -nocase "::http::*" $error]} {
  33.           putquick "PRIVMSG $chan [string totitle [string map {"\n" " | "} $error]] \( $input \)"
  34.           return 0
  35.        }
  36.  
  37.        if {![string equal -nocase [::http::status $http] "ok"]} {
  38.           putquick "PRIVMSG $chan [string totitle [::http::status $http]] \( $input \)"
  39.           return 0
  40.        }
  41.  
  42.        set html [::http::data $http]
  43.  
  44.        # Clean up :P
  45.        regsub -all {\n} $html { } html
  46.        regsub -all {\t} $html { } html
  47.        regsub -all {<br/>} $html { } html
  48.        regsub -all {&nbsp;} $html { } html
  49.        regsub -all {    } $html { } html
  50.        regsub -all {   } $html { } html
  51.        regsub -all {  } $html { } html
  52.        regsub -all {<a.+?>} $html {} html
  53.        regsub -all {</a>} $html {} html
  54.        regsub -all {<span.+?>} $html {} html
  55.        regsub -all {</span>} $html {} html
  56.        regsub -all {} $html {-} html
  57.        regsub -all {&gt;} $html {>} html
  58.        regsub -all {&lt;} $html {<} html
  59.        regsub -all {&amp;} $html {\&} html
  60.        regsub -all {&times;} $html {*} html
  61.        regsub -all {(?:\x91|\x92|’|‘|')} $html {'} html
  62.        regsub -all {(?:\x93|\x94|“|”|&quot;)} $html {"} html
  63.       regsub -all {×} $html {x} html
  64.  
  65.       if {[regexp -- {<div.+?>(.+?)<p>} $html - upsite]} {
  66.          set upsite [string trim $upsite]
  67.       }
  68.  
  69.       if {[info exists upsite]} {
  70.          putquick "PRIVMSG $chan $upsite"
  71.       } else {
  72.          putquick "PRIVMSG $chan Ironically, I couldn't get anything from isup.me!"
  73.       }
  74.    }
  75.  }
  76. }
  77.  
  78. putlog "Isup.me Script by Trixar_za Loaded"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement