Hawkee Product Search

By mountaindew on Mar 17, 2008

This is just a quick snippet I made that searches through the Price Comparison here on Hawkee. It returns the Product name, Brand, Price, and URL.

Syntax: [/product|!product] [product search]

Examples:

/product Nintendo Wii !product Plasma TV

Screens:

Image

Image

Right now, it returns the top 3 results. If you want to change that, simply change "if (%N == 3)" to "if (%N == NUMBER)"

Enjoy Image

;~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~
;           Hawkee Product Search                *
;            Made by MountainDew                 ~ 
; IRC.DeltaAnime.Net ? #Lindrian #mIRC-Scripting *
;  US.UnderNet.Org ? #Hawkee.com #mircscripting  ~
;*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*

on $*:TEXT:/^[.!@](prod(uct)?)/Si:#:{
  set %p.chan $chan
  product $2-
}
alias product {
  if ($sock(product)) {
    %pmsg Please wait until the current search is finished.
    halt
  }
  set %pmsg $iif(%p.chan,msg %p.chan,echo -a)
  if (!$1) {
    %pmsg Syntax: $iif(%p.chan,!,/) $+ product [product name]
    halt
  }
  set %p.search $1-
  $iif(%p.chan,describe %p.chan searches,echo -a Searching) for $qt(%p.search) in Hawkee Price Comparison...
  sockopen product www.hawkee.com 80
}
on *:sockopen:product:{
  sockwrite -nt $sockname GET /shop/search/ $+ $replace(%p.search,$chr(32),+) $+ / HTTP/1.1
  sockwrite -nt $sockname Host: www.hawkee.com
  sockwrite -nt $sockname $crlf
}
on *:sockread:product:{
  var %x
  sockread %x
  if (no products found isin %x) {
    %pmsg No products found for $qt(%p.search) $+ .
    sockclose $sockname
    unset %p.* %pmsg
  }
  if ($regex(%x,/<a href="(\/shop\/prod\/\d+\/)" class='large'>(.+)<\/a><br>/i)) {
    set %p.url http://www.hawkee.com $+ $regml(1)
    set %p.prod $regml(2)
  }
  if (<div style='height: 37px;'> isin %x) {
    sockread %x
    set %p.brand $remove(%x,$chr(9))
  }
  if ($regex(%x,/<img src='\/shop\/images\/rating_set\.gif'>/i)) inc %p.rating
  if ($regex(%x,/<a href="\/shop\/prod\/\d+\/" class="large">(\$.+)<\/font>/i)) {
    %pmsg 9• 4Product: %p.prod 4Brand: %p.brand 4Price: $regml(1) 4Rating: $iif(%p.rating,$v1,0) $+ /5 4URL: %p.url
    inc %N
    if (%N == 3) {
      sockclose $sockname
      unset %p.* %N %pmsg
    }
    unset %p.*
  }
}
alias products product $1-
Sign in to comment.
mountaindew   -  May 09, 2008

Updated to work with the new site layout, and it now includes ratings.

 Respond  
mountaindew   -  Mar 22, 2008

I have no clue how to script TCL, so not me

 Respond  
Hawkee   -  Mar 22, 2008

Anybody up for making this into a TCL snippet?

 Respond  
Hawkee   -  Mar 22, 2008

Awesome mountaindew, I love it!

 Respond  
mountaindew   -  Mar 17, 2008

ty Eugenio

 Respond  
Eugenio   -  Mar 17, 2008

Looks amazing

 Respond  
mountaindew   -  Mar 17, 2008

Enjoy Image

 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.