URL fetcher

Platform:  mIRC
Published  Feb 19, 2008
Updated  Feb 23, 2008
Website title fetcher by Lindrian
Simply paste into remotes and when someone says a URL it will trigger.
(You can't trigger it yourself, since there's no INPUT event.)

Enjoy! :)

Update: made it only trigger once on each website, so if you post the same website 10 times it'll only show info about it once. on *:TEXT:*:#: rtc $chan $1-
on *:ACTION:*:#: rtc $chan $1-
on *:sockopen:website.*: {
if (!$sockerr) {
tokenize 32 $($+(%,$sockname),2)
sockwrite -n $sockname GET $2 HTTP/1.1
sockwrite -n $sockname Host: $1
sockwrite -n $sockname User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8)
sockwrite -n $sockname Accept: */*
sockwrite -n $sockname Connection: Close
sockwrite -n $sockname $crlf
}
else unset $+(%,$sockname)
}
on *:sockread:website.*: {
var %x, %z = $sockname, %e = $($+(%,%z),2)
sockread -f %x
if ($regex(%x,/<title[\w\s="]*>(.*?)<\/title>/i)) {
tokenize 32 %e
var %s = $btc(Url:) $+(http://,$+($1,$iif($2 != /,$2))) - $btc(Title:) $ptc($regml(1)) $iif($4,$4)
msg $3 $iif(c isincs $chan($3).mode,$strip(%s),%s)
unset $+(%,$(%z,2))
.sockclose %z
}
if (*HTTP*302* iswm %x) set -e %web.tmp 1
if (Location: isin %x) {
if ($mtc(%x)) {
tokenize 32 %e
sockclose %z
soc $regml(web,1) $iif($regml(web,2),$v1,/) $iif($3,$3,1) %z $iif(%web.tmp,Redirected)
unset %web.tmp
}
}
}
on *:sockclose:website.*: unset $+(%,$sockname)
alias -l soc {
var %x = $iif($4,$4,$+(website.,$r(a,z),$r(a,z),$r(a,z),$r(0,9),$r(0,9),$r(0,9)))
set -e $+(%,%x) $1-2 $iif($3 ischan && $me ison $3,$3) $iif($5,$ntc($5))
sockopen %x $1 80
}
alias -l mtc return $regex(web,$1,/(?:https?:\/\/)?((?:www\.)?[\w-.]+\.(?>[a-z]{2,4})(?![a-z]))([\w-_#?=%.\/&?]+)?/ig)
alias -l ptc return $replacecs($1,&mdash;,-,&quot;,",&amp;,&,&lt;,<,&gt;,>,,$chr(233),,$chr(231),&ccedil;,$chr(231),&ntilde;,$chr(241),,$chr(209),,$chr(220),,$chr(244))
alias -l btc return $+($chr(2),$1,$chr(2))
alias -l ntc return $+($chr(40),$1,$chr(41))
alias rtc {
if ($mtc($2-)) && (!%website.flood [ $+ [ $regml(web,1) ] ]) {
var %x = 1, %v
while ($regml(web,%x)) {
var %z = $iif(/ isin $regml(web,$calc(%x +1)),$v2,/), %i = $regml(web,%x)
if (/ !isin %i) && (!$istok(%v,%i,32)) {
soc %i %z $1
%v = %v %i
}
inc %x 1
}
set -eu5 %website.flood $+ $regml(web,1) 1
}
}

Comments

Sign in to comment.
cptpan   -  Feb 05, 2014
Is there a way to make this return something like 'URL does not exist' when someone types a url for a website that doesn't exist?

At the moment it just does/returns nothing.
 Respond  
cptpan   -  Oct 11, 2012
Oh, by the way - people can execute mIRC commands if the bot is sent to a website with commands in it, when it 'returns' the url, it executes the commands, so is easily abused.
rebel9  -  Sep 21, 2013
Code
 


^use that on the mtc alias and this should fix your issue m8. (for it not working after a + that is)
rebel9  -  Oct 17, 2013
Also, don't forget to fix this too or you'll get a lot of "'" errors etc.
Code
 
cptpan  -  Feb 05, 2014
Thanks those fixed all the problems.
rebel9  -  Feb 05, 2014
Though I wouldn't use this script, it downloads the title. I'd suggest using a socket to a url title site.
Sign in to comment

cptpan   -  Oct 11, 2012
There is an issue with this script. If the URL contains a + the bot doesn't return any of the url beyond that (and so breaks it).

How to fix, please?
 Respond  
JonBovi   -  Sep 28, 2011
I like this snippet a lot. But how can i remove it for specific channels that i'm not op'd at as they'll get butthurt.
 Respond  
chachin   -  Sep 23, 2011
Oh and it would be awsome if it shows the prices of items if you posting stuff from newegg/tigerdirec or whatever else. would be awsome if you can make it happend
 Respond  
NwoChat   -  Dec 08, 2010
Having the same issue with the youtube videos and http://www.udn1.com 's title. Any idea on a possible fix?
 Respond  
cptpan   -  Jun 17, 2010
Work great, thanks
 Respond  
Exterus   -  Jun 05, 2010
I like the script a lot! But it doesn't recognize youtube urls, for some reason. Is it possible that might change at some point? :)
 Respond  
miniCruzer   -  Sep 03, 2009
I like it, you should've added colors though
 Respond  
jonesy44   -  Aug 02, 2009
remove the script.
 Respond  
k0ji   -  Aug 02, 2009
man.adat , Ada.tp etc... **.** Title: ERROR: The requested URL could not be retrieved

how to edit ???
 Respond  
jonesy44   -  Aug 02, 2009
Unlucky his name matched a weburl lmao..
 Respond  
k0ji   -  Aug 01, 2009
[10:32] <+Ugawa> wb k.velo
[10:32] <@Taskia> Url: http://k.velo - Title: ERROR: The requested URL could not be retrieved
 Respond  
VinX   -  Jul 31, 2009
works 100% perfect for me :)
 Respond  
LightMatter   -  Jun 30, 2009
* /sockopen: 'Redirected' socket in use (line 41,
 Respond  
Testor   -  May 11, 2009
Seems good, can stop me being linked to "Certain" Sites I guess :P
Seems like quite complicated code you've got there, Nice Job :)
 Respond  
montague   -  May 11, 2009
+1 like ;D
 Respond  
Anthrophobic   -  May 10, 2009
Just noticed this was resolved..lawl
 Respond  
flc86   -  Apr 10, 2009
There is a little problem with it.

When in URL there is " , " it shows error (404 Not Found).
 Respond  
TwistedHumor   -  Oct 25, 2008
Then incase kids are in the room...

Code
 


Great Work...
10/10
 Respond  
TwistedHumor   -  Oct 25, 2008
Actually I've came up with a fix for it with some help of friends on Gnet.
Code
 
 Respond  
TwistedHumor   -  Oct 24, 2008
Also will return your IP is someone posts up http://whatsmyip.org
Might wanna add a blocker to that or code a halt...?
 Respond  
Lindrian   -  Feb 23, 2008
Thanks :)
 Respond  
Scakk   -  Feb 23, 2008
Thanks. I knew I could change the on text part but was unsure if it would mess upi the rest of the script or not so I figured it best to ask the creator.

Keep up the good work.
 Respond  
Lindrian   -  Feb 23, 2008
You can simply change the on text event to this:
Code
 


Also updated the code slightly.
 Respond  
Scakk   -  Feb 23, 2008
I do like this. Could you possible make it where you need to trigger it instead of it happening whenever someone post a website. If people do not want the title of the website it could be annoying. However if people wish to know the title they could do so by triggering it.

*9/10 from me :)
 Respond  
Lindrian   -  Feb 23, 2008
No score yet :X?
 Respond  
Ken   -  Feb 21, 2008
I see your point, however, it would be nice to make this for personal use. Also, if this was created for a bot, I think that the author should state that in the introduction. :)
 Respond  
mountaindew   -  Feb 21, 2008
well, if it\'s an on text, and the bot echoed it, you wouldn\'t be able to see it
 Respond  
Ken   -  Feb 21, 2008
This is excellent! I found this to be very useful, and the coding is impressive.

I think you should make it optional between echo and a message. :(
 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.