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

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
duarteper
Voice


Joined: 06 Dec 2012
Posts: 12

PostPosted: Sun Jan 06, 2013 12:57 pm    Post subject: youtube search tcl error Reply with quote

Hello everyone
this tcl doesent work wen i type

!yt Video_here
Code:

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"
Back to top
View user's profile Send private message
Madalin
Master


Joined: 24 Jun 2005
Posts: 310
Location: Constanta, Romania

PostPosted: Mon Jan 21, 2013 8:31 pm    Post subject: Reply with quote

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
_________________
https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Tue Jan 22, 2013 1:39 am    Post subject: Reply with quote

Looks like they've changed (again?) the layout thus giving error:
Quote:

Tcl error: can't read "yt(infos)": no such element in array

made by:
Code:

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests 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