Hawkee Snippets/Images/Forum "Detector"

By Kirby on Apr 01, 2009

I don't remember who exactly requested this, but it is done.
This small, neat snippet is similar to my YouTube Video "Detector", but has some extensions:

[size=18]Syntax: Just post any Hawkee url to a snippet, image, or forum topic page in a channel.[/size]

Snippets

  • Code Language
  • Title
  • Submitter
  • Average Score
  • Likes
  • Date Added
  • Last Updated
  • Comments ReceivedImages
  • Public/Private Image
  • Title
  • Submitter
  • Description
  • Likes
  • Date Added
  • Comments ReceivedForum
  • Forum Name
  • Title
  • Author (Descriptions)
  • Date Posted
  • Comments Posted (Statistics)
    [size=14]Special thanks to Jonesy44 for giving me a hand with the regex on the on text event.[/size]

Here's a picture:
Image

Enjoy! :D

alias -l addmark { return $+($sock($1).mark,$chr($3),$2) }
alias -l between { noop $regex($1,/\Q $+ $2 $+ \E(.*?)\Q $+ $3 $+ \E/gi) | return $regml($4) }
alias -l htmlfree { var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;) | return $remove($replace(%x,&quot;,",&lt;,<,&gt;,>,$cr,$chr(32),$lf,$chr(32),&amp;,&),$chr(9)) }
alias -l smsg { msg $iif(c isincs $chan($1).mode,$1 $strip($2-),$1-) }

on *:text:*:#: {
  if ($regex($1-,(http\:\/\/)www\.hawkee\.com\/(snippet\/\d*|profile\/img\/\d*|phpBB2\/viewtopic\.php\?t=\d*))) { sockopen hawkee www.hawkee.com 80 | sockmark hawkee $+(#,|,$+(/,$regml(2),/),|,$gettok($regml(2),$iif($numtok($regml(2),47) > 2,2,1),47)) }
}

on *:sockopen:hawkee: { tokenize 124 $sock(hawkee).mark | sockwrite -n $sockname GET $2 HTTP/1.0 | sockwrite -n $sockname Host: www.hawkee.com $+ $crlf $+ $crlf }
on *:sockread:hawkee: {
  tokenize 124 $sock(hawkee).mark
  if ($3 == snippet) {
    sockread %hawkee
    if (<title> isin %hawkee) { var %x $htmlfree(%hawkee) | sockmark hawkee $addmark(hawkee,$gettok(%x,1 - $calc($numtok(%x,45) - 1),45),124) | sockmark hawkee $addmark(hawkee,$gettok($gettok(%x,$numtok(%x,45),45),1 - $numtok(%x,32),32),124) }
    if (<td align=left width=290 style="font-size: 14px"><b> isin %hawkee) { sockmark hawkee $addmark(hawkee,$htmlfree(%hawkee),124) }
    if (likes<br> isin %hawkee) { sockmark hawkee $addmark(hawkee,$htmlfree(%hawkee),124) }
    if (<td align=left>Date Added&nbsp;</td> isin %hawkee) { sockread %hawkee | sockmark hawkee $addmark(hawkee,$htmlfree(%hawkee),124) }
    if (<td align=left>Last Updated&nbsp;</td> isin %hawkee) { sockread %hawkee | sockmark hawkee $addmark(hawkee,$htmlfree(%hawkee),124) }
    if (<a href='/snippets/'>Code Snippets</a> isin %hawkee) { sockmark hawkee $addmark(hawkee,$gettok($gettok($htmlfree(%hawkee),3,62),1,39),124) }
    if (<h1 style="display: inline;">Comments</h1> isin %hawkee) { sockmark hawkee $addmark(hawkee,$remove($gettok($htmlfree(%hawkee),2,32),$chr(40),$chr(41)) comment(s),124) }
  }
  elseif ($3 == img) {
    sockread %hawkee
    if (<title> isin %hawkee) { sockmark hawkee $addmark(hawkee,$gettok($htmlfree(%hawkee),1 - $calc(%numtok(%x,45) - 1),45),124) }
    if (<span style="color: #777; font-size: 11px;"> isin %hawkee) { sockmark hawkee $addmark(hawkee,$htmlfree(%hawkee),124) }
    if (" style="display: inline;"> isin %hawkee) { sockread %hawkee | sockmark hawkee $addmark(hawkee,$htmlfree(%hawkee),124) }
    if (<div style="padding-bottom: 10px;"> isin %hawkee) { sockread %hawkee | sockread %hawkee | sockmark hawkee $addmark(hawkee,$htmlfree(%hawkee),124) }
    if (<div class='itemfooter'> isin %hawkee) { sockread %hawkee | sockmark hawkee $addmark(hawkee,$htmlfree(%hawkee),124) }
    if (My Images</a> isin %hawkee) { sockmark hawkee $addmark(hawkee,$gettok($gettok($htmlfree(%hawkee),2,62),1,39),124) }
    if (<img src='/images/spacer.gif' height=2 width=1><br> isin %hawkee) { sockread %hawkee | sockmark hawkee $addmark(hawkee,$htmlfree(%hawkee),124) }
  }
  elseif ($3 == phpBB2) {
    sockread %hawkee
    if (<title> isin %hawkee) { sockmark hawkee $addmark(hawkee,$gettok($gettok($htmlfree(%hawkee),$numtok($htmlfree(%hawkee),45),45),1 - $numtok($htmlfree(%hawkee),32),32),124) }
    if (Hawkee.com Forum Index</a> isin %hawkee) { inc %hawk | if (%hawk == 1) { sockread %hawkee | sockmark hawkee $addmark(hawkee,$htmlfree(%hawkee),124) } }
    if (<td width="150" align="left" valign="top" class="row1"><img src='/images/spacer.gif' width=150 height=1><br><span class="name"> isin %hawkee) { inc %hawk2 | if (%hawk2 == 1) { var %x %hawkee | sockmark hawkee $addmark(hawkee,$htmlfree($between(%x,</a><b>,</b></span><br />,1) $+($chr(40),$chr(32),$between(%x,<br /><br />,<br />Posts:,1) $chr(47) $between(%x,<br />,<br />,3) $chr(47) $iif($between(%x,<br />L,</span><br /></td>,1),$+(L,$v1),No Location)),$chr(41)),124) } | sockmark hawkee $addmark(hawkee,%hawk2,124) }
    if (<span class="gen"> isin %hawkee) { inc %hawk3 | if (%hawk3 == 1) { sockmark hawkee $addmark(hawkee,$between(%hawkee,<span class="postdetails">Posted: ,<span class="gen">,1),124) } | sockmark hawkee $addmark(hawkee,%hawk3,124) }
  }
}
on *:sockclose:hawkee: {
  tokenize 124 $sock(hawkee).mark
  if ($3 == snippet) { smsg $1 [7H14awkee]: $+($chr(40),,$5,,$chr(41)) - Title: $4 - Submitted by: $6 - Average Score: $8 - Likes: $7 - Date Added: $9 - Last Updated: $10 - Comments received: $11 }
  elseif ($3 == img) { smsg $1 [7H14awkee]: $+($chr(40),,$6,,$chr(41)) - Title: $4 - Submitted by: $5 - Description: $8 - Likes: $7 - Date Added: $10 - Comments received: $9 }
  elseif ($3 == phpBB2) { smsg $1 [7H14awkee]: $+($chr(40),,$3,$chr(32),/,$chr(32),$5,,$chr(41)) - Title: $4 - Author: $6 - Date Posted: $8 - Comments Posted: $+(,$calc($9 + $10), comments in total) - $+($chr(40),$chr(32),,$9, comments by threadstarter / ,$iif($10,$v1,0), comments from others,$chr(32),$chr(41)) }
  unset %hawk*
}

Comments

Sign in to comment.
kenJi   -  Sep 02, 2010

uhh sir kirby can u make me a script like that in my forum/site?. pls reply..

 Respond  
montague   -  Apr 04, 2010

+1 like.

 Respond  
Jonesy44   -  Apr 06, 2009

ok

 Respond  
Hawkee   -  Apr 06, 2009

jonesy, I'm just referring to the Hawkee.com business entity.

 Respond  
Jonesy44   -  Apr 06, 2009

"we'll be making changes"
Who's "we"?

 Respond  
Kirby   -  Apr 05, 2009

You probably want to minimize the amount of HTML you're matching against because it's very likely we'll be making changes to the design that will break this snippet.I actually have tried my best to use as little tags as possible, and to get as much information out of those tags, for this script.
If new changes are made to the website, or whenever changes are made, I will update this snippet as soon as possible.

 Respond  
Hawkee   -  Apr 02, 2009

You probably want to minimize the amount of HTML you're matching against because it's very likely we'll be making changes to the design that will break this snippet.

 Respond  
Kirby   -  Apr 02, 2009

Thanks. :D

 Respond  
MaxEvans   -  Apr 02, 2009

Awesome, I'll definitely use this.

/me rates 9/10 =]

 Respond  
Jonesy44   -  Apr 02, 2009

Nice job Kirby. Nicely done ;) 9/10

 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.