SwiftIRC
IRC Discussion and Support
 
  Index  •  FAQ  •  Search  

It is currently Tue Sep 02, 2014 1:48 am




Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next
 URL catcher 
Author Message
 Post subject: URL catcher
PostPosted: Thu Jul 31, 2008 3:20 am 
User avatar
User
User

Joined: Wed Feb 20, 2008 4:43 am
Posts: 1350
Location: #linux
I'd like to have a url catcher that messages the channel the page of the url. Ex:
Quote:
10:12:17 pm <@metal> http://knightsofreason.org/forum/viewto ... 546#p36546
10:12:20 pm <+LavaSoup> Title: Knights of Reason Forum View topic - ab00se? sure. (at knightsofreason.org)


There probably isn't one scripted in msl already. I've only seen some scripted in php. I searched for a while trying to find some on mirc.net, hawkee, but i was unlucky. If any of you know a link to one or can just share the script with me, it would be appreciated.


Offline
 Profile  
 
 Post subject:
PostPosted: Thu Jul 31, 2008 5:54 am 
User
User

Joined: Mon Oct 01, 2007 7:30 pm
Posts: 78
I believe that all you need is to socket read and
if ($regex(%sockread,<title>\s?(.*)\s?</title>)) msg $chan $regml(1)

_________________
Image


Last edited by Galxx on Thu Jul 31, 2008 5:56 am, edited 1 time in total.

Offline
 Profile  
 
 Post subject:
PostPosted: Thu Jul 31, 2008 5:56 am 
User
User

Joined: Sat Oct 21, 2006 7:33 am
Posts: 1645
Location: Lake Forest, California
Galxx wrote:
I believe that all you need is to socket read and return $nohtml(<title> (.*) </title)


not all sites have <title> though haha. I would use google.


Offline
 Profile  
 
 Post subject:
PostPosted: Thu Jul 31, 2008 5:58 am 
User
User

Joined: Mon Oct 01, 2007 7:30 pm
Posts: 78
James^ wrote:
Galxx wrote:
I believe that all you need is to socket read and return $nohtml(<title> (.*) </title)


not all sites have <title> though haha. I would use google.


Really?

D: then that webpage has no title

or link me to a titled webpage without a <title>

_________________
Image


Offline
 Profile  
 
 Post subject:
PostPosted: Thu Jul 31, 2008 9:54 am 
User
User

Joined: Sat Jul 26, 2008 11:31 am
Posts: 233
An image.

_________________
[url=http://tinyurl.com/tobydt]Image
Image
Image
[/url]


Offline
 Profile  
 
 Post subject:
PostPosted: Thu Jul 31, 2008 12:26 pm 
User avatar
User
User

Joined: Wed Feb 20, 2008 4:43 am
Posts: 1350
Location: #linux
:/


Offline
 Profile  
 
 Post subject:
PostPosted: Sat Aug 02, 2008 12:07 am 
User avatar
User
User

Joined: Wed Feb 20, 2008 4:43 am
Posts: 1350
Location: #linux
anyone?


Offline
 Profile  
 
 Post subject:
PostPosted: Sat Aug 02, 2008 12:09 am 
User
User

Joined: Sun Oct 07, 2007 9:42 pm
Posts: 399
Location: United States
Rob wrote:
Bump. I really need this.

I'll write it. :) However, expect it tomorrow.

_________________
Image
Image


Offline
 Profile  
 
 Post subject:
PostPosted: Sat Aug 02, 2008 12:23 am 
User
User

Joined: Sat Oct 21, 2006 7:33 am
Posts: 1645
Location: Lake Forest, California
Galxx wrote:
James^ wrote:
Galxx wrote:
I believe that all you need is to socket read and return $nohtml(<title> (.*) </title)


not all sites have <title> though haha. I would use google.


Really?

D: then that webpage has no title

or link me to a titled webpage without a <title>


Images, exe files... etc.


Offline
 Profile  
 
 Post subject:
PostPosted: Sat Aug 02, 2008 12:32 am 
User avatar
User
User

Joined: Wed Feb 20, 2008 4:43 am
Posts: 1350
Location: #linux
Andrew-| wrote:
Rob wrote:
Bump. I really need this.

I'll write it. :) However, expect it tomorrow.

Thanks andrew-|. Expect feed back*

* depending on if i like it or not :P


Offline
 Profile  
 
 Post subject:
PostPosted: Sat Aug 02, 2008 4:32 pm 
User
User

Joined: Sun Oct 07, 2007 9:42 pm
Posts: 399
Location: United States
Code:
on *:TEXT:*:#:{
  if ($regex($1-,/^((https?://)?([-a-z\d.]+\.[a-z]{2,}|localhost|((25[0-5]|2[0-4]\d|[01]?\d?\d)\b\.){3} (\b25[0-5]|2[0-4]\d|[01]?\d?\d\b))(:\d+)?(/[^\\|/?><:*^]+)+)(\?[^&]*(&[^&]*)*)?$/ix) == 1) {
    var %a 1
    while ($sock(name. $+ %a)) {
      inc %a
    }
    sockopen name. $+ %a $regml(3) 80
    sockmark name. $+ %a $+(msg $chan,$chr(160),$regml(3),$chr(160),$regml(4))
  }
}
on *:SOCKOPEN:name.*:{
  tokenize 160 $sock($sockname).mark
  if ($sockerr) {
    $1 Winsock Error Message: $sock($sockname).wsmsg
    sockclose $sockname
  }
  else {
    sockwrite -nt $sockname GET $3 HTTP/1.1
    sockwrite -nt $sockname Host: $2
    sockwrite -nt $sockname $crlf
  }
}
on *:SOCKREAD:name.*:{
  tokenize 160 $sock($sockname).mark
  if ($sockerr) {
    $1 Winsock Error Message: $sock($sockname).wsmsg
    sockclose $sockname
  }
  else {
    sockread &binvar
    if ($regex($bvar(&binvar,1,$calc($bvar(&binvar,0) - 1)).text,/<title>(.+)</title>/i) == 1) {
      $1 $regml(1)
      sockclose $sockname
    }
  }
}

_________________
Image
Image


Offline
 Profile  
 
 Post subject:
PostPosted: Sat Aug 02, 2008 4:45 pm 
User
User

Joined: Sat Oct 21, 2006 7:33 am
Posts: 1645
Location: Lake Forest, California
Code:
/Content\-Type: .*?\/([^\s;]+)/i


Andrew


Offline
 Profile  
 
 Post subject:
PostPosted: Sat Aug 02, 2008 4:49 pm 
User avatar
User
User

Joined: Wed Feb 20, 2008 4:43 am
Posts: 1350
Location: #linux
Quote:
11:48 am <@metal> http://forum.swiftirc.net/viewtopic.php ... highlight=
11:48 am <@SpamServices> SwiftIRC ::


:(


Offline
 Profile  
 
 Post subject:
PostPosted: Sat Aug 02, 2008 4:55 pm 
User
User

Joined: Sat Nov 03, 2007 6:26 pm
Posts: 1115
Location: Somewhere Small
http://forum.swiftirc.net/viewtopic.php?t=17545


Offline
 Profile  
 
 Post subject:
PostPosted: Sat Aug 02, 2008 5:02 pm 
User
User

Joined: Tue Jan 15, 2008 11:31 am
Posts: 153
Location: England
Andrew-| wrote:
Code:
if ($regex($bvar(&binvar,1,$calc($bvar(&binvar,0) - 1)).text,/<title>(.+)</title>/i) == 1) {


FYI, $bvar supports ranges, so you could do this instead:

Code:
$bvar(&binvar,1-).text


Offline
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next


 Who is online 

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 
Index  |  FAQ  |  Search

phpBB skin developed by: John Olson
Protected by Anti-Spam ACP
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group