This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.
For more information, see this announcement post . Click the X in the top right-corner of this box to dismiss this message.
Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
sadnem
Voice
Posts: 10 Joined: Thu Mar 18, 2010 5:58 pm
Post
by sadnem » Sun Dec 19, 2010 1:30 pm
Hello, I´m currently searching for a tcl script that will retrieve info from isup.me (aka downforeveryoneorjustme.com )
an example output would be like:
Code: Select all
!isup google.com
<bot> It's just you. http://google.com is up.
Code: Select all
!isup fakewebsite81823.com
<bot> It's not just you! http://fakewebsite81823.com looks down from here.
Code: Select all
!isup website
<bot> Huh? http://website doesn't look like a site on the interwho.
To directly access to the site´s output of a website you can directly access
http://isup.me/website to retrieve the desired information.
It doesn´t seems complicated although I have no tcl skills at all and my curl knowledge it´s pretty poor so I don´t really know where to start, if someone could do this script for me I'd be very grateful.
Last edited by
sadnem on Sun Dec 19, 2010 6:57 pm, edited 1 time in total.
Trixar_za
Op
Posts: 143 Joined: Wed Nov 18, 2009 1:44 pm
Location: South Africa
Contact:
Post
by Trixar_za » Sun Dec 19, 2010 3:59 pm
Ok, I tested it and it works:
Code: Select all
# Isup.me Script by Trixar_za
# Type in partyline: .chanset #channel +isup to enable it.
# Sets the user agent
set isup(agent) "Mozilla/4.75 (X11; U; Linux 2.2.17; i586; Nav)"
setudef flag isup
if {[catch {package require http 2.5} e] != 0} {
set isup(noutf8) 1
package require http
}
bind pub - !isup proc:isup
proc proc:isup {nick uhand handle chan input} {
if {[channel get $chan isup]} {
global isup
if {![llength [split $input]]} {
putquick "PRIVMSG $chan Please supply a website address. Ex: !isup google.com"
} else {
if {[info exists isup(noutf8)]} {
set http [::http::config -useragent $isup(agent)]
} else {
set http [::http::config -useragent $isup(agent) -urlencoding "utf-8"]
}
catch { set http [::http::geturl "http://www.isup.me/$input" -timeout 10000]} error
if {![string match -nocase "::http::*" $error]} {
putquick "PRIVMSG $chan [string totitle [string map {"\n" " | "} $error]] \( $input \)"
return 0
}
if {![string equal -nocase [::http::status $http] "ok"]} {
putquick "PRIVMSG $chan [string totitle [::http::status $http]] \( $input \)"
return 0
}
set html [::http::data $http]
# Clean up :P
regsub -all {\n} $html { } html
regsub -all {\t} $html { } html
regsub -all {<br/>} $html { } html
regsub -all { } $html { } html
regsub -all { } $html { } html
regsub -all { } $html { } html
regsub -all { } $html { } html
regsub -all {<a.+?>} $html {} html
regsub -all {</a>} $html {} html
regsub -all {<span.+?>} $html {} html
regsub -all {</span>} $html {} html
regsub -all {—} $html {-} html
regsub -all {>} $html {>} html
regsub -all {<} $html {<} html
regsub -all {&} $html {\&} html
regsub -all {×} $html {*} html
regsub -all {(?:\x91|\x92|’|‘|')} $html {'} html
regsub -all {(?:\x93|\x94|“|”|")} $html {"} html
regsub -all {×} $html {x} html
if {[regexp -- {<div.+?>(.+?)<p>} $html - upsite]} {
set upsite [string trim $upsite]
}
if {[info exists upsite]} {
putquick "PRIVMSG $chan $upsite"
} else {
putquick "PRIVMSG $chan Ironically, I couldn't get anything from isup.me!"
}
}
}
}
putlog "Isup.me Script by Trixar_za Loaded"
Last edited by
Trixar_za on Mon Dec 20, 2010 4:20 am, edited 1 time in total.
sadnem
Voice
Posts: 10 Joined: Thu Mar 18, 2010 5:58 pm
Post
by sadnem » Sun Dec 19, 2010 6:57 pm
It´s working as a charm, thank you.
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Mon Dec 20, 2010 1:48 am
It's me or you forgot to define $isup(logo)?
Also, shouldn't it be:
(notice the missing ':' after the $chan variable)?
Once the game is over, the king and the pawn go back in the same box.
Trixar_za
Op
Posts: 143 Joined: Wed Nov 18, 2009 1:44 pm
Location: South Africa
Contact:
Post
by Trixar_za » Mon Dec 20, 2010 4:23 am
I forgot to remove that last $isup(logo) yes and in the strictest sense you don't need that : in privmsg, except on IRCds that STRICTLY adheres to the IRC protocol. So far I've found only one such server and that's with bitlbee, the rest seem to work just as well without it
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Mon Dec 20, 2010 6:15 am
I see. What happens if I would do !isup [die] for instance?
Once the game is over, the king and the pawn go back in the same box.
Trixar_za
Op
Posts: 143 Joined: Wed Nov 18, 2009 1:44 pm
Location: South Africa
Contact:
Post
by Trixar_za » Mon Dec 20, 2010 7:43 am
caesar wrote: I see. What happens if I would do !isup [die] for instance?
[@GameBot] Illegal characters in url path ( [die] ) <--- that happens
Ashoq
Voice
Posts: 11 Joined: Sat Jul 17, 2010 4:35 pm
Post
by Ashoq » Wed Dec 22, 2010 2:35 pm
something wrong
i tested a
down website on
www.isup.me it said '
down ' on tcl it said '
up '
Trixar_za
Op
Posts: 143 Joined: Wed Nov 18, 2009 1:44 pm
Location: South Africa
Contact:
Post
by Trixar_za » Wed Dec 22, 2010 8:23 pm
Eh, then it was down for a bit. All the script does is grab the text from the website each time the command is invoked. So what your seeing isn't cached at all and is the website's response as it happens.
teegg
Voice
Posts: 7 Joined: Wed Apr 04, 2012 11:37 am
Post
by teegg » Thu Apr 19, 2012 9:43 am
this script was not working for me..so i played around with it a. It turns out the following codes were not pasted correctly into vi. Maybe vi doesnt support these codes?
Code: Select all
regsub -all {—} $html {-} html
regsub -all {(?:\x91|\x92|’|‘|')} $html {'} html
regsub -all {(?:\x93|\x94|“|”|")} $html {"} html
But anyhow I commented them out and the script works again.
Cerberus
Voice
Posts: 7 Joined: Mon Sep 01, 2008 6:37 pm
Post
by Cerberus » Tue May 01, 2012 3:27 pm
with a few edit script worked great.
removed extra close brace from end of script
changed useragent to:
Mozilla/5.0 (X11; U; Linux i686; el-GR; rv:1.8.1) Gecko/2010112223 Firefox/3.6.12
and removed the -urlencode section.
i also added this so script can be turned on or off via public command by bot master.
Code: Select all
bind pub m|m &isup-script WSS-Settings
proc WSS-Settings {nick host hand chan text} {
if {![channel get $chan isup] && $text == "on"} {
catch {channel set $chan +isup}
putserv "notice $nick :Web Site Statuc Checker: enabled for $chan"
putlog "Web Site Statuc Checker: script enabled (by $nick for $chan)"
} elseif {[channel get $chan isup] && $text == "off"} {
catch {channel set $chan -isup}
putserv "notice $nick :Web Site Statuc Checker: disabled for $chan"
putlog "Web Site Statuc Checker: script disabled (by $nick for $chan)"
} else {
putserv "notice $nick :Web Site Statuc Checker: &isup-script (on|off) enables or disables script for active channel"
}
}