youtube and google search

By Stewie1k94 on Mar 28, 2011

this is my first snippit that u can search youtube and google

commands are

!youtube your youtube search

!google your google search

i have tested it and it works

***********************************************
                created by toclafane1                       

***********************************************

on *:TEXT:*:#:{
  if ($1 == !youtube) msg $chan 3Your Youtube Search:  $$2- $+ : http://www.youtube.com/results?search_query= $+ $$2- $+ &search_type=&aq=f
  if ($1 == !google) msg $chan  3your google search: $+(http://www.google.com/search?q=,$replace($$2-,$chr(32),+))
}

Comments

Sign in to comment.
Stewie1k94   -  May 01, 2011

i wish i knew more about scripting

 Respond  
Jethro   -  May 01, 2011

Dani_l11, (?i) in regex means case-insensitive. It's the same as using /i modifier. You should read up more on that. There are more options as such to be applied to regex: (?s) or (?m) means single line or multi-line...(?u) unicode.

 Respond  
Stewie1k94   -  May 01, 2011

ok i will try learn $regml stuff

 Respond  
Dani_l11   -  May 01, 2011

Why check for the regml match, just use $regml(1) :)? $+(http://,$iif($regml(1) != google,youtube,google),.com) => $+(http://,$regml(1),.com). But wouldn't $regml(1) match the (?i)? Also you need a /i switch, to match an incasesensitive match.

 Respond  
Ahmed Zaggoudi   -  May 01, 2011

nice +1

 Respond  
Jethro   -  Apr 06, 2011

Dani, neither your example will respond. You changed the variable name to %floodnick, which doesn't match the first conditional check for it. This is efficiently done with a regex though:

on $*:TEXT:/^!(?i)(youtube|google)( |$)/S:#:{
  if (%floodnick [ $+ [ $nick ] ]) halt | set -u3 %Floodnick [ $+ [ $nick ] ] . | var %s $replace($$2-,$chr(32),+)
  if !$strip($2) { notice $nick $+(http://,$iif($regml(1) != google,youtube,google),.com) }
  elseif ($regml(1) == google) msg #  3your google search: $+(http://www.google.com/search?q=,%s)
  else msg # 3Your Youtube Search:  $2- $+ : http://www.youtube.com/results?search_query= $+ %s $+ &search_type=&aq=f
}

You don't really need the -e switch because upon existing, the timed var will be unset anyway. And you only need one check for $2 and $replace($2,$chr(32),+) with a variable to apply to all the routines.

 Respond  
Stewie1k94   -  Apr 06, 2011

thanks

 Respond  
Dani_l11   -  Apr 06, 2011

It's far from perfect, but keep up the good work :) I'll give you a 7.

@Bielie:
That won't work. You gotta use

on *:TEXT:*:#:{
     if (%flood [ $+ [ $nick ] ]) halt
     set -eu3 %Floodnick [ $+ [ $nick ] ] .
     if ($1 == !youtube)  {
          if (!$2) notice $nick http://youtube.com
          else msg $chan 3Your Youtube Search:  $$2- $+ : http://www.youtube.com/results?search_query= $+ $$2- $+ &search_type=&aq=f 
     }
     if ($1 == !Google)  {
          if (!$2) notice $nick http://google.com
          else msg $chan  3your google search: $+(http://www.google.com/search?q=,$replace($$2-,$chr(32),+)) 
     }
}
 Respond  
Stewie1k94   -  Mar 31, 2011

thanks for your comment bielie

 Respond  
Bielie   -  Mar 31, 2011

This code is a bit safer and always responds

on *:TEXT:*:#:{
  if (%flood [ $+ [ $nick ] ]) { return }
  set -eu3 %flood [ $+ [ $nick ] ] $true

  if ($1 == !youtube) && ($2 != $null) { msg $chan 3Your Youtube Search:  $$2- $+ : http://www.youtube.com/results?search_query= $+ $$2- $+ &search_type=&aq=f 
    else { notice $nick http://youtube.com | return }
  }
  if ($1 == !google) && ($2 != $null) { msg $chan  3your google search: $+(http://www.google.com/search?q=,$replace($$2-,$chr(32),+)) 
    else { notice $nick http://google.com | return }
  }
}
 Respond  
Stewie1k94   -  Mar 29, 2011

hmmmm

 Respond  
Callumlord   -  Mar 29, 2011

?

 Respond  
Conscious   -  Mar 29, 2011

You're not going to ask? :/

 Respond  
Stewie1k94   -  Mar 29, 2011

ok

 Respond  
Conscious   -  Mar 29, 2011

This is how I would do it.

on $*:TEXT:/^!(youtube|google)(.+?)/Si:#: msg $chan $+(3Your $iif($regml(1) == youtube,Youtube,Google) Search: $$2-,: $iif($regml(1) == youtube,http://www.youtube.com/results?search_query=,http://www.google.com/search?q=),$replace($regsubex($2-,/([^\w\s])/Sg,$+(%,$base($asc(\t),10,16,2))),$chr(32),$chr(43)))
 Respond  
Stewie1k94   -  Mar 28, 2011

lol callum

 Respond  
Callumlord   -  Mar 28, 2011

Digs a hole and throws him self down and burrys himsilf :P

 Respond  
[Plornt]   -  Mar 28, 2011

No offence, but it isnt sorted Callum.

It definatly still needs the url encode plus the youtube one doesnt even encode the space.

Not trying to bog you down or anything but I just wanted to say....

Search Hawkee for somthing like a URL encode alias or just url encode and then pop that in the script and use the alias around your search parameters (ie $$2-)

 Respond  
Stewie1k94   -  Mar 28, 2011

i made it this morning and i thought it was fine but apprantly its not encoded

 Respond  
Callumlord   -  Mar 28, 2011

it is fine, give it a test now you edited that part. :)

 Respond  
Stewie1k94   -  Mar 28, 2011

so how do i sort this snippit out then

 Respond  
Callumlord   -  Mar 28, 2011

LOL :)

 Respond  
Stewie1k94   -  Mar 28, 2011

oh its going down the way i read it wrong

 Respond  
Stewie1k94   -  Mar 28, 2011

whatthe hell i mean i posted that after you

 Respond  
Stewie1k94   -  Mar 28, 2011

toclafane1
so what have i done wrong
7 mins ago

Callumlord
Chill
7 mins ago · Like

toclafane1
anything i need to know
6 mins ago

 Respond  
Stewie1k94   -  Mar 28, 2011

so whats that meant to do

 Respond  
Callumlord   -  Mar 28, 2011

toclafane1, Check this out http://www.hawkee.com/snippet/8499/ :) Might help

 Respond  
Stewie1k94   -  Mar 28, 2011

anything i need to know

 Respond  
Callumlord   -  Mar 28, 2011

Chill

 Respond  
Stewie1k94   -  Mar 28, 2011

so what have i done wrong

 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.