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 search tcl error

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
d
duarteper
Voice
Posts: 12
Joined: Thu Dec 06, 2012 10:55 pm

youtube search tcl error

Post by duarteper »

Hello everyone
this tcl doesent work wen i type

!yt Video_here

Code: Select all

bind pub -|- !yt yt_search 
###
### youtube getlink v 0.1
###
### just a simple script that fetches the first
### result from a youtube search, giving you
### the link, title and description for the primary
### result
###
### nothing can be set here
### if you know tcl please edit to fit your need
### grtz hwk
### contact me at: lowraider1@gmail.com

package require http

proc yt_search {nick uhost hand chan args} {

regsub -nocase -all " " $args "+" yt(squery)

set yt(surl) "http://youtube.com/results?search_query=$yt(squery)&search_type="

http::config -useragent mozilla
set urltok [http::geturl $yt(surl) -timeout 20000]
set yt(rpage) [http::data $urltok]
http::cleanup $urltok

regsub -nocase -all (<b>|</b>|\t|<i>|</i>) $yt(rpage) "" rpage

regexp -line -- {<div class="vlshortTitle">\n(.*)\n</div>} $rpage -> yt(infos)

regexp {<a href="(.*)"  title} $yt(infos) -> yt(link)
regexp {>(.*)</a>} $yt(infos) -> yt(title)
regexp -line -- {<div  class="vldesc">\n(.*)\n</div>\n</div>} $rpage -> yt(desc)

if {[string match -nocase "*No Videos found*" $rpage] || ![info exists yt(title)]} {puthelp "privmsg $chan :Nothing found"} else {
puthelp "privmsg $chan :LINK: http://youtube.com$yt(link)  |  Title: $yt(title)  |  Description: $yt(desc)"}

}

putlog "youtube getlink v 0.1 by hwk loaded"
User avatar
Madalin
Master
Posts: 310
Joined: Fri Jun 24, 2005 11:36 am
Location: Constanta, Romania
Contact:

Post by Madalin »

Use this page http://forum.egghelp.org/viewtopic.php?t=10215 to get all the informations on hw to enable .tcl command and see if the script is giving any error when you trigger the main command.

So what you need to do is:
1. Activate .tcl command from eggdrop.conf
2. Use /ctcp botnick chat
3. Use .tcl $errorInfo (copy paste here the output here)

Then we will see if there is an actual error
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Looks like they've changed (again?) the layout thus giving error:
Tcl error: can't read "yt(infos)": no such element in array
made by:

Code: Select all

regexp -line -- {<div class="vlshortTitle">\n(.*)\n</div>} $rpage -> yt(infos)
Once the game is over, the king and the pawn go back in the same box.
Post Reply