Hawkee (latest) review search

By Lindrian on Feb 28, 2008

This is my versions of mountaindews review search.
Command referance:
/reviews [#channel] [search criteria]
!reviews [search criteria]

/reviews Wii - Searches for "Wii" and echos the info.
/reviews #Lindrian - Messages all the latest reviews to #Lindrian
/reviews #Lindrian Wii - Searches for "Wii" and messages the info to #Lindrian.

!reviews Wii - Searches for "Wii" and messages the info.
!reviews - Messages all the latest reviews to the channel.

If you want it to only return one result, uncomment the ".sockclose $sockname" on line 41.


alias reviews {
  unset %hawkee
  if ($left($1,1) isin $chantypes) var %chan = $1
  else var %search = $1-
  if ($2) && (!%search) var %search = $2-
  var %x = $+(reviews.,$r(0,9),$r(0,9),$r(0,9),$r(a,z),$r(a,z)), %u = $iif(%chan && $me ison $1,msg $1,echo -a)
  if (%hawkee.stop) %u This command was recently used, please wait a few seconds.
  else {
    %u $iif(%search,Searching for reviews matching $qt($iif($left($1,1) !isin $chantypes,$1-,$2-)),Looking up the latest reviews) on hawkee.com, please hold...
    sockopen %x www.hawkee.com 80
    sockmark %x $+(%chan,$chr(1),%search)
    set -u10 %hawkee.stop 1
on *:SOCKOPEN:reviews.*: {
  tokenize 1 $sock($sockname).mark
  if ($sockerr) $iif($left($1,1) isin $chantypes && $me ison $1,msg $1,echo -a) There was an error while connecting to the hawkee server! Please try again later!
  else {
    sockwrite -nt $sockname GET $iif($left($1,1) !isin $chantypes || $2 && $1,/shop/search/ $+ $replace($iif($2,$2,$1),$chr(32),+) $+ /reviews/,/shop/reviews) HTTP/1.1
    sockwrite -nt $sockname Host: www.hawkee.com
    sockwrite -nt $sockname $crlf
on *:SOCKREAD:reviews.*: {
  tokenize 1 $sock($sockname).mark
  var %x, %i = $iif($left($1,1) isin $chantypes && $me ison $1 && $1 ischan,msg $1,echo -a)
  sockread %x
  if ($regex(a,%x,/<div class='.*' style="height: 27px;">(.*?)<\/div>/i)) {
    %i $regml(a,1)
    .sockclose $sockname
  if ($regex(b,%x,/<td align=left valign=top style="padding-left: 10px;"><a href='(.*?)' class='large'>(.*?)<\/a><\/td>/i)) set $+(%,$sockname) $+($regml(b,1),$chr(1),$regml(b,2),$chr(1))
  if ($regex(c,%x,/<td valign=top class='\w+' style="padding-left: 5px; padding-right: 0px;"><a href=".*?" class='product'>(.*?)<\/a><br><br>/i)) && (% [ $+ [ $sockname ] ]) {
    tokenize 1 $+(% [ $+ [ $sockname ] ],$regml(c,1))
    set $+(%,$sockname) $b(Title:) $2 $b(Product:) $3 $b(Link:) http://www.hawkee.com $+ $1
    inc %hawkee
  if ($regex(d,%x,/(?!.*(?:http:\/\/|www)).*(?:by|on) <a href='.*?' class='smaller'>(.*?)<\/a><br>.*/i)) {
    %i $+($chr(35),%hawkee -) % [ $+ [ $sockname ] ] $b(By:) $regml(d,1)
    unset $+(%,$sockname)
    ; .sockclose $sockname
on *:TEXT:!reviews*:#: reviews $chan $2-
alias -l b return $+($chr(2),$1,$chr(2))


Sign in to comment.
guest598594   -  Apr 22, 2008

Where you see the \"; .sockclose $sockname\", you could replace that with inc %var, and then if (%var == 3) sockclose $sockname

SiLver_ShaDow   -  Mar 25, 2008

hi, ty for this cool snippet

but its verry flood,

L@Gh @T L@aD |/p>

if u can change it to view just the first 3 or 5 results

will be better

ty again :)

Lindrian   -  Mar 03, 2008

FURBY*: not in this case :p

F*U*R*B*Y*   -  Feb 29, 2008

dialog\'s <3

LordHawk   -  Feb 29, 2008

nicely done

Lindrian   -  Feb 29, 2008

Oh right. The only problem is how you will allow the user to function them. I would probably have to go and use switches, like /reviews -l would return the latest, etc etc. But that would be a little annoying in the channel i belive.

Hawkee   -  Feb 29, 2008

Don\'t forget there are different sort options.

Lindrian   -  Feb 28, 2008

Thanks :)

guest598594   -  Feb 28, 2008

nice job Lindrian

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.