I have seen lot's of youtube scripts that tell you about video's, links and that kind of stuff.
But unless i missed one, i fount that there was none simply for getting information on a user so i made this :)
BTW: If there are 5+ comments from diffrent people asking for a dialog, then i will make one, but i know people are getting mad at me, for dialoging every script i make lol.
[18:14] <@Samuel> @yt Wtoclan
[18:14] Wtoclan Name: WTO Views: 3,368 Lasted logged in: 22 hours ago Subscribers: 100
on *:text:@yt *:#:{
set -u1 %name.y $2 | set -u2 %channel #
if $sock(poper) { sockclose poper }
sockopen poper www.youtube.com 80 |sockmark poper $sock(poper).wserr $sock(poper).wsmsg
}
on *:sockopen:poper: {
if (!$sockerr) { sockwrite -n poper GET $+(/,%name.y) HTTP/1.0 | sockwrite -n poper Host: www.youtube.com | sockwrite -n poper $crlf }
else { echo -st Socket Error: $sock(poper).mark | sockclose poper } }
on *:sockread:poper: {
if ($sockerr) { echo -st Socket Error: $sock(poper).mark | sockclose poper }
else { var %Youtube | sockread %Youtube
if ($regex(%Youtube,/<div style="float:right;" id="profile_show_viewed_count">(.+)</div>/)) { set %youtube.a $regml(1) }
if ($regex(%Youtube,/<div style="float:right;" id="profile_show_first_name">(.+)</div>/)) { set %youtube.b $regml(1) }
if ($regex(%Youtube,/<div style="float:right;" id="profile_show_last_login">(.+)</div>/)) { set %youtube.c $regml(1) }
if ($regex(%Youtube,/<div style="float:right;" id="profile_show_subscriber_count">(.+)</div>/)) { set %youtube.d $regml(1) }
} }
on *:sockclose:poper:{
if %youtube.a { msg %channel %name.y Name: %youtube.b Views: %youtube.a Lasted logged in: %youtube.c Subscribers: %youtube.d | unset %youtube.* }
else { msg %channel Error 404:user name does not exsist } }
Hmm..i can see where your all coming from, i have edited now, ime sill trying to get my head round why at one point it never did unset them variables...
ANYWAYS
Thanks for the suggestions guys :)
Napa, yours is just to complicated lol, read the title "basic" lol, great customization though, but you changed toe sock's name :O lol
you can do it like this as well
on $*:text:/^@yt\s(\S+)$/iS:#:{
if ($hget(yt)) hfree yt
if ($sock(yt)) sockclose yt
sockopen yt www.youtube.com 80
sockmark yt msg # User: $regml(1)
}
on *:sockopen:yt: {
sockwrite -n $sockname GET $+(/,$gettok($sock(yt).mark,4,32)) HTTP/1.1
sockwrite -n $sockname Host: $+(www.youtube.com,$str($crlf,2))
}
on *:sockread:yt: {
var %yt | sockread %yt
if ($regex(%yt,/<html><head><title>404 (Not Found)<\/title>/)) { $gettok($sock(yt).mark,1-,32) $regml(1) | sockclose yt }
if ($regex(%yt,/<div style=.+viewed_count">(.+)<\/div>/)) { hadd -m yt a $regml(1) }
if ($regex(%yt,/<div style=.+last_login">(.+)<\/div>/)) { hadd -m yt b $regml(1) }
if ($regex(%yt,/<div style=.+subscriber_count">(.+)<\/div>/)) { $gettok($sock(yt).mark,1-,32) Views: $hget(yt,a) Lasted logged in: $hget(yt,b) Subscribers: $regml(1) | sockclose yt }
}
i know, but on a script, it did not delete them at all, i was lke wtf, so made a loop, just to make sure it did not exsist, would have used while, but it was only for safty purposes
Oh and jethro since u seen this, can u help me with:
http://www.hawkee.com/phpBB2/viewtopic.php?t=21193
Why a goto loop and alias? You can make your script a little better as such:
on *:text:@yt *:#:{
set -u1 %name.y $2
set -u2 %channel #
if $sock(poper) { sockclose poper }
sockopen poper www.youtube.com 80
sockmark poper $sock(poper).wserr $sock(poper).wsmsg
}
on *:sockopen:poper: {
if (!$sockerr) {
sockwrite -n poper GET $+(/,%name.y) HTTP/1.0
sockwrite -n poper Host: www.youtube.com
sockwrite -n poper $crlf
}
else {
echo -st Socket Error: $sock(poper).mark
sockclose poper
}
}
on *:sockread:poper: {
if ($sockerr) {
echo -st Socket Error: $sock(poper).mark
sockclose poper
}
else {
var %Youtube | sockread %Youtube
if ($regex(%Youtube,/<div style="float:right;" id="profile_show_viewed_count">(.+)</div>/)) { set %youtube.a $regml(1) }
if ($regex(%Youtube,/<div style="float:right;" id="profile_show_first_name">(.+)</div>/)) { set %youtube.b $regml(1) }
if ($regex(%Youtube,/<div style="float:right;" id="profile_show_last_login">(.+)</div>/)) { set %youtube.c $regml(1) }
if ($regex(%Youtube,/<div style="float:right;" id="profile_show_subscriber_count">(.+)</div>/)) { set %youtube.d $regml(1) }
}
}
on *:sockclose:poper:{
if %youtube.a {
msg %channel %name.y Name: %youtube.b Views: %youtube.a Lasted logged in: %youtube.c Subscribers: %youtube.d
unset %youtube.*
}
else { msg %channel Error 404:user name does not exsist }
}