!snippet : get latest snippet from hawkee.com

By QuickStep on Aug 22, 2005

A snippet to retrieve the latest snippet. Enjoy. This is a very simple version, someboy may improve it if they feel like it

;Usage: somebody must type !snippet in the channel

;If somebody types:
;  !snippet <-- Messages latest mirc snippet
;  !snippet mirc <-- Also messages latest mirc snippet
;  !snippte php <-- Messages latest php snippet
;  !snippet tcl <-- Messages latest tcl snippet
;As you can see '!snippet' is enough to retrieve a mirc snippet

on *:TEXT:!snippet*:#:{
  var %sock = $+(hawkee,#,$nick), %type = $iif($2 isin tcl php,$v1,mirc)
  ;msg # Now checking http://www.hawkee.com for the latest snippet...
  if ($sock(%sock)) return
  sockopen %sock www.hawkee.com 80
  sockmark %sock $lower(%type) #
}
on *:SOCKOPEN:hawkee*:{
  var %a = sockwrite -n $sockname
  %a GET $+(/snippets.php?snippet_type=,$getmark($sockname,1)) HTTP/1.1
  %a Host: www.hawkee.com
  %a Connection: close
  %a $crlf
}
on *:SOCKREAD:hawkee*:{
  var %temp, %re = <a href="snippet.php\?snippet_id=([[:digit:]]+)">(.+)</a>
  sockread %temp
  if ($regex(%temp,%re) && ($regml(0) = 2)) {
    msg $getmark($sockname,2) Latest $+($chr(31),$getmark($sockname,1),$chr(31)) snippet: $&
      $+($chr(2),NAME,$chr(2)): $regml(2) $+($chr(2),URL,$chr(2),:) $&
      $+($chr(31),$chr(3),12,http://www.hawkee.com/snippet.php?snippet_id=,$regml(1),$chr(3),$chr(31))
    sockclose $sockname
  }
}
alias -l getmark return $gettok($sock($1).mark,$$2,32)

Comments

Sign in to comment.
Eugenio   -  Feb 22, 2008

oh right

 Respond  
Hawkee   -  Feb 22, 2008

I\'m sure Quickstep needs to modify the code. Our HTML layout changed since he originally posted which probably broke the scraper.

 Respond  
Eugenio   -  Feb 22, 2008

Dont Work!

 Respond  
Hawkee   -  Mar 21, 2007

I think I may have just broken this with the new snippet system.

 Respond  
`Shippo   -  Oct 26, 2005

Awesome script I like it and so do my friends and yoinx is right you should be more active here.

 Respond  
Yoinx   -  Aug 24, 2005

That\'s good, You\'re an amazing scripter and it would be great to see you more active here. :)

 Respond  
QuickStep   -  Aug 23, 2005

Thanks for the positive feedback guys. This is the motivation that I need to do more for the hawkee community

 Respond  
Hawkee   -  Aug 23, 2005

No, but I\'ll have to implement one someday.

 Respond  
Yoinx   -  Aug 23, 2005

Do you have an RSS feed?

 Respond  
Hawkee   -  Aug 23, 2005

How about making this into a snippet RSS server, that\'d be pretty cool.

 Respond  
DeathRyder082   -  Aug 22, 2005

;msg # Now checking http://www.hawkee.com for the latest snippet...
Don\'t know if you wanted the \';\' there, just wanted to point that out. I like this idea, and It would be nice if someone could update this to download perhaps maybe one of the top ten scripts on command? And the same with snippets, like someone type the snippet name, it checks the archive and returns it, then they select which one they want and they can download it. Thats a bit extreme though. I give this a 8, I can perdict more to come to this same idea on here.

 Respond  
Zachery   -  Aug 22, 2005

soo cool keep up the good work

 Respond  
brottor   -  Aug 22, 2005

Ya nice snippet but only thing is...ima make it so i can get em myself:D

 Respond  
Hawkee   -  Aug 22, 2005

Pretty cool QuickStep, Thanks for the Support!

 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.