link checker

By cessil on Nov 23, 2009

this will echo the title of the link pasted in the channel.
example:
http://www.youtube.com/
YouTube - Broadcast Yourself. ( http://www.youtube.com/ )

http://www.hawkee.com/
Hawkee Technology Social Network ( http://www.hawkee.com/ )

on *:text:*:#: {
  if (http:// isin $1-) {
    sockclose linkchecker
    set %link $remove($matchtok($1-,http://,1,32),http://)
    set %linkchan $chan
    set %actlink $matchtok($1-,http://,1,32)
    if (/ !isin %link) { set %link %link $+ / }
    sockopen linkchecker $remove($left(%link,$pos(%link,/,1)),/) 80
    halt
  }
  if (www. isin $1-) {
    sockclose linkchecker
    set %link $matchtok($1-,www.,1,32)
    set %linkchan $chan
    set %actlink $matchtok($1-,www.,1,32)
    if (/ !isin %link) { set %link %link $+ / }
    sockopen linkchecker $remove($left(%link,$pos(%link,/,1)),/) 80
    halt
  }
}
on *:sockopen:linkchecker: {
  if $sockerr > 0 { sockclose $sockname | halt }
  sockwrite -n $sockname GET / $+ $right(%link,$calc($len(%link)- $pos(%link,/,1))) HTTP/1.1
  sockwrite -n $sockname Host: $remove($left(%link,$pos(%link,/,1)),/)
  sockwrite -n $sockname $crlf
}
on *:sockread:linkchecker: {
  if $sockerr > 0 { sockclose $sockname | halt }
  sockread %linkh
  if (%delbug != $null) && ($len(%linkch) <= 150) && (</title> !isin %linkh) { set %linkch %linkch %linkh }
  if (%delbug != $null) && (</title> isin %linkh) {
    echo -t %linkchan 13 $+ $replace(%linkch,&quot;,",&apos;,',&amp;,&,&lt;,<,&gt;,>,&copy;,©,&reg;,®,&trade;,™,&euro;,€,&pound;,£,&yen;,¥) (4 %actlink )
    unset %delbug
    sockclose $sockname
    halt
  }
  if (<title> isin %linkh) {
    set %linkch $remove($left(%linkh,$pos(%linkh,</title>,1)),</title>)
    set %linkch $right(%linkch,$calc($len(%linkch)- $pos(%linkch,<title>,1) -6))
    set %linkch $left(%linkch,$calc($len(%linkch)-1))
    set %delbug 1
    if (%linkch != $null) {
      echo -t %linkchan 13 $+ $replace(%linkch,&quot;,",&apos;,',&amp;,&,&lt;,<,&gt;,>,&copy;,©,&reg;,®,&trade;,™,&euro;,€,&pound;,£,&yen;,¥) (4 %actlink ) 
      sockclose $sockname
      unset %delbug
      halt
    }
  }
}

Comments

Sign in to comment.
MissSunny   -  Mar 03, 2023

can you please update that also https:// addresses are displayed.

 Respond  
bugboy1028   -  Sep 08, 2011

and without the Link on it side

 Respond  
bugboy1028   -  Sep 08, 2011

How about if it see YouTube link, can itedit YouTube to different color like White over Red"You" , Black "Tube"

 Respond  
Shadow Wolf   -  May 28, 2011

thnx mash your worked

 Respond  
MashhitDK   -  May 28, 2011

This should work

;**********************************************************
;*** Downloaded from http://www.hawkee.com/snippet/6941/
;**********************************************************
on *:TEXT:*:#: {
  if ((www. isin $1-) || (http:// isin $1-)) && (*whatsmyip* !iswm $1-) { sockclose linkchecker | set %linkchan $chan
    if (http:// isin $1-) { set %link $remove($matchtok($1-,http://,1,32),http://) | set %actlink $matchtok($1-,http://,1,32) }
    else { set %link $matchtok($1-,www.,1,32) | set %actlink $matchtok($1-,www.,1,32) }
    if (/ !isin %link) { set %link %link $+ / }
    sockopen linkchecker $remove($left(%link,$pos(%link,/,1)),/) 80
    halt
  }
}
on *:sockopen:linkchecker: {
  if $sockerr > 0 { sockclose $sockname | halt }
  sockwrite -n $sockname GET / $+ $right(%link,$calc($len(%link)- $pos(%link,/,1))) HTTP/1.1
  sockwrite -n $sockname Host: $remove($left(%link,$pos(%link,/,1)),/)
  sockwrite -n $sockname $crlf
}
on *:sockread:linkchecker: {
  if $sockerr > 0 { sockclose $sockname | halt }
  sockread %linkh
  if (%delbug != $null) && ($len(%linkch) <= 150) && (</title> !isin %linkh) { set %linkch %linkch %linkh }
  if (%delbug != $null) && (</title> isin %linkh) {
    ;    echo -t %linkchan 13 $+ $replace(%linkch,&quot;,",&apos;,',&amp;,&,&lt;,<,&gt;,>,&copy;,©,&reg;,®,&trade;,™,&euro;,€,&pound;,£,&yen;,¥) (4 %actlink )
    msg %linkchan $+(07,$replace($remove(%linkch,&#x202a;,&#x202c;&rlm;),&quot;,",&apos;,',&amp;,&,&lt;,<,&gt;,>,&copy;,©,&reg;,®,&trade;,™,&euro;,€,&pound;,£,&yen;,¥),) (4 %actlink )
    unset %delbug %link %linkchan %actlink
    sockclose $sockname
    halt
  }
  if (<title> isin %linkh) {
    set %linkch $remove($left(%linkh,$pos(%linkh,</title>,1)),</title>)
    set %linkch $right(%linkch,$calc($len(%linkch)- $pos(%linkch,<title>,1) -6))
    set %linkch $left(%linkch,$calc($len(%linkch)-1))
    set %delbug 1
    if (%linkch != $null) {
      ;      echo -t %linkchan 13 $+ $replace(%linkch,&quot;,",&apos;,',&amp;,&,&lt;,<,&gt;,>,&copy;,©,&reg;,®,&trade;,™,&euro;,€,&pound;,£,&yen;,¥) (4 %actlink ) 
      msg # %linkchan Title: $+(07,$replace($remove(%linkch,&#x202a;),&quot;,",&apos;,',&amp;,&,&lt;,<,&gt;,>,&copy;,©,&reg;,®,&trade;,™,&euro;,€,&pound;,£,&yen;,¥),) -> $+(04,%actlink,)
      sockclose $sockname
      unset %delbug %link %linkchan %actlink 
      halt
    }
  }
}

NOTE: That it's edited to msg channel instead of echo

 Respond  
Arslan32   -  Jan 04, 2011

The script doesnot works...i pasted it in remote but it doesnot?? help plx

 Respond  
DarkGamer120   -  Aug 29, 2010

Awesome

 Respond  
PsyTrance   -  Aug 03, 2010

@Askeen

In first line

on *:text:*:#: {

Write chans where you want to use script

on *:text:*:#CHANNEL1,#CHANNEL2,#CHANNEL3: {
 Respond  
Askeen   -  Mar 15, 2010

one request (if it is possible) to make it to ignore one/two channels.

 Respond  
cessil   -  Jan 08, 2010

@pangaea it reads the html data from the site.
@jethro_ I've never used regex and cbf learning it I know that sounds bad for me.

 Respond  
Jethro   -  Jan 05, 2010

For the url links posted in the channel, you could use regular expressions to match rather than using http:// isin $1- or www. isin $1- then use $regml() to set the variables. Using regex is more precise for the matching of certain strings than using the isin operator. Isin is prone to typo related issues and can easily be tampered with.

 Respond  
Pangaea   -  Jan 05, 2010

Great stuff cessill, works like a charm now, clean, minimal and no colors.

I had a thought though.. The main reason im using this is for a couple of reasons, alot of ppl are nervous about clicking strange links, so this will help them see some sort of page title.. also from an ops point of view it will help them identify potential spamming or infected websites... however while thinking a little more about this, i was curious to know how exactly dose the script access the sites?.. dose it so to speak "visit" the website.. or simply read the page title of a website. My concern here being that the bot will be visiting every link posted in chan, and its a possibility that some of these links will be spam or infected website.

just wondering about the safety aspects of it thats all, and im probably not exaplaining myself properly

best regards
pan

and again great script and tnx for the help

 Respond  
cessil   -  Jan 05, 2010

Pangaea take out the

13 $+ 

and

(4 %actlink ) 

in the msg lines

 Respond  
Shinybot   -  Jan 03, 2010

Nice Script i gona use it ;)

 Respond  
Pangaea   -  Jan 03, 2010

Hi

great script
Is there anyway to just have it reply the website title, and only in plain text (without colors)?

somehint just like this:

<Pan`bbl> http://science.howstuffworks.com/quantum-cryptology3.htm

HowStuffWorks "Photon Properties"
 Respond  
[seat]   -  Dec 06, 2009

thx very much :)))))))))))))))))))

 Respond  
cessil   -  Dec 05, 2009
on *:text:*:#: {
  if (http:// isin $1-) {
    sockclose linkchecker
    set %link $remove($matchtok($1-,http://,1,32),http://)
    set %linkchan $chan
    set %actlink $matchtok($1-,http://,1,32)
    if (/ !isin %link) { set %link %link $+ / }
    sockopen linkchecker $remove($left(%link,$pos(%link,/,1)),/) 80
    halt
  }
  if (www. isin $1-) {
    sockclose linkchecker
    set %link $matchtok($1-,www.,1,32)
    set %linkchan $chan
    set %actlink $matchtok($1-,www.,1,32)
    if (/ !isin %link) { set %link %link $+ / }
    sockopen linkchecker $remove($left(%link,$pos(%link,/,1)),/) 80
    halt
  }
}
on *:sockopen:linkchecker: {
  if $sockerr > 0 { sockclose $sockname | halt }
  sockwrite -n $sockname GET / $+ $right(%link,$calc($len(%link)- $pos(%link,/,1))) HTTP/1.1
  sockwrite -n $sockname Host: $remove($left(%link,$pos(%link,/,1)),/)
  sockwrite -n $sockname $crlf
}
on *:sockread:linkchecker: {
  if $sockerr > 0 { sockclose $sockname | halt }
  sockread %linkh
  if (%delbug != $null) && ($len(%linkch) <= 150) && (</title> !isin %linkh) { set %linkch %linkch %linkh }
  if (%delbug != $null) && (</title> isin %linkh) {
    msg %linkchan 13 $+ $replace(%linkch,&quot;,",&apos;,',&amp;,&,&lt;,<,&gt;,>,&copy;,©,&reg;,®,&trade;,™,&euro;,€,&pound;,£,&yen;,¥) (4 %actlink )
    unset %delbug
    sockclose $sockname
    halt
  }
  if (<title> isin %linkh) {
    set %linkch $remove($left(%linkh,$pos(%linkh,</title>,1)),</title>)
    set %linkch $right(%linkch,$calc($len(%linkch)- $pos(%linkch,<title>,1) -6))
    set %linkch $left(%linkch,$calc($len(%linkch)-1))
    set %delbug 1
    if (%linkch != $null) {
      msg %linkchan 13 $+ $replace(%linkch,&quot;,",&apos;,',&amp;,&,&lt;,<,&gt;,>,&copy;,©,&reg;,®,&trade;,™,&euro;,€,&pound;,£,&yen;,¥) (4 %actlink ) 
      sockclose $sockname
      unset %delbug
      halt
    }
  }
}
 Respond  
[seat]   -  Dec 05, 2009

i make the changes but dosent work if you can make the changes and work plz sent me the code thxxxxxxxxxxxx :))))

 Respond  
cessil   -  Dec 04, 2009

change the "echo -t" to "msg"

 Respond  
[seat]   -  Dec 03, 2009

how can i fix this remote to see other users no only me ???????????

 Respond  
cessil   -  Nov 23, 2009

@Gummo I don't understand why since it resets all the global variables when going through the script again.

@Cherion just switch the echo to msg, most of the channels I'm in wouldn't let me message the channel the title of every link pasted.

 Respond  
Cheiron   -  Nov 23, 2009

also rather than echo .. get it to msg the channel the link (or have option)

 Respond  
Gummo   -  Nov 23, 2009

You should always unset global variables such as %link there.. That lets you not repeat the code at the top, too, with another method.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.