mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
Joined: Nov 2003
Posts: 102
T
Vogon poet
OP Offline
Vogon poet
T
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.

Rock and Metal Music videos ON DEMAND!
<<<<<< http://www.tormented.tv >>>>>>
Joined: Mar 2003
Posts: 612
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 612
usage /tsearch keyword keyword2 ...

Code:
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,&nbsp;,$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

Code:
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,&nbsp;,$chr(9))
  return %x
}

Last edited by billythekid; 21/10/08 06:42 AM.

billythekid
Joined: Nov 2003
Posts: 102
T
Vogon poet
OP Offline
Vogon poet
T
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! smile



Rock and Metal Music videos ON DEMAND!
<<<<<< http://www.tormented.tv >>>>>>
Joined: Nov 2003
Posts: 102
T
Vogon poet
OP Offline
Vogon poet
T
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?


Rock and Metal Music videos ON DEMAND!
<<<<<< http://www.tormented.tv >>>>>>
Joined: Mar 2003
Posts: 612
B
Fjord artisan
Offline
Fjord artisan
B
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
T
Vogon poet
OP Offline
Vogon poet
T
Joined: Nov 2003
Posts: 102
Yup ....That again works perfect smile thank you


Rock and Metal Music videos ON DEMAND!
<<<<<< http://www.tormented.tv >>>>>>
Joined: Mar 2003
Posts: 612
B
Fjord artisan
Offline
Fjord artisan
B
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
T
Vogon poet
OP Offline
Vogon poet
T
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 smile


Rock and Metal Music videos ON DEMAND!
<<<<<< http://www.tormented.tv >>>>>>
Joined: Nov 2003
Posts: 102
T
Vogon poet
OP Offline
Vogon poet
T
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 ?


Rock and Metal Music videos ON DEMAND!
<<<<<< http://www.tormented.tv >>>>>>
Joined: Nov 2003
Posts: 102
T
Vogon poet
OP Offline
Vogon poet
T
Joined: Nov 2003
Posts: 102
frown 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 frown

This is the code as is now... (Not working)

Code:
 



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,&nbsp;,$chr(9))
  return %x
}



Please help if you can.


Rock and Metal Music videos ON DEMAND!
<<<<<< http://www.tormented.tv >>>>>>
Joined: Mar 2003
Posts: 612
B
Fjord artisan
Offline
Fjord artisan
B
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.

Code:
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
T
Vogon poet
OP Offline
Vogon poet
T
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


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,&nbsp;,$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 ?


Rock and Metal Music videos ON DEMAND!
<<<<<< http://www.tormented.tv >>>>>>
Joined: Mar 2003
Posts: 612
B
Fjord artisan
Offline
Fjord artisan
B
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
T
Vogon poet
OP Offline
Vogon poet
T
Joined: Nov 2003
Posts: 102
Any ideas anyone? frown I sooooo love this script and it suxs to not be able to use it.


Rock and Metal Music videos ON DEMAND!
<<<<<< http://www.tormented.tv >>>>>>
Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
Why not use:
Code:
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
T
Vogon poet
OP Offline
Vogon poet
T
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?


Rock and Metal Music videos ON DEMAND!
<<<<<< http://www.tormented.tv >>>>>>
Joined: Nov 2003
Posts: 102
T
Vogon poet
OP Offline
Vogon poet
T
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?


Rock and Metal Music videos ON DEMAND!
<<<<<< http://www.tormented.tv >>>>>>
Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
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
T
Vogon poet
OP Offline
Vogon poet
T
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


Rock and Metal Music videos ON DEMAND!
<<<<<< http://www.tormented.tv >>>>>>
Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
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...
Code:
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...
Code:
else { sockclose tsearch | unset %tsearch* }

...you /play it to the nick...
Code:
else { sockclose tsearch | play -n %tsearchnick temp.txt | unset %tsearch* }

Joined: Nov 2003
Posts: 102
T
Vogon poet
OP Offline
Vogon poet
T
Joined: Nov 2003
Posts: 102
frown Ok .. I dont get what you really mean but then again i cant see your 1st and 3rd example ? idk how to view them like that i guess.
I have ZERO programing abilities other than simple half retarded stuff. I didnt make the script, i am asking for help using it. Maybe if you could repost the examples for me ?


Rock and Metal Music videos ON DEMAND!
<<<<<< http://www.tormented.tv >>>>>>
Joined: Nov 2003
Posts: 102
T
Vogon poet
OP Offline
Vogon poet
T
Joined: Nov 2003
Posts: 102
Originally Posted By: ToRmEnTeD


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,&nbsp;,$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 ?


I am once again needing this script and still dont know how to make it write the results to a file as i was sudgested..Anyone able to help me with this for a bit ?


Rock and Metal Music videos ON DEMAND!
<<<<<< http://www.tormented.tv >>>>>>
Joined: Nov 2003
Posts: 102
T
Vogon poet
OP Offline
Vogon poet
T
Joined: Nov 2003
Posts: 102
So far this script seems to be working ok as is on my new home network smile
However now i am wanting it to send the results via PM instead of sending the Notice. Anyone able to fix that ?


Rock and Metal Music videos ON DEMAND!
<<<<<< http://www.tormented.tv >>>>>>
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Simply replace the 3 instances of the command (word) "notice" with "msg"

Joined: Nov 2003
Posts: 102
T
Vogon poet
OP Offline
Vogon poet
T
Joined: Nov 2003
Posts: 102
Ok now i am left with 2 problems.

The first problem is. How do i select how many results are shown before they get the "to see more results click here" msg ?


And my second problem is probably going to be the larger one.

On my site i have a featured video section. For some reason when this script searches my site it includes these featured videos in the results even tho they have nothing to do with whatever was searched for....Is there anyway to solve this issue ?
Anyone think of any other ways to improve the script?


Rock and Metal Music videos ON DEMAND!
<<<<<< http://www.tormented.tv >>>>>>
Page 1 of 2 1 2

Link Copied to Clipboard