Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; --------------
- alias -l api_key { return REGISTER_ON_EMBED_LY }
- ; --------------
- alias -l urlencode { return $regsubex($1-,/([^a-z0-9])/ig,% $+ $base($asc(\t),10,16,2)) }
- alias -l isurl { noop $regex(isurl,$1-,m@^((?:(?:https?)://(?:www\.)?|www\.)((?:(?:[-\w]+\.)+)[-\w]+)(?::\d+)?(?:/(?:[-a-zA-Z;/\d#:_?=&@,()+~.%]*))?)$@ig) | return $iif($regml(isurl,0),1,0) }
- ON *:TEXT:*:#: {
- tokenize 32 $strip($1-)
- var %t = $numtok($1-,32)
- var %i = 1
- while (%i <= %t) {
- var %w = $gettok($1-,%i,32)
- if (%w) && ($isurl(%w)) { scan_url $chan %w }
- inc %i
- }
- }
- alias scan_url {
- if (!$1) && (!$2) { return }
- if ($me !ison $1) { return }
- var %v = URL_SEARCH_ $+ $ticks $+ $rand(1,100000000)
- var %u = https://api.embed.ly/1/extract?key= $+ $api_key $+ &format=json&nojsoncallback=1&url= $+ $urldecode($2-)
- JSONOpen -ud %v %u
- if ($jsonerror) { return }
- var %title = $json(%v,description).value
- if (%title) { msg $1 Title: %title }
- }
Add Comment
Please, Sign In to add comment