Jump to content

Archived

This topic is now archived and is closed to further replies.

chain

Link Detector / Get Link Info

Recommended Posts

  • Administrators

Detects links when typed in channels that have been activated and returns the title from www.GetLinkInfo.com

  • This is a bot script and should be loaded in a second mIRC client.
  • Type +linkinfo in each channel you want this script to run in. (Requires ops or higher)
  • There are settings at the top of the script for logo, text color and ignoring youtube links.
;GetLinkInfo Script by Ford_Lawnmower irc.GeekShed.net #Script-Help
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Start Setup;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Change this to 0 to resolve youtube links
alias -l IgnoreYoutubeLinks return 1
;Change this to change the logo
alias -l GetLinkInfoLogo return $+($chr(3),12,LinkInfo:)
;Change this to change the text color
alias -l GetLinkInfoTextColor return $+($chr(15),$chr(2))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;End Setup;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
menu Channel,Status {
  .$iif($group(#GetLinkInfo) == On,$style(1)) GetLinkInfo
  ..$iif($group(#GetLinkInfo) == On,$style(2)) On: .enable #GetLinkInfo
  ..$iif($group(#GetLinkInfo) == Off,$style(2)) Off: .disable #GetLinkInfo
}
#GetLinkInfo on
On $*:Text:/(^[+-]LinkInfo|(https?|www\.)(www\.)?[\S]*)/Si:#: {
  var %action $strip($regml(1))
  if ($regex(action,%action,^[+-])) && ($regex($nick($chan,$nick).pnick,/(!|~|&|@)/)) {
    if (+* iswm %action) {
      if ($istok(%linkinfoChanList,$+($network,$chan),32)) { .msg $chan $nick $chan is already running the linkinfo script }
      else { 
        .enable #GetLinkInfo
        Set %linkinfoChanList $addtok(%linkinfoChanList,$+($network,$chan),32)
        .msg $chan $nick has activated the linkinfo script for $chan .
      }
    }
    else {
      if (!$istok(%linkinfoChanList,$+($network,$chan),32)) { .msg $chan $nick $chan is not running the linkinfo script }
      else { 
        Set %linkinfoChanList $remtok(%linkinfoChanList,$+($network,$chan),1,32)
        .msg $chan $nick has deactivated the linkinfo script for $chan . 
      }
    }
  }
  elseif (!$timer($+(linkinfo,$network,$chan))) && ($istok(%linkinfoChanList,$+($network,$chan),32)) {
    .timer $+ $+(linkinfo,$network,$chan) 1 1 noop
    var %method msg #
    if ($IgnoreYoutubeLinks && $regex(%action,/(?:^https?:\/\/|www\.)(?:[\S]*youtube\.com|youtu\.be)/i)) {
      return
    }
    else {
      Getlinkinfo %method $gettok(%action,2-,47)
    }
  }
}
#GetLinkInfo end
alias linkinfo { Getlinkinfo echo -a $1- }
alias -l Getlinkinfo {
  var %sockname $+(LinkInfo,$network,$2,$ticks)
  sockopen %sockname www.getlinkinfo.com 80
  svar %sockname method $1-2
  svar %sockname url $+(/info?link=,$urlencode($+(http://,$3)))
}
On *:sockopen:LinkInfo*: {
  if (!$sockerr) {
    sockwrite -nt $sockname GET $svar($sockname,url) HTTP/1.1
    sockwrite -n $sockname Host: $sock($sockname).addr
    sockwrite -n $sockname $crlf
  }
  else { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
}
On *:sockread:LinkInfo*: {
  if ($sockerr) { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
  else {
    var %LinkInfo | sockread %LinkInfo
    if ($regex(%LinkInfo,/<dd><b>(.*?)<\/b><\/dd>/i)) {
      $svar($sockname,method) $GetLinkInfoLogo $+($GetLinkInfoTextColor,$Xchr($Xchr($regml(1))))
      sockclose $sockname
      return
    }
  }
}
alias  Xchr { 
  var %return $regsubex($regsubex($1-,/([A-F0-9]{1,2});/g,$chr($base($regml(\n),16,10))),/([0-9]{2,4});/g,$utf8(\1)) 
  return $xXchr($replacecs(%return,–,$utf8(8211),—,$utf8(8212),¡,$utf8(161),·,·,»,»,«,«,Ü,Ü,$&
  ü,ü,Á,Á,á,á,É,É,¿,$utf8(191),“,$utf8(8220),”,$utf8(8221),',',$&
  ‘,$utf8(8216),’,$utf8(8217),¢,$utf8(162),©,$utf8(169),÷,$utf8(247),µ,$utf8(181),$&
  ¶,$utf8(182),±,±,€,$utf8(8364),£,£,®,$utf8(174),§,$utf8(167),™,$utf8(153),$&
  ¥,$utf8(165),¤,$utf8(164),¦,$utf8(166),§,$utf8(167),¨,$utf8(168),ª,$utf8(170),$&
  ¬,$utf8(172),­,$utf8(173),¯,$utf8(175),°,$utf8(176),²,$utf8(178),³,$utf8(179),$&
  ´,´,ç,$utf8(184),¹,$utf8(185),º,$utf8(186),¼,$utf8(188),½,$utf8(189),$&
  ¾,$utf8(190),À,$utf8(192),Â,$utf8(194),Ã,$utf8(195),Ä,$utf8(196),Å,$utf8(197),$&
  Æ,$utf8(198),Ç,$utf8(199),È,$utf8(200),Ê,$utf8(202),Ë,$utf8(203),Ì,$utf8(204),Î,$utf8(206),$&
  Ï,$utf8(207),Ð,$utf8(208),Ò,$utf8(210),Ô,$utf8(212),Õ,$utf8(213),Ö,$utf8(214),×,$utf8(215),$&
  Ø,$utf8(216),Ù,$utf8(217),Û,$utf8(219),Ý,$utf8(221),Þ,$utf8(222),ß,$utf8(223),à,$utf8(224),$&
  â,$utf8(226),ã,$utf8(227),ä,$utf8(228),å,$utf8(229),ç,$utf8(231),è,$utf8(232),ê,$utf8(234),ë,$utf8(235),$&
  ì,$utf8(236),î,$utf8(238),ï,$utf8(239),ð,$utf8(240),ò,$utf8(242),ô,$utf8(244),õ,$utf8(245),ö,$utf8(246),$&
  ÷,$utf8(247),ø,$utf8(248),ù,$utf8(249),û,$utf8(251),ý,$utf8(253),þ,$utf8(254),ÿ,$utf8(255),∠,$utf8(8736),$&
  ∧,$utf8(8743),ƒ,$utf8(402),Α,$utf8(913),Β,$utf8(914),Γ,$utf8(915),Δ,$utf8(916),Ε,$utf8(917),Ζ,$utf8(918),$&
  Η,$utf8(919),Θ,$utf8(920),Ι,$utf8(921),Κ,$utf8(922),Λ,$utf8(923),Μ,$utf8(924),Ν,$utf8(925),Ξ,$utf8(926),$&
  Ο,$utf8(927),Π,$utf8(928),Ρ,$utf8(929),Σ,$utf8(931),Τ,$utf8(932),Υ,$utf8(933),Φ,$utf8(934),Χ,$utf8(935),$&
  Ψ,$utf8(936),Ω,$utf8(937),α,$utf8(945),β,$utf8(946),γ,$utf8(947),δ,$utf8(948),ε,$utf8(949),ζ,$utf8(950)))
}
alias -l xXchr {
  return $replacecs($1-,η,$utf8(951),θ,$utf8(952),ι,$utf8(953),κ,$utf8(954),λ,$utf8(955),μ,$utf8(956),$&
  ν,$utf8(957),ξ,$utf8(958),ο,$utf8(959),π,$utf8(960),ρ,$utf8(961),ς,$utf8(962),$&
  σ,$utf8(963),τ,$utf8(964),υ,$utf8(965),φ,$utf8(966),χ,$utf8(967),ψ,$utf8(968),$&
  ω,$utf8(969),ϑ,$utf8(977),ϒ,$utf8(978),ϖ,$utf8(982),•,$utf8(8226),…,$utf8(8230),$&
  ′,$utf8(8242),″,$utf8(8243),‾,$utf8(8254),⁄,$utf8(8260),℘,$utf8(8472),$&
  ℑ,$utf8(8465),ℜ,$utf8(8476),™,$utf8(8482),ℵ,$utf8(8501),←,$utf8(8592),$&
  ↑,$utf8(8593),→,$utf8(8594),↓,$utf8(8595),↔,$utf8(8596),↵,$utf8(8629),⇐,$utf8(8656),$&
  ⇑,$utf8(8657),⇒,$utf8(8658),⇓,$utf8(8659),⇔,$utf8(8660),∀,$utf8(8704),∂,$utf8(8706),$&
  ∃,$utf8(8707),∅,$utf8(8709),∇,$utf8(8711),∈,$utf8(8712),∉,$utf8(8713),∋,$utf8(8715),$&
  ∏,$utf8(8719),∑,$utf8(8721),−,$utf8(8722),∗,$utf8(8727),√,$utf8(8730),∝,$utf8(8733),$&
  ∞,$utf8(8734),∨,$utf8(8744),∩,$utf8(8745),∪,$utf8(8746),∫,$utf8(8747),∴,$utf8(8756),$&
  ∼,$utf8(8764),≅,$utf8(8773),≈,$utf8(8776),≠,$utf8(8800),≡,$utf8(8801),≤,$utf8(8804),$&
  ≥,$utf8(8805),⊂,$utf8(8834),⊃,$utf8(8835),⊄,$utf8(8836),⊆,$utf8(8838),⊇,$utf8(8839),$&
  ⊕,$utf8(8853),⊗,$utf8(8855),⊥,$utf8(8869),⋅,$utf8(8901),⌈,$utf8(8968),⌉,$utf8(8969),$&
  ⌊,$utf8(8970),⌋,$utf8(8971),〈,$utf8(9001),〉,$utf8(9002),◊,$utf8(9674),♠,$utf8(9824),$&
  ♣,$utf8(9827),♥,$utf8(9829),♦,$utf8(9830),é,é,Í,Í,í,í,Ó,Ó,ó,ó,$&
  Ñ,Ñ,ñ,ñ,Ú,Ú,ú,ú, ,$chr(32),æ,æ,",",<,<,>,>, &,&,",")
}
alias -l urlencode { 
  return $regsubex($replace($1-,$chr(32),$+(%,2d),$+(%,20),$+(%,2d)),/([^a-z0-9])/ig,% $+ $base($asc(\t),10,16,2))
}
alias -l Svar {
  var %sockname $1, %item $+($2,$1)
  if ($isid) {
    if ($regex(svar,$sock(%sockname).mark,/ $+ %item $+ \x01([^\x01]*)/i)) return $regml(svar,1)
  }
  elseif ($3)  {
    var %value $3-
    if (!$regex(svar,$sock(%sockname).mark,/ $+ %item $+ \x01/i)) { sockmark %sockname $+($sock(%sockname).mark,$chr(1),%item,$UTF8(1),%value) }
    else { sockmark %sockname $regsubex(svar,$sock(%sockname).mark,/( $+ %item $+ \x01[^\x01]*)/i,$+(%item,$chr(1),%value)) }
  }
}
alias -l UTF8 {
  if ($version >= 7) return $chr($1)
  elseif ($1 < 255) { return $chr($1) }
  elseif ($1 >= 256) && ($1 < 2048) { return $+($chr($calc(192 + $div($1,64))),$chr($calc(128 + $mod($1,64)))) }
  elseif ($1 >= 2048) && ($1 < 65536) { return $+($chr($calc(224 + $div($1,4096))),$chr($calc(128 + $mod($div($1,64),64))),$chr($calc(128 + $mod($1,64)))) }
  elseif ($1 >= 65536) && ($1 < 2097152) {
    return $+($chr($calc(240 + $div($1,262144))),$chr($calc(128 + $mod($div($1,4096),64))),$chr($calc(128 + $mod($div($1,64),64))),$&
      $chr($calc(128 + $mod($1,64))))
  }
}
alias -l div { return $int($calc($1 / $2)) }
alias -l mod {
  var %int $int($calc($1 / $2))
  return $calc($1 - (%int * $2))
}
alias -l H2U { return $utf8($base($1,16,10)) }

By FordLawnmower

Link to comment
Share on other sites



×
×
  • Create New...