mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
!Search script for MY music video website #205342 20/10/08 04:21 PM
Joined: Nov 2003
Posts: 102
T
ToRmEnTeD Offline OP
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 >>>>>>
Re: !Search script for MY music video website [Re: ToRmEnTeD] #205373 21/10/08 06:12 AM
Joined: Mar 2003
Posts: 612
B
billythekid Offline
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
Re: !Search script for MY music video website [Re: billythekid] #205375 21/10/08 09:34 AM
Joined: Nov 2003
Posts: 102
T
ToRmEnTeD Offline OP
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 >>>>>>
Re: !Search script for MY music video website [Re: ToRmEnTeD] #205376 21/10/08 09:45 AM
Joined: Nov 2003
Posts: 102
T
ToRmEnTeD Offline OP
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 >>>>>>
Re: !Search script for MY music video website [Re: ToRmEnTeD] #205381 21/10/08 02:20 PM
Joined: Mar 2003
Posts: 612
B
billythekid Offline
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
Re: !Search script for MY music video website [Re: billythekid] #205383 21/10/08 02:44 PM
Joined: Nov 2003
Posts: 102
T
ToRmEnTeD Offline OP
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 >>>>>>
Re: !Search script for MY music video website [Re: ToRmEnTeD] #205396 21/10/08 05:58 PM
Joined: Mar 2003
Posts: 612
B
billythekid Offline
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
Re: !Search script for MY music video website [Re: billythekid] #205929 03/11/08 11:57 AM
Joined: Nov 2003
Posts: 102
T
ToRmEnTeD Offline OP
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 >>>>>>
Re: !Search script for MY music video website [Re: ToRmEnTeD] #206015 05/11/08 09:31 PM
Joined: Nov 2003
Posts: 102
T
ToRmEnTeD Offline OP
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 >>>>>>
Re: !Search script for MY music video website [Re: ToRmEnTeD] #206100 07/11/08 05:58 PM
Joined: Nov 2003
Posts: 102
T
ToRmEnTeD Offline OP
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 >>>>>>
Re: !Search script for MY music video website [Re: ToRmEnTeD] #206944 29/11/08 05:50 PM
Joined: Mar 2003
Posts: 612
B
billythekid Offline
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
Re: !Search script for MY music video website [Re: ToRmEnTeD] #206948 29/11/08 10:45 PM
Joined: Nov 2003
Posts: 102
T
ToRmEnTeD Offline OP
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 >>>>>>
Re: !Search script for MY music video website [Re: ToRmEnTeD] #207055 03/12/08 12:21 PM
Joined: Mar 2003
Posts: 612
B
billythekid Offline
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
Re: !Search script for MY music video website [Re: ToRmEnTeD] #207234 10/12/08 10:33 AM
Joined: Nov 2003
Posts: 102
T
ToRmEnTeD Offline OP
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 >>>>>>
Re: !Search script for MY music video website [Re: ToRmEnTeD] #207235 10/12/08 12:09 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline
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,.) }
Re: !Search script for MY music video website [Re: sparta] #207240 10/12/08 04:15 PM
Joined: Nov 2003
Posts: 102
T
ToRmEnTeD Offline OP
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 >>>>>>
Re: !Search script for MY music video website [Re: sparta] #207241 10/12/08 04:15 PM
Joined: Nov 2003
Posts: 102
T
ToRmEnTeD Offline OP
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 >>>>>>
Re: !Search script for MY music video website [Re: ToRmEnTeD] #207242 10/12/08 04:20 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline
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,.) }
Re: !Search script for MY music video website [Re: sparta] #207734 29/12/08 08:49 PM
Joined: Nov 2003
Posts: 102
T
ToRmEnTeD Offline OP
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 >>>>>>
Re: !Search script for MY music video website [Re: ToRmEnTeD] #207735 29/12/08 09:04 PM
Joined: Jun 2007
Posts: 933
5
5618 Offline
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* }

Page 1 of 2 1 2