Basic Youtube channel infomation

By slub77 on Apr 12, 2010

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 } }

Comments

Sign in to comment.
SnoooP   -  Apr 13, 2010

U got napa'd biatch! lol

 Respond  
slub77   -  Apr 13, 2010

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

 Respond  
napa182   -  Apr 12, 2010

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 }
}
 Respond  
WorldDMT   -  Apr 12, 2010

hi
no need for loop

echo -st Socket Error $nopath($script) | sockclose $sockname | return

| return <= unless

var %Youtube | sockread %Youtube | var

| var <= unless too

 Respond  
slub77   -  Apr 12, 2010

yea, but when i was making a script before (not on here) for some reason it failed to unset, weird right

 Respond  
Jethro   -  Apr 12, 2010

What script? I mean, if I don't use the -u switch in my set command, I can unset them all like this:

on *:sockclose:poper:{ unset %youtube.* %name.y %channel }
 Respond  
slub77   -  Apr 12, 2010

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

 Respond  
Jethro   -  Apr 12, 2010

You can delete every variable that you've set initially upon sockclose.

 Respond  
slub77   -  Apr 12, 2010

i only did it for some reason it was not deleting the variables

 Respond  
Jethro   -  Apr 12, 2010

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 }
}
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.