egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Youtube script error

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
tigrato
Voice


Joined: 04 Jul 2009
Posts: 22

PostPosted: Fri Aug 27, 2010 9:53 am    Post subject: Youtube script error Reply with quote

I tried to update the Mookie youtube script but something is wrong ... The script does not work.

Can anyone help?



Code:
### YouTube Searching script. v0.1
### Made by Mookie      
### Contact me at Efnet for more information or suggestions
### V0.3 Fixed + added spam protection

package require http

### Settings ###

set youtube(timeout) "600000"      ;# Youtube geturl timeout. (better leave this default)
set youtube(results) "5"      ;# Results to display
set youtube(trigger) "!youtube"      ;# Search trigger
set youtube(spam) "10"         ;# Spam protection in seconds

#########################################################
## Don't edit below unless you know what you're doing. ##
#########################################################


bind pub - $::youtube(trigger) youtube

proc youtube {nick uhost hand chan arg} {
   if {[info exists ::checks($nick)] && ([clock seconds] - $::checks($nick)) < $::youtube(spam)} { putserv "PRIVMSG  $chan :Fk off spammer.."; return }
   set ::checks($nick) [clock seconds]
   if {$arg == ""} { putmsg $nick "Please use: $::youtube(trigger) KEYWORD"; return }
   set form [http::formatQuery search_query $arg search search]
   set tok [http::geturl http://www.youtube.com/results?search_query=$form -timeout $::youtube(timeout)]
   set data [http::data $tok]
   http::cleanup $tok
   set a "0"   
   while {[regexp -- {<a id="video-long-title-.*?" href="(.*?)" title="(.*?)" rel="nofollow">(.*)$} $data -> number title data]} {
      if {$a == $::youtube(results)} { break }
      putserv "PRIVMSG $chan :\[\002\0037Título\003\002: $title \002\0037Link:\003\002 http://youtube.com$number \ ]"
      incr a
   }
   if {![info exists title]} { putserv "PRIVMSG $chan :\002Error:\002 Nothing was found for '$arg', you kill me!" }
}

Back to top
View user's profile Send private message
tigrato
Voice


Joined: 04 Jul 2009
Posts: 22

PostPosted: Wed Sep 29, 2010 3:35 pm    Post subject: Reply with quote

someone can help? I need an youtube search script
Back to top
View user's profile Send private message
demetrius_reis
Halfop


Joined: 10 Aug 2010
Posts: 42

PostPosted: Wed Sep 29, 2010 7:51 pm    Post subject: Reply with quote

Code:

package require http

set youtube(timeout) "600000"      ;# Youtube geturl timeout. (better leave this default)
set youtube(results) "5"      ;# Results to display
set youtube(trigger) "!youtube"      ;# Search trigger
set youtube(spam) "5"         ;# Spam protection in seconds

bind pub - $::youtube(trigger) youtube

proc youtube {nick uhost hand chan arg} {
   if {[info exists ::checks($nick)] && ([clock seconds] - $::checks($nick)) < $::youtube(spam)} { sendmsg $chan "Fk off spammer.."; return }
   set ::checks($nick) [clock seconds]
   if {$arg == ""} { putmsg $nick "Please use: $::youtube(trigger) KEYWORD"; return }
   set form [http::formatQuery search_query $arg search search]
   set tok [http::geturl http://www.youtube.com/results?search_type=&$form -timeout $::youtube(timeout)]
   set data [http::data $tok]
   http::cleanup $tok
   set a "0"
   while {[regexp -- {<a id="video-short-title.*?" href="(.*?)"  title="(.*?)" rel="nofollow">(.*)$} $data -> number title data]} {
      if {$a == $::youtube(results)} { break }
      sendmsg $chan "\[Title: $title Link:http://youtube.com$number\]"
      incr a
   }
   if {![info exists title]} { sendmsg $chan "\002Error:\002 Nothing found for '$arg'" }
}
proc "sendmsg" { target message } {
   sputraw "PRIVMSG [string tolower $target] :$message"
}
proc "sputraw" { text } {
   set text [string trim $text]
   putdccraw 0 [string length $text\n] $text\n
}
Back to top
View user's profile Send private message
tigrato
Voice


Joined: 04 Jul 2009
Posts: 22

PostPosted: Thu Sep 30, 2010 9:08 am    Post subject: Reply with quote

This script don't work...
Back to top
View user's profile Send private message
username
Op


Joined: 06 Oct 2005
Posts: 196
Location: Russian Federation, Podolsk

PostPosted: Thu Sep 30, 2010 2:37 pm    Post subject: Reply with quote

If you use Eggdrop 1.6.20 change
Code:
putdccraw 0 [string length $text\n] $text\n
to
Code:
putnow $text\n

_________________
Архив TCL скриптов для ботов Eggdrop/Windrop:
http://egghelp.ru/
Back to top
View user's profile Send private message Send e-mail Visit poster's website
tigrato
Voice


Joined: 04 Jul 2009
Posts: 22

PostPosted: Fri Oct 01, 2010 10:19 am    Post subject: Reply with quote

username wrote:
If you use Eggdrop 1.6.20 change
Code:
putdccraw 0 [string length $text\n] $text\n
to
Code:
putnow $text\n


Thanks username but still don't work. Bot give me this message
Error: Nothing found for 'tigrato'

If you could help me....
Back to top
View user's profile Send private message
username
Op


Joined: 06 Oct 2005
Posts: 196
Location: Russian Federation, Podolsk

PostPosted: Fri Oct 01, 2010 1:07 pm    Post subject: Reply with quote

It works fine.

Quote:
<@tvrsh> !youtube ololo
<+bionic> [T?tulo: tugba Г¶zerk - lololo Link: http://youtube.com/watch?v=IZJR_L-i_Nc ]
...

_________________
Архив TCL скриптов для ботов Eggdrop/Windrop:
http://egghelp.ru/
Back to top
View user's profile Send private message Send e-mail Visit poster's website
tigrato
Voice


Joined: 04 Jul 2009
Posts: 22

PostPosted: Fri Oct 01, 2010 1:24 pm    Post subject: Reply with quote

username wrote:
It works fine.

Quote:
<@tvrsh> !youtube ololo
<+bionic> [T?tulo: tugba Г¶zerk - lololo Link: http://youtube.com/watch?v=IZJR_L-i_Nc ]
...

My server are located in France (OVH) and youtube give a page to choose the language and country and don't present the correct page of search. I need a sollution...
Back to top
View user's profile Send private message
username
Op


Joined: 06 Oct 2005
Posts: 196
Location: Russian Federation, Podolsk

PostPosted: Fri Oct 01, 2010 2:50 pm    Post subject: Reply with quote

Try change
Code:
http://www.youtube.com/results?search_query=$form

to
Code:
http://www.youtube.com/results?search_query=$form&gl=US

_________________
Архив TCL скриптов для ботов Eggdrop/Windrop:
http://egghelp.ru/
Back to top
View user's profile Send private message Send e-mail Visit poster's website
tigrato
Voice


Joined: 04 Jul 2009
Posts: 22

PostPosted: Fri Oct 01, 2010 4:05 pm    Post subject: Reply with quote

Still don't work. Sad Thanks username
Back to top
View user's profile Send private message
demetrius_reis
Halfop


Joined: 10 Aug 2010
Posts: 42

PostPosted: Fri Oct 01, 2010 8:37 pm    Post subject: Reply with quote

version 1.6.20
Back to top
View user's profile Send private message
tigrato
Voice


Joined: 04 Jul 2009
Posts: 22

PostPosted: Sat Oct 02, 2010 5:34 am    Post subject: Reply with quote

demetrius_reis wrote:
version 1.6.20


I don't understand...
Back to top
View user's profile Send private message
pogue
Voice


Joined: 17 May 2009
Posts: 28

PostPosted: Thu Oct 07, 2010 2:53 am    Post subject: Reply with quote

speechless' Google script has a !youtube search function in it.

http://forum.egghelp.org/viewtopic.php?t=13586
_________________
Helpful Tools:

  • Notepad++: Windows Text Editor with TCL Syntax Highlighting
  • Pastebin TCL: For easy script collaboration
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber