Advertisement
illpastethat

TFLN and unshorten chromatic

Aug 11th, 2013
390
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 1.27 KB | None | 0 0
  1. on $*:text:/^!tfln$/iS:#:tfln $chan
  2. on *:input:#:if ($regex($1,/^!tfln$/iS)) tfln #
  3. alias -l tfln {
  4.   if (!%f) { inc -u4  %f
  5.     if ($sock(tf)) sockclose tf
  6.     sockopen tf www.textsfromlastnight.com 80
  7.     sockmark tf describe $1 :[Text From Lastnight]:
  8.   }
  9. }
  10. on *:sockopen:tf: {
  11.   sockwrite -n tf GET /Random-Texts-From-Last-Night.html?t= HTTP/1.1
  12.   sockwrite -n tf Host: $+($sock(tf).addr,$str($crlf,2))
  13. }
  14. on *:sockread:tf: {
  15.   var %tf | sockread %tf
  16.   if ($regex(%tf,/<textarea.+>(.+?)<\/text.+>/)) {
  17.     var %link $wildtok($regml(1),http://*,1,32)
  18.     unshorten %link
  19.     set %tfln $sock($sockname).mark $replace($remove($regml(1),%link),&#39;,',&quot;,",&#45;,-)
  20.     sockclose $sockname
  21.   }
  22. }
  23.  
  24. alias unshorten {
  25.   if (!$1) { echo -ac info SYNTAX /unshorten LINK | halt }
  26.   if ($sock(unshorten)) sockclose unshorten
  27.   sockopen unshorten api.unshorten.it 80
  28.   sockmark unshorten $1
  29. }
  30.  
  31. on *:sockopen:unshorten: {
  32.   var %x sockwrite -nt $sockname
  33.   %x GET $+(/?shortURL=,$sock($sockname).mark,&apiKey=f1b4c050d55b97f6ee016915c5de50c2) HTTP/1.1
  34.   %x Host: api.unshorten.it
  35.   %x $crlf
  36. }
  37. on *:sockread:unshorten: {
  38.   if ($sockerr) { echo -a SOCKET ERROR: $sockerr | halt }
  39.   else {
  40.     sockread &t
  41.     %tfln >> $bvar(&t,$+($bfind(&t,1,http:),-)).text
  42.   }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement