|
Joined: Nov 2003
Posts: 102
Vogon poet
|
OP
Vogon poet
Joined: Nov 2003
Posts: 102 |
Hey i have had great sucess finding help here so far so i figured i would drop the big one and see what happens. I have used irc for a long time and have seen many scripts that search google or other sites and msg the user or channel with results. Well i have a website www.tormented.tv Its a database of music videos. I would like a script that would simply run the search on the site and echo results into a msg to the user. I know i wont get a fast reply on this and im not expecting it. But if a few of you could add your thoughts maybe by the end of it a working script will be posted? I greatly apprecate anyone who gives this anytime
Last edited by ToRmEnTeD; 20/10/08 04:22 PM.
|
|
|
|
Joined: Mar 2003
Posts: 612
Fjord artisan
|
Fjord artisan
Joined: Mar 2003
Posts: 612 |
usage /tsearch keyword keyword2 ... alias tsearch {
set %tsearchstring $replace($$1-,$chr(32),+)
sockopen tsearch tormented.tv 80
}
on 1:sockopen:tsearch:{
if ($sockerr) {
echo 4 -- Socket Error! --
return
}
var %s = sockwrite -n $sockname
%s GET $+(http://www.tormented.tv/search.php?query=,%tsearchstring,&x=0&y=0&search=1) HTTP/1.1
%s Referer: tSearch-mIRC-script(User: $+ $me $+ )
%s Host: tormented.tv
%s Content-Type: application/x-www-form-urlencoded
%s Connection: Keep-Alive
%s Cache-Control: no-cache
%s
}
on 1:sockread:tsearch:{
if ($sockerr > 0) return
:nextread
sockread %temp
if ($sockbr == 0) return
if (%temp == $null) %temp = -
if *<b>* - Not Found</b></div>* iswm %temp {
echo 04 -a $nohtml(%temp)
sockclose tsearch
unset %tsearch*
}
elseif <a href='video.php? isin %temp {
echo 03 -a $remove($gettok(%temp,6,39),images/,.jpg) (12http://www.tormented.tv/ $+ $gettok(%temp,2,39) $+ 03)
}
elseif *<font face='Georgia'><a href='search.php?query=*&p=2* iswm %temp {
echo 03 -a More results available try 12http://www.tormented.tv/search.php?query= $+ %tsearchstring $+ &p=203 for more
}
elseif %temp { noop }
else {
sockclose tsearch
unset %tsearch*
}
}
alias -l nohtml {
var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, ,$chr(9))
return %x
} or if you wanted others to use it they can type !tsearch keywords in channel for you to send them a notice of the results on *:text:!tsearch*:#:tsearch $nick $2-
alias -l tsearch {
set %tsearchnick $1
set %tsearchstring $replace($$2-,$chr(32),+)
sockopen tsearch tormented.tv 80
}
on 1:sockopen:tsearch:{
if ($sockerr) {
echo 4 -- Socket Error! --
return
}
var %s = sockwrite -n $sockname
%s GET $+(http://www.tormented.tv/search.php?query=,%tsearchstring,&x=0&y=0&search=1) HTTP/1.1
%s Referer: tSearch-mIRC-script(User: $+ $me $+ )
%s Host: tormented.tv
%s Content-Type: application/x-www-form-urlencoded
%s Connection: Keep-Alive
%s Cache-Control: no-cache
%s
}
on 1:sockread:tsearch:{
if ($sockerr > 0) return
:nextread
sockread %temp
if ($sockbr == 0) return
if (%temp == $null) %temp = -
if *<b>* - Not Found</b></div>* iswm %temp {
notice %tsearchnick 04 $nohtml(%temp)
sockclose tsearch
unset %tsearch*
}
elseif <a href='video.php? isin %temp {
notice %tsearchnick 03 $remove($gettok(%temp,6,39),images/,.jpg) (12http://www.tormented.tv/ $+ $gettok(%temp,2,39) $+ 03)
}
elseif *<font face='Georgia'><a href='search.php?query=*&p=2* iswm %temp {
notice %tsearchnick 03 More results available try 12http://www.tormented.tv/search.php?query= $+ %tsearchstring $+ &p=203 for more
}
elseif %temp { noop }
else {
sockclose tsearch
unset %tsearch*
}
}
alias -l nohtml {
var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, ,$chr(9))
return %x
}
Last edited by billythekid; 21/10/08 06:42 AM.
billythekid
|
|
|
|
Joined: Nov 2003
Posts: 102
Vogon poet
|
OP
Vogon poet
Joined: Nov 2003
Posts: 102 |
wow. Thats just amazing. It works perfect and looks perfect! Thank you soo much! I never thought i would have a working script in my hands so fast. Just simply amazing!
|
|
|
|
Joined: Nov 2003
Posts: 102
Vogon poet
|
OP
Vogon poet
Joined: Nov 2003
Posts: 102 |
ok this is perfect but the more i play around with it i cant help but think...I also have a guestbook on my site that i have problems getting people to sign....could a piece be added to this where if they did something like !guestbook it would pop up the link to my guestbook like it does a video in the results?
|
|
|
|
Joined: Mar 2003
Posts: 612
Fjord artisan
|
Fjord artisan
Joined: Mar 2003
Posts: 612 |
yeah you could do a simple on 1:text:!gb:#:msg $chan http://url.goes.here.com
billythekid
|
|
|
|
Joined: Nov 2003
Posts: 102
Vogon poet
|
OP
Vogon poet
Joined: Nov 2003
Posts: 102 |
Yup ....That again works perfect thank you
|
|
|
|
Joined: Mar 2003
Posts: 612
Fjord artisan
|
Fjord artisan
Joined: Mar 2003
Posts: 612 |
You're welcome. I have a standard socket script 'template' sitting here so was just a matter of hitting your site and seeing wht worked. Glad you can use it.
btk
billythekid
|
|
|
|
Joined: Nov 2003
Posts: 102
Vogon poet
|
OP
Vogon poet
Joined: Nov 2003
Posts: 102 |
Ok im back but this time with a bit more of a request for an addition to this script or a new one to join it. I am wanting a script that will connect to my site and check for the latest uploaded videos and show a random link of one of the last 3 or 4 videos and display it into the room as a ACTION. Basicly its a way for me to advertise my newest videos and it will put a direct link into the channel like every 15 minutes to one of my pages. Dont know how hard this will be but i guess we gonna find out
|
|
|
|
Joined: Nov 2003
Posts: 102
Vogon poet
|
OP
Vogon poet
Joined: Nov 2003
Posts: 102 |
Major issues...I just upgraded my site from using flat file database to mysql databace and whatever i did made this script all messed up...anyone able to take a look at it ?
|
|
|
|
Joined: Nov 2003
Posts: 102
Vogon poet
|
OP
Vogon poet
Joined: Nov 2003
Posts: 102 |
Im sooo bummed that this script no longer works.I was getting so many positive comments on it. Upgraded my site from flatfile database to mysql and now it dont work right. when someone !tsearches anything it just shows like the first few videos in the datebase...like it dont really search at all.....anyways im asking again for anyone that might be able to retweak it for my changes. Wana keep this going cause i really need this script This is the code as is now... (Not working)
on *:text:!tsearch*:#:tsearch $nick $2-
alias -l tsearch {
set %tsearchnick $1
set %tsearchstring $replace($$2-,$chr(32),+)
sockopen tsearch tormented.tv 80
}
on 1:sockopen:tsearch:{
if ($sockerr) {
echo 4 -- Socket Error! --
return
}
var %s = sockwrite -n $sockname
%s GET $+(http://www.tormented.tv/search.php?query=,%tsearchstring,&x=0&y=0&search=1) HTTP/1.1
%s Referer: tSearch-mIRC-script(User: $+ $me $+ )
%s Host: tormented.tv
%s Content-Type: application/x-www-form-urlencoded
%s Connection: Keep-Alive
%s Cache-Control: no-cache
%s
}
on 1:sockread:tsearch:{
if ($sockerr > 0) return
:nextread
sockread %temp
if ($sockbr == 0) return
if (%temp == $null) %temp = -
if *<b>* - Not Found</b></div>* iswm %temp {
notice %tsearchnick 04 $nohtml(%temp)
sockclose tsearch
unset %tsearch*
}
elseif <a href='video.php? isin %temp {
notice %tsearchnick 03 $remove($gettok(%temp,6,39),images/,.jpg) (12http://www.tormented.tv/ $+ $gettok(%temp,2,39) $+ 03)
}
elseif *<font face='Georgia'><a href='search.php?query=*&p=2* iswm %temp {
notice %tsearchnick 03 More results available try 12http://www.tormented.tv/search.php?query= $+ %tsearchstring $+ &p=203 for more
}
elseif %temp { noop }
else {
sockclose tsearch
unset %tsearch*
}
}
alias -l nohtml {
var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, ,$chr(9))
return %x
}
Please help if you can.
|
|
|
|
Joined: Mar 2003
Posts: 612
Fjord artisan
|
Fjord artisan
Joined: Mar 2003
Posts: 612 |
All that had happened was you'd changed your search URL - it used to be http://www.tormented.tv/search.php?query=,search+here,&x=0&y=0& search=1 but now it's http://www.tormented.tv/search.php?search=,search+here,&x=0&y=0& srch=1 I also added some code to remove the (new?) Featured videos from showing in the results. on *:text:!tsearch*:#:tsearch $nick $2-
alias -l tsearch {
set %tsearchnick $1
set %tsearchstring $replace($$2-,$chr(32),+)
sockopen tsearch tormented.tv 80
}
on 1:sockopen:tsearch:{
if ($sockerr) {
echo 4 -- Socket Error! --
return
}
var %s = sockwrite -n $sockname
%s GET $+(http://www.tormented.tv/search.php?search=,%tsearchstring,&x=0&y=0&srch=1) HTTP/1.1
%s Referer: tSearch-mIRC-script(User: $+ $me $+ )
%s Host: tormented.tv
%s Content-Type: application/x-www-form-urlencoded
%s Connection: Keep-Alive
%s Cache-Control: no-cache
%s
}
on 1:sockread:tsearch:{
if ($sockerr > 0) return
:nextread
sockread %temp
if ($sockbr == 0) return
if (%temp == $null) %temp = -
; echo 04 -s %temp
if *<b>* - Not Found</b></div>* iswm %temp {
notice %tsearchnick 04 $nohtml(%temp)
sockclose tsearch
unset %tsearch*
}
elseif <a href='video.php? isin %temp {
notice %tsearchnick 03 $remove($gettok(%temp,6,39),images/,.jpg) (12http://www.tormented.tv/ $+ $gettok(%temp,2,39) $+ 03)
}
elseif *<font face='Georgia'><a href='search.php?query=*&p=2* iswm %temp {
notice %tsearchnick 03 More results available try 12http://www.tormented.tv/search.php?query= $+ %tsearchstring $+ &p=203 for more
}
elseif "Featured Videos" isin %temp {
sockclose tsearch
unset %tsearch*
}
elseif %temp { noop }
else {
sockclose tsearch
unset %tsearch*
}
}
alias -l nohtml {
var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, ,$chr(9))
return %x
}
Last edited by billythekid; 29/11/08 05:52 PM.
billythekid
|
|
|
|
Joined: Nov 2003
Posts: 102
Vogon poet
|
OP
Vogon poet
Joined: Nov 2003
Posts: 102 |
Ok i think this was an older problem but i apprecate the adding of the featured videos sections part..Yes its new. Lots of new stuff. I had a problem and someone told me to strip the text or code or whatever and i ended up with this code
on *:text:!tsearch*:#:tsearch $nick $strip($2-)
alias -l tsearch {
set %tsearchnick $1
set %tsearchstring $replace($$2-,$chr(32),+)
sockopen tsearch tormented.tv 80
}
on 1:sockopen:tsearch:{
if ($sockerr) {
echo 4 -- Socket Error! --
return
}
var %s = sockwrite -n $sockname
%s GET $+(/search.php?search=,%tsearchstring,&srch=1) HTTP/1.1
%s Referer: tSearch-mIRC-script(User: $+ $me $+ )
%s Host: tormented.tv
%s Content-Type: application/x-www-form-urlencoded
%s Connection: Keep-Alive
%s Cache-Control: no-cache
%s
}
on 1:sockread:tsearch:{
if ($sockerr > 0) return
:nextread
sockread %temp
if ($sockbr == 0) return
if (%temp == $null) %temp = -
if *<b>* - Not Found</b></div>* iswm %temp {
notice %tsearchnick 04 $nohtml(%temp)
sockclose tsearch
unset %tsearch*
}
elseif <a href='video.php? isin %temp {
notice %tsearchnick 03 $remove($gettok(%temp,6,39),images/,.jpg) (12http://www.tormented.tv/ $+ $gettok(%temp,2,39) $+ 03)
}
elseif *<font face='Georgia'><a href='search.php?query=*&p=2* iswm %temp {
notice %tsearchnick 03 Still want more ? Visit > 12http://www.tormented.tv/search.php?query= $+ %tsearchstring $+ &p=203 }
elseif %temp { noop }
else {
sockclose tsearch
unset %tsearch*
}
}
alias -l nohtml {
var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x, ,$chr(9))
return %x
}
This works fine for what i need however like you said the featured videos show up sometimes. My problem with this whole script now is that the server has tightened its flood rules and now the script gets the bot kicked everytime it has more than a couple results..any way to limit the number of show results before the link to get more ?
|
|
|
|
Joined: Mar 2003
Posts: 612
Fjord artisan
|
Fjord artisan
Joined: Mar 2003
Posts: 612 |
you just need to store the results in a file or variable and pass them back using a timer to avoid flooding the server.
If I get a second I'll take a look at it.
billythekid
|
|
|
|
Joined: Nov 2003
Posts: 102
Vogon poet
|
OP
Vogon poet
Joined: Nov 2003
Posts: 102 |
Any ideas anyone? I sooooo love this script and it suxs to not be able to use it.
|
|
|
|
Joined: Feb 2003
Posts: 3,432
Hoopy frood
|
Hoopy frood
Joined: Feb 2003
Posts: 3,432 |
Why not use:
on *:text:!tsearch*:#:
if (!%noo.flood) {
set %no.flood 1
tsearch $nick $strip($2-)
.timer 1 20 unset %noo.flood
}
If the variable %noo.flood is set, then the script wont trigger. change the value 20 to what ever you want, now you can use the script every 20 seconds.
Last edited by sparta; 10/12/08 12:14 PM.
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
|
|
|
|
Joined: Nov 2003
Posts: 102
Vogon poet
|
OP
Vogon poet
Joined: Nov 2003
Posts: 102 |
Its not that its being used too much...Its that the server we are on now only allows like 7 lines at a time to be put into the channel without being disconnected for flood.
Thats a great and needed feature to be able to prevent users from abusing it once it works the way i need but ...How do i limit the amount of results?
|
|
|
|
Joined: Nov 2003
Posts: 102
Vogon poet
|
OP
Vogon poet
Joined: Nov 2003
Posts: 102 |
Its not that its being used too much...Its that the server we are on now only allows like 7 lines at a time to be put into the channel without being disconnected for flood.
Thats a great and needed feature to be able to prevent users from abusing it once it works the way i need but ...How do i limit the amount of results?
|
|
|
|
Joined: Feb 2003
Posts: 3,432
Hoopy frood
|
Hoopy frood
Joined: Feb 2003
Posts: 3,432 |
Write the info to a text file, then use play to send it? that way you can delay the output..
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
|
|
|
|
Joined: Nov 2003
Posts: 102
Vogon poet
|
OP
Vogon poet
Joined: Nov 2003
Posts: 102 |
I still looking for someone to help me with this. I honestly do not understand how to write it to a file ? Just wanting to keep this going if i can
|
|
|
|
Joined: Jun 2007
Posts: 933
Hoopy frood
|
Hoopy frood
Joined: Jun 2007
Posts: 933 |
Write all the info from the on SOCKREAD event, which you normally send to the person, to a .txt file. E.g... elseif (<a href='video.php? isin %temp) { write temp.txt 03 $remove($gettok(%temp,6,39),images/,.jpg) (12http://www.tormented.tv/ $+ $gettok(%temp,2,39) $+ 03) } and then where you script terminates, which I assume is... else { sockclose tsearch | unset %tsearch* } ...you /play it to the nick... else { sockclose tsearch | play -n %tsearchnick temp.txt | unset %tsearch* }
|
|
|
|
|