This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Youtube script error

Support & discussion of released scripts, and announcements of new releases.
Post Reply
t
tigrato
Voice
Posts: 22
Joined: Sat Jul 04, 2009 7:46 am

Youtube script error

Post by tigrato »

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

Can anyone help?


Code: Select all

### 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!" }
}

t
tigrato
Voice
Posts: 22
Joined: Sat Jul 04, 2009 7:46 am

Post by tigrato »

someone can help? I need an youtube search script
d
demetrius_reis
Halfop
Posts: 42
Joined: Tue Aug 10, 2010 9:54 am

Post by demetrius_reis »

Code: Select all

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
}
t
tigrato
Voice
Posts: 22
Joined: Sat Jul 04, 2009 7:46 am

Post by tigrato »

This script don't work...
User avatar
username
Op
Posts: 196
Joined: Thu Oct 06, 2005 9:20 am
Location: Russian Federation, Podolsk
Contact:

Post by username »

If you use Eggdrop 1.6.20 change

Code: Select all

putdccraw 0 [string length $text\n] $text\n
to

Code: Select all

putnow $text\n
Архив TCL скриптов для ботов Eggdrop/Windrop:
http://egghelp.ru/
t
tigrato
Voice
Posts: 22
Joined: Sat Jul 04, 2009 7:46 am

Post by tigrato »

username wrote:If you use Eggdrop 1.6.20 change

Code: Select all

putdccraw 0 [string length $text\n] $text\n
to

Code: Select all

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....
User avatar
username
Op
Posts: 196
Joined: Thu Oct 06, 2005 9:20 am
Location: Russian Federation, Podolsk
Contact:

Post by username »

It works fine.
<@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/
t
tigrato
Voice
Posts: 22
Joined: Sat Jul 04, 2009 7:46 am

Post by tigrato »

username wrote:It works fine.
<@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...
User avatar
username
Op
Posts: 196
Joined: Thu Oct 06, 2005 9:20 am
Location: Russian Federation, Podolsk
Contact:

Post by username »

Try change

Code: Select all

http://www.youtube.com/results?search_query=$form
to

Code: Select all

http://www.youtube.com/results?search_query=$form&gl=US
Архив TCL скриптов для ботов Eggdrop/Windrop:
http://egghelp.ru/
t
tigrato
Voice
Posts: 22
Joined: Sat Jul 04, 2009 7:46 am

Post by tigrato »

Still don't work. :( Thanks username
d
demetrius_reis
Halfop
Posts: 42
Joined: Tue Aug 10, 2010 9:54 am

Post by demetrius_reis »

version 1.6.20
t
tigrato
Voice
Posts: 22
Joined: Sat Jul 04, 2009 7:46 am

Post by tigrato »

demetrius_reis wrote:version 1.6.20
I don't understand...
User avatar
pogue
Voice
Posts: 28
Joined: Sun May 17, 2009 3:56 am
Contact:

Post by pogue »

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
Post Reply