Advertisement
Guest User

Untitled

a guest
Jun 24th, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.84 KB | None | 0 0
  1. alias -l rawurlencode {
  2. return $regsubex($1-,/\G(.)/g,$iif(\t !isalnum && \t !isin -_.,$chr(37) $+ $base($asc(\t),10,16,2),\t))
  3. }
  4.  
  5. alias -l urlencode {
  6. return $replace($rawurlencode($1-),$+($chr(37),20),+)
  7. }
  8. alias ungoo.gl hfree GglShrt
  9. alias g.logo return 2G4o7o2g3l4e URL Shortener
  10.  
  11.  
  12. alias goo.gl {
  13. ;echo -a hi $1-
  14. if (!$hget(GglShrt,output)) { hadd -mu40 GglShrt output }
  15. if (!$1) { $hget(GglShrt,output) $g.logo error: insufficient parameters | ungoo.gl | halt }
  16. if ($sock(googleshort)) { $hget(GglShrt,output) $g.logo error: socket in use | ungoo.gl | halt }
  17.  
  18. var %s $1, %r /(?:^|[][()<>{}'"\s])((?:(?:irc|s?ftp|https?:)\/\/|www\d*\.)[^\s./]+\.(?:\[\S*?]|\(\S*?\)|\{\S*?}|[^][()<>{}'"\s]|['"](?!\s|$|[()\[\]<>]))++)/giS
  19. if (!$regex(%s,%r)) { $hget(GglShrt,output) $g.logo error: invalid URL format | ungoo.gl | halt }
  20.  
  21. sockopen googleshort goo.gl 80
  22. sockmark googleshort $1
  23. }
  24.  
  25. on *:sockopen:googleshort:{
  26. var %s sockwrite -tn $sockname
  27. var %p = url= $+ $urlencode($sock($sockname).mark) $+ &security_token=null, %clen = $len(%p)
  28. %s POST /api/shorten HTTP/1.1
  29. %s Host: goo.gl
  30. %s User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
  31. %s Connection: close
  32. %s X-Auth-Google-Url-Shortener: true
  33. %s Content-Type: application/x-www-form-urlencoded;charset=utf-8
  34. %s Content-Length: %clen
  35. %s $crlf
  36. %s %p
  37. }
  38.  
  39. on *:sockread:googleshort:{
  40. var %g
  41. sockread %g
  42. if ($regex(%g,/Location:\s(.+)/)) {
  43. ; $hget(GglShrt,output) $regml(1)
  44. set %shorty $hget(GglShrt,output) $regml(1)
  45. ; return %shorty
  46. ;$g.logo $+ :12 $sock($sockname).mark <->12
  47. sockclose $sockname
  48. ungoo.gl
  49. halt
  50. }
  51. }
  52. alias rabble2 {
  53.  
  54. ;-// added by MERKiN 2/13/2012
  55. ; Remove those gay ass spaces
  56. %newslink = $1-
  57. %original = $1-
  58. %newslink = $strip(%newslink)
  59. %toklen = $numtok(%newslink, 32)
  60. %1st_bracket = $findtok(%newslink, $chr(93), 32)
  61. %chop_brack1 = $gettok(%newslink, %1st_Bracket - %toklen, 32)
  62. %2nd_bracket = $findtok(%chop_brack1, $chr(91), 32)
  63. %news_desc = $replace($gettok(%newslink, %1st_bracket - %2nd_Bracket, 32),$chr(93),)
  64. %lastbrack = $gettok(%newslink, %2nd_bracket - %toklen, 32)
  65.  
  66. %linky = $findtok(%lastbrack, $chr(91), 32)
  67.  
  68. %link_1 = $gettok(%lastbrack, %linky - %toklen, 32)
  69. %link_1 = $replace(%link_1, $chr(93),,$chr(91),)
  70. if ($numtok(%link_1,32) = 3) {
  71. %remtok = $gettok(%link_1, 2, 32)
  72. %first = $gettok(%link_1,1,32)
  73. %last = $gettok(%link_1,3,32)
  74. %both = %first $+ %last
  75. goo.gl %both
  76.  
  77. ;--- need to find where the fucking link is ---;
  78.  
  79. %replace = $findtok(%original, %remtok, 1, 32)
  80. %dicker = $reptok(%original, %first, %shorty, 32)
  81. %dicker = $remtok(%dicker, %remtok, 0, 32)
  82. %dicker = $remtok(%dicker, %last, 0, 32)
  83.  
  84.  
  85. }
  86.  
  87. else { %dicker = %original }
  88. ;
  89. }
  90.  
  91.  
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement