Stewie1k94 commented on a Page, YouTube Profile Info Dialog  -  Nov 01, 2011

Just though i'd post a dialog version i made :D

alias youtube {
  if ($1) {
    if ($sock(youtubed)) sockclose youtubed
    dialog -mt youtube youtube
    sockopen youtubed www.youtube.com 80
    set %youtube $1
  }
}
alias nohtml { 
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x)
  %x = $remove(%x,&nbsp;,&#39;) 
  return %x
}
menu * {
  Youtube Profile:{
    dialog $iif($dialog(youtube),-v,-md) $&
      youtube youtube
  }
}
dialog youtube {
  title "Youtube Profile Dialog"
  size -1 -1 150 94
  option dbu
  box "Youtube Profile Info" 1, 5 5 140 84
  text "Name:" 2, 10 14 20 10
  text "" 8, 100 14 30 10
  text "Subscribers:" 3, 10 24 30 10
  text "" 10, 100 24 30 10
  text "Channel Views:" 4, 10 34 40 10
  text "" 9, 100 34 30 10
  text "Total Upload Views:" 5, 10 44 50 10
  text "" 13, 100 44 40 10
  text "Latest Activity:" 6, 10 54 42 10
  text "" 12, 100 54 40 10
  text "Joined:" 7, 10 64 34 10
  text "" 11, 100 64 40 10
}
on *:sockopen:youtubed:{
  if ($sockeer) { echo -st Youtube: Connection Error }
  else { 
    sockwrite -nt $sockname GET $+(/user/,%youtube) HTTP/1.1
    sockwrite -nt $sockname Connection: close
    sockwrite -nt $sockname Host: $+($sock($sockname).addr,$str($crlf,2))
  }
}
on *:sockread:youtubed:{
  if ($sockerr) { echo -st Youtube: Connection Error }
  else {
    var %sockreader | sockread %sockreader
    if ($regex(%sockreader,/<div class="profile-info-value fn" $&
      id="profile_show_first_name">(.+?)</div>/)) {
      hadd -m youtube name $nohtml($regml(1))
      did -a youtube 8 $hget(youtube,name)
    }
    if ($regex(%sockreader,/<div class="profile-info-value" $&
      id="profile_show_viewed_count">(.+?)</div>/)) {
      hadd -m youtube profile_viewed $regml(1)
      did -a youtube 9 $hget(youtube,profile_viewed)
    }
    if ($regex(%sockreader,/<div class="profile-info-value" $&
      id="profile_show_subscriber_count">(.+?)</div>/)) {
      hadd -m youtube subscriber_count $regml(1)
      did -a youtube 10 $hget(youtube,subscriber_count)
    }
    if ($regex(%sockreader,/<div class="profile-info-value" $&
      id="profile_show_member_since">(.+?)</div>/)) {
      hadd -m youtube joined $regml(1)
      did -a youtube 11 $hget(youtube,joined)
    }
    if ($regex(%sockreader,/<div class="profile-info-value" $&
      id="profile_show_last_activity">(.+?)</div>/)) {
      hadd -m youtube activity $regml(1)
      did -a youtube 12 $hget(youtube,activity)
    }
    if ($regex(%sockreader,/<div class="profile-info-value" $&
      id="profile_show_total_video_views">(.+?)</div>/)) {
      hadd -m youtube total_views $regml(1)
      did -a youtube 13 $hget(youtube,total_views)
    }
  }
}
 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.