Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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)) { get_title $chan %w }
- inc %i
- }
- }
- alias get_title {
- if (!$1) && (!$2) { return }
- var %dom = $gettok($2-,2,47)
- var %url = $gettok($2-,3-,47)
- :start
- var %s = URL_SEARCH_ $+ $ticks $+ $rand(1,100000)
- if ($sock(%s)) { goto start }
- if (*https://* iswm $1-) { sockopen -e %s %dom 443 }
- else { sockopen %s %dom 80 }
- sockmark %s $1 %url
- socklist
- }
- ON *:SOCKOPEN:URL_SEARCH_*: {
- if ($sockerr) { return }
- sockwrite -nt $sockname GET / $+ $gettok($sock($sockname).mark,2-,32) HTTP/1.1
- sockwrite -nt $sockname User-Agent: Mozilla/5.0 (Windows NT 10.0 $+ $chr(59) Win64 $+ $chr(59) x64 $+ $chr(59) rv:61.0) Gecko/20100101 Firefox/61.0
- sockwrite -nt $sockname Host: $sock($sockname).addr
- sockwrite -nt $sockname Connection: Close
- sockwrite -nt $sockname $crlf
- }
- ON *:SOCKREAD:URL_SEARCH_*: {
- if ($sockerr) { return }
- var %r
- sockread %r
- ; echo 2 -s DEBUG: %r
- if ($regex(%r,/\<title\>(.*)\<\/title\>/i)) {
- var %title = $regml(1)
- var %c = $gettok($sock($sockname).mark,1,32)
- if (%title) && ($me ison %c) { msg %c Title: %title }
- sockclose $sockname
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement