| View previous topic :: View next topic |
| Author |
Message |
tigrato Voice
Joined: 04 Jul 2009 Posts: 22
|
Posted: Fri Aug 27, 2010 9:53 am Post subject: Youtube script error |
|
|
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 |
|
 |
tigrato Voice
Joined: 04 Jul 2009 Posts: 22
|
Posted: Wed Sep 29, 2010 3:35 pm Post subject: |
|
|
| someone can help? I need an youtube search script |
|
| Back to top |
|
 |
demetrius_reis Halfop
Joined: 10 Aug 2010 Posts: 42
|
Posted: Wed Sep 29, 2010 7:51 pm Post subject: |
|
|
| 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 |
|
 |
tigrato Voice
Joined: 04 Jul 2009 Posts: 22
|
Posted: Thu Sep 30, 2010 9:08 am Post subject: |
|
|
| This script don't work... |
|
| Back to top |
|
 |
username Op

Joined: 06 Oct 2005 Posts: 196 Location: Russian Federation, Podolsk
|
Posted: Thu Sep 30, 2010 2:37 pm Post subject: |
|
|
If you use Eggdrop 1.6.20 change | Code: | | putdccraw 0 [string length $text\n] $text\n | to _________________ Архив TCL скриптов для ботов Eggdrop/Windrop:
http://egghelp.ru/ |
|
| Back to top |
|
 |
tigrato Voice
Joined: 04 Jul 2009 Posts: 22
|
Posted: Fri Oct 01, 2010 10:19 am Post subject: |
|
|
| username wrote: | If you use Eggdrop 1.6.20 change | Code: | | putdccraw 0 [string length $text\n] $text\n | to |
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 |
|
 |
username Op

Joined: 06 Oct 2005 Posts: 196 Location: Russian Federation, Podolsk
|
Posted: Fri Oct 01, 2010 1:07 pm Post subject: |
|
|
It works fine.
_________________ Архив TCL скриптов для ботов Eggdrop/Windrop:
http://egghelp.ru/ |
|
| Back to top |
|
 |
tigrato Voice
Joined: 04 Jul 2009 Posts: 22
|
Posted: Fri Oct 01, 2010 1:24 pm Post subject: |
|
|
| username wrote: | It works fine.
|
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 |
|
 |
username Op

Joined: 06 Oct 2005 Posts: 196 Location: Russian Federation, Podolsk
|
Posted: Fri Oct 01, 2010 2:50 pm Post subject: |
|
|
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 |
|
 |
tigrato Voice
Joined: 04 Jul 2009 Posts: 22
|
Posted: Fri Oct 01, 2010 4:05 pm Post subject: |
|
|
Still don't work. Thanks username |
|
| Back to top |
|
 |
demetrius_reis Halfop
Joined: 10 Aug 2010 Posts: 42
|
Posted: Fri Oct 01, 2010 8:37 pm Post subject: |
|
|
| version 1.6.20 |
|
| Back to top |
|
 |
tigrato Voice
Joined: 04 Jul 2009 Posts: 22
|
Posted: Sat Oct 02, 2010 5:34 am Post subject: |
|
|
| demetrius_reis wrote: | | version 1.6.20 |
I don't understand... |
|
| Back to top |
|
 |
pogue Voice

Joined: 17 May 2009 Posts: 28
|
|
| Back to top |
|
 |
|