| View previous topic :: View next topic |
| Author |
Message |
rrc55 Voice
Joined: 11 Mar 2009 Posts: 29
|
Posted: Tue Sep 08, 2009 6:32 pm Post subject: Help Updating ourTube.tcl |
|
|
I was wondering if anyone would tell me how to get the "views" category of this script to work. Everything displays correctly except the number of views. It's always shows "no views." Here's some relevant info I think:
Code in ourTube.tcl, Line 215:
| Code: |
foreach {id line} $videos {
set map {}
foreach {entity number} [regexp -all -inline {&#(\d+);} $line] {
lappend map $entity [format \\u%04x [scan $number %d]]
}
set line [string map [subst -nocomm -novar $map] $line]
regexp {<img title="(.*?)"} $line "" title
regsub -all -- {\<[^\>]*\>|\t} $title "" title
regexp {<div class="video-time">(.*?)</span>} $line "" time
regsub -all -- {\<[^\>]*\>|\t} $time "" time
regexp {class="video-description">(.*?)</div>} $line "" description
regsub -all -- {\<[^\>]*\>|\t} $description "" description
regexp {<button class="master-sprite ratingVS ratingVS-(.*?)"} $line "" rating
regexp {class="video-date-added">(.*?)</span>} $line "" added
regexp {class="video-view-count">(.*?)</span>} $line "" views
regexp {<span class="video-username">(.*?)</a>} $line "" author
regsub -all -- {\<[^\>]*\>|\t} $author "" author
regexp {<a id="video-url-(.*?)"} $line "" link
set link "http://youtube.com/watch?v=$link"
set output [string map [list "<link>" $link "<time>" $time "<added>" $added "<title>" $title "<author>" $author "<description>" $description "<views>" $views "<rating>" $rating] $ourtube(outputsearch)]
lappend list $output
if {$i > $ourtube(max)} {
break
}
incr i
}
return $list
|
A snippet of code from a youtube video page:
| Code: |
<div id="watch-views-div">
<span id="watch-views"><span id="watch-view-count">8,779</span> views</span>
</div>
|
Script link:
http://www.egghelp.org/cgi-bin/tcl_archive.tcl?mode=download&id=1594
Thank You. |
|
| Back to top |
|
 |
rrc55 Voice
Joined: 11 Mar 2009 Posts: 29
|
Posted: Wed Sep 09, 2009 12:15 am Post subject: |
|
|
Actually I think these are the relevant lines.
| Code: | | regexp {<span id=\"watch-view-count\">(.*?)</span>} $data "" views |
| Code: | | regsub -all -- {\<[^\>]*\>|\t} $views "" views |
| Code: |
if {![string is digit -strict $views]} {
set views "no"
}
|
|
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Wed Sep 09, 2009 12:37 am Post subject: |
|
|
| rrc55 wrote: | Actually I think these are the relevant lines.
| Code: | | regexp {<span id=\"watch-view-count\">(.*?)</span>} $data "" views |
| Code: | | regsub -all -- {\<[^\>]*\>|\t} $views "" views |
| Code: |
if {![string is digit -strict $views]} {
set views "no"
}
|
|
Your closer than you think.
It's the comma causing the problem, it of course is not a digit and this part: | Code: | if {![string is digit -strict $views]} {
set views "no"
} |
Should be removed.. and this part slightly changed...
| Code: | change: regexp {<span id=\"watch-view-count\">(.*?)</span>} $data "" views
into: if {![regexp {<span id=\"watch-view-count\">(.*?)</span>} $data "" views]} { set views "no" } |
_________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
rrc55 Voice
Joined: 11 Mar 2009 Posts: 29
|
Posted: Wed Sep 09, 2009 2:27 am Post subject: |
|
|
| You are a scholar and a gentleman. |
|
| Back to top |
|
 |
pogue Voice

Joined: 17 May 2009 Posts: 28
|
Posted: Fri Sep 11, 2009 8:45 am Post subject: |
|
|
I can't get this script to pull descriptions off Youtube either, but it will get the comments okay.
| rrc55 wrote: | | You are a scholar and a gentleman. |
I sent you a PM.
Thanks |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Fri Sep 11, 2009 3:59 pm Post subject: |
|
|
| pogue wrote: | I can't get this script to pull descriptions off Youtube either, but it will get the comments okay.
| rrc55 wrote: | | You are a scholar and a gentleman. |
I sent you a PM.
Thanks |
To properly get descriptions, change this: | Code: | | regexp {class="video-description">(.*?)</div>} $line "" description |
Into this: | Code: | | regexp {description">(.*?)</div>} $line "" description |
_________________ speechles' eggdrop tcl archive |
|
| Back to top |
|
 |
pogue Voice

Joined: 17 May 2009 Posts: 28
|
Posted: Thu Nov 05, 2009 5:38 am Post subject: |
|
|
I am having some trouble with this script out of the blue. In the main channel, the bot will only say "Youtube" when a script is posted, but in the bots console it says the whole bit.
However, the descriptions still is saying that there is no description found.
I've copied the code I'm using, updated from speechles and rrc55 (Thanks to both of you) to pastebin.
http://pastebin.com/f2987e2f6
IRC:
[03:33am] <~pogue> http://www.youtube.com/watch?v=ahihGKZC5Kk
[03:33am] <+BodyBuildingBot> YouTube
Console:
[04:33] ourTube: Getting http://www.youtube.com/watch?v=ahihGKZC5Kk ... from pogue on #bodybuilding.com
[04:33] ourTube: YouTube
- The Dangers of Colloidal Silver. (by pogue972) 207,396 views, 282 rating. Description: This video doesn't have any description
I'm a little baffled as to why this is happening, it was working fine previously and I can't see any configuration options that would limit its output. When I look over it, it seems like it's breaking after the first word, but I can't see why...
Thoughts?
Thanks in advance,
pogue |
|
| Back to top |
|
 |
anotheregglover Voice
Joined: 13 Jan 2005 Posts: 38
|
Posted: Sat Nov 07, 2009 10:47 am Post subject: |
|
|
youtube <title> tags are now multiline causing the fail.
I set it to use the meta tag instead and made some other fixes
| Code: | #
# ourTube.tcl 1.0.2 --
# This file search the web target and show relevant information about.
# Is posible define a YouTube account and the bot will log in. Useful
# when the link are for adult people i.e. It will show the first link
# that finds in a whole phrase.
#
# Copyright (c) 2007-2009 Eggdrop Spain 12-april-2009
# HackeMate (Sentencia) Sentencia@eggdrop.es
#
# This program is free software; you can redistribute it and/or
# modify it _only for your own use_
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# Please, use the email to contact with the author for let him know about all
# what you could do. Everyone wants develop his software as well.
#
# Thank you for feed my empiric life.
#
# If you like, you can contact with the author to suggest him features. By the
# way, do not ask him to make Login, he is working on that.
# This is what you need to get this script work:
# Type in partyline: .chanset #channel +ourtube
# Changelog:
# Fixes:
# Resolved Tcl error [otPub]: can't read "views": no such variable
# Resolved eternal ignore-protection issue
#
# Added features:
# Now will forward to new location 302 http code received when pasting
# http://youtube. links
# Explicit message when 404 error (not found)
# All non 200, 302, 303, 404 errors will stop the procedure showing proper reason
# -*- IMPORTANT -*-
# Auto Update checker: You can verify if your ourTube copy is the lastest
# version available typing .ourtube update in partyline
#
# FeedBack feature. Type in partyline .ourtube feedback [your email] <message>
# to send the author any suggestion or comment. Insults are not welcome.
#
# Added seacher, !youtube string and it will return matches
# it is customizable (configure ourtube(outputsearch))
setudef flag ourtube
setudef flag ourtubecolors
global ourtube tcl_platform
# (1) Enable or (0) disable colors
set ourtube(colors) 1
# Flood Protection: after show a link, will ignore all links few seconds
# This means 1 link per 10 seconds.
set ourtube(rest) 10
# What language you can receive the youTube data? (if works heh)
set ourtube(lang) en
# Limit of links at same time
set ourtube(max) 5
# Do you want see all matches at one line? (0) Yes (1) No
set ourtube(multiline) 1
# This is the final output message what you will read in your channel.
# -*- This is not for search command (only when someone pasted link)
# You can configure all fields that your eggdrop will show.
# <title> will return the title of the video
# <author> It was the author himself who had uploaded the video
# <views> How many views the video has
# <rating> His rating
# <description> Information by author - This may be disabled because it can
# contain spam
# <comment> Will show the last comment if exists - Same as description, take care
# with spam.
set ourtube(output) "\002<title>\002. (by <author>) <views> views, <rating> rating. Last comment: <comment>"
# This is the output message of search engine
# -*- This is only for search engine
# You can configure all fields that your eggdrop will show.
# <link> URL video link
# <time> video's duration
# <added> since when it is on line
# <title> will return the title of the video
# <author> It was the author himself who had uploaded the video
# <views> How many views the video has
# <rating> His rating
# <description> Information by author - This may be disabled because it can
# contain spam
set ourtube(outputsearch) "\00312\037<link>\003\037 \00315\(<time> rating: <rating>\)\003 \"\0036<title> \0031<author> said\0036: <description>\003\" <views>, added <added>"
# Do you want auto update this file when it is possible?
# (1) Yes (0) No - It is recommended, if youtube changes his tags probably this script will broke
set ourtube(autoupdate) 0
# This is not required to edit, or yes.
set ourtube(author) "HackeMate"
set ourtube(contact) "HackeMate <Sentencia@eggdrop.es>"
set ourtube(name) "ourTube"
set ourtube(fileName) [info script]
set ourtube(projectName) "ourTube"
set ourtube(version) "1.0.1"
set ourtube(package.http) [package require http]
set ourtube(protection) ""
if {$tcl_platform(os) eq "Linux"} {
set platfrm "X11"
} else {
set platfrm $tcl_platform(os)
}
http::config -useragent "Mozilla/5.0 ($platfrm; U; $tcl_platform(os) $tcl_platform(machine); $ourtube(lang); rv:1.9.0.3) ourTube 1.0" -accept "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
bind pub - !youtube otYoutube
proc otYoutube {nick uhost hand chan text} {
if {![channel get $chan ourtube]} {
if {$text eq "enable"} {
channel set $chan +ourtube
channel set $chan +ourtubecolors
otLog $chan "Usage: !youtube <search string> To see a list of matches."
putserv "NOTICE $nick :You also can use .ourtube update and .ourtube feedback in partyline to upgrade your script or send a feedback to author of this script."
return
} else {
putserv "NOTICE $nick :$chan has this command disabled."
}
if {[matchattr $hand n]} {
putserv "NOTICE $nick :You can enable it directly typing: /msg $chan !youtube enable"
}
return
}
regsub -all -- {\017|\002|\037|\026|\003(\d{1,2})?(,\d{1,2})?} $text "" arg
global ourtube
# This is a generic protection to prevent flood ourtube.com
# No utimer required
#
if {![info exists ourtube(protection)]} {
set ourtube(protection) [clock seconds]
} else {
if {![string is digit -strict $ourtube(protection)]} {
set ourtube(protection) [clock seconds]
} else {
set time [expr [clock seconds]-$ourtube(protection)]
if {$time >= $ourtube(rest)} {
set ourtube(protection) [clock seconds]
} else {
otLog log "Flood protection in $chan from $nick\."
return
}
}
}
if {$arg eq ""} {
putserv "NOTICE $nick :Tell me what to search."
return
}
set data [ourtubeGet $arg]
if {![channel get $chan ourtubecolors]} {
regsub -all -- {\017|\002|\037|\026|\003(\d{1,2})?(,\d{1,2})?} $data "" data
}
if {[string length $data] == 0} {
set data "I was unable to connect to that website. Probably I get timeout."
return
}
if {$ourtube(multiline) != "1"} {
putserv "PRIVMSG $chan :$data"
} else {
foreach line $data {
putserv "PRIVMSG $chan :$line"
}
}
}
proc ourtubeGet {ask} {
global ourtube
regsub -all -- {\s+} $ask " " search
set search [http::formatQuery $search]
http::config -useragent "Mozilla/5.0 (Windows NT; U; Windows NT x86; en-ES; rv:1.9.0.3) Firefox 3.0.7" -accept "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
set token [http::geturl http://www.youtube.com/results?search_query=$search -timeout 10000]
upvar #0 $token state
set data $state(body)
regsub -all {\n|\t} $data "" data
set ncode ""
regexp {[0-9]{3}} $state(http) ncode
if {$ncode eq ""} {
set ncode $state(http)
}
set list {}
switch -- $ncode {
"200" {
set videos [regexp -all -inline {<div class="video-entry">(.*?)<div class="video-clear-list-left"></div>} $data]
set total [expr [llength $videos] /2]
if {$total > $ourtube(max)} {
set list [list "Showing $ourtube(max) of $total."]
}
set i 2
set title ""
set description ""
set rating ""
set added ""
set views ""
set author ""
set link ""
foreach {id line} $videos {
set map {}
foreach {entity number} [regexp -all -inline {&#(\d+);} $line] {
lappend map $entity [format \\u%04x [scan $number %d]]
}
set line [string map [subst -nocomm -novar $map] $line]
regexp {<img title="(.*?)"} $line "" title
regsub -all -- {\<[^\>]*\>|\t} $title "" title
regexp {<div class="video-time">(.*?)</a>} $line "" time
regsub -all -- {\<[^\>]*\>|\t} $time "" time
regexp {class="video-description">(.*?)</div>} $line "" description
#regexp {"description">(.*?)</div>} $line "" description
regsub -all -- {\<[^\>]*\>|\t} $description "" description
regexp {<button class="master-sprite ratingL ratingL-(.*?)"} $line "" rating
regexp {class="watch-video-added">(.*?)</span>} $line "" added
regexp {class="watch-view-count">(.*?)</span>} $line "" views
regexp {<span class="video-username">(.*?)</a>} $line "" author
regsub -all -- {\<[^\>]*\>|\t} $author "" author
regexp {<a id="video-url-(.*?)"} $line "" link
set link "http://youtube.com/watch?v=$link"
set output [string map [list "<link>" $link "<time>" $time "<added>" $added "<title>" $title "<author>" $author "<description>" $description "<views>" $views "<rating>" $rating] $ourtube(outputsearch)]
lappend list $output
if {$i > $ourtube(max)} {
break
}
incr i
}
return $list
}
"404" {
otLog log "No such file or webpage."
http::cleanup $token
return [list "No such file or webpage."]
}
default {
otLog log "unforeseen circumstance. Server responded: $ncode"
http::cleanup $token
return [list "unforeseen circumstance. Server responded: $ncode"]
}
}
}
bind pubm - * otPub
proc otPub {nick uhost hand chan text} {
if {![channel get $chan ourtube]} {
return
}
global ourtube
regsub -all -- {\017|\002|\037|\026|\003(\d{1,2})?(,\d{1,2})?} $text "" arg
set webTarget [lsearch -inline [split $arg] {*http://*.youtube.*/watch?*}]
if {([info exists ourtube(protection)]) && ([string is digit -strict $ourtube(protection)])} {
set rest [expr [clock seconds]-$ourtube(protection)]
if {$rest >= $ourtube(rest)} {
set ourtube(protection) ""
}
} else {
set ourtube(protection) ""
}
if {$webTarget ne ""} {
if {! [regexp -nocase {^(http://)?([^/:]+)(:([0-9]+))?(/.*)?$} $webTarget]} {
otLog log "Unsupported URL: $webTarget"
return
}
if {$ourtube(protection) ne ""} {
otLog "Resting... (flood protection) [duration [expr ([clock seconds]-$ourtube(protection))]] left"
return
}
set ourtube(protection) [clock seconds]
otLog log "Getting $webTarget ... from $nick on $chan"
set data [otGet $webTarget]
if {!$ourtube(colors)} {
regsub -all -- {\017|\002|\037|\026|\003(\d{1,2})?(,\d{1,2})?} $data "" data
}
if {[string length $data] == 0} {
set data "I was not able to reach Youtube's link. Probably I get a timeout. Try again."
}
otLog log "$data"
putserv "PRIVMSG $chan :$data"
utimer $ourtube(rest) [list set ourtube(protection) ""]
}
}
proc otGet {web {relocation ""}} {
global ourtube
set token [http::geturl $web -timeout 4000]
upvar #0 $token state
set lastcode $state(http)
set ncode ""
regexp {[0-9]{3}} $lastcode ncode
if {$ncode eq ""} {
set ncode $lastcode
}
switch -- $ncode {
"200" {
}
"302" {
foreach {flag value} $state(meta) {
if {$flag eq "Location"} {
# Due to invalid youtube link but valid url syntax we can
# receive an url forward. this handles that
http::cleanup $token
otLog log "$web forwards us to $value"
return [otGet $value "(Relocated)"]
}
}
}
"303" {
otLog log "This video does not exists."
http::cleanup $token
return "That video does not exists. Server responded: $lastcode"
}
"404" {
otLog log "$web - No such webpage."
http::cleanup $token
return "$web - No such webpage"
}
default {
http::cleanup $token
otLog log "unforeseen circumstances. Server responded: $lastcode"
return "unforeseen circumstances. Server responded: $lastcode"
}
}
set data [string map {""\;" "\"" "&\;quot\;" "\"" "&" "&"} $state(body)]
http::cleanup $token
set author ""
set description ""
set views ""
set rating ""
#regexp {<title>(.*)</title>} $data "" title
regexp {<meta name=\"title\" content=\"(.*?)\">.*} $data "" title
regexp {class="hLink fn n contributor">(.*?)</a><br>} $data "" author
regexp {<meta name=\"description\" content=\"(.*?)\">.*} $data "" description
regexp {<span id=\"watch-view-count\">(.*?)</span>} $data "" views
regexp {<div id=\"defaultRatingMessage\">(.*?)</span>.*} $data "" rating
# This is not so smart way. I know, sorry about :)
set comments ""
set description ""
regexp {<div id="recent_comments" class="comments">(.*?)<div id="div_comment_form_id} $data "" comments
if {$comments ne ""} {
regexp { rel="nofollow">(.*?)</a>} $comments "" user
regexp {<span class="watch-comment-time">(.*?)</span>} $comments "" timeago
regexp {<div class="watch-comment-body">(.*?)</div>} $comments "" comment
set comment [string map {\n " " "<br>" ""} $comment]
regsub -all -- {\<[^\>]*\>|\t} $comment "" comment
regsub -all {\s+} $comment " " comment
set comment "\<$user [string trim $timeago]\> [string trim $comment]"
} else {
set comment ""
}
regsub -all -- {\<[^\>]*\>|\t} $title "" title
regsub -all -- {\<[^\>]*\>|\t} $description "" description
regsub -all -- {\<[^\>]*\>|\t} $views "" views
regsub -all -- {\<[^\>]*\>|\t} $rating "" rating
set rating [lindex [split $rating] 0]
set title "$relocation $title"
set title [string trim $title]
if {![string is digit -strict $views]} {
set views "no"
}
if {![string is digit -strict $rating]} {
set rating "no"
}
if {$comment eq ""} {
set comment "This video doesn't have any comments until now"
}
if {$description eq ""} {
set description "This video doesn't have any description"
}
set output [string map [list "<title>" $title "<author>" $author "<description>" $description "<views>" $views "<rating>" $rating "<comment>" $comment] $ourtube(output)]
return $output
}
# upvar #0 $token state
proc otLog {target string} {
global ourtube
if {![validchan $target]} {
putlog "$ourtube(name)\: $string"
} else {
putserv "PRIVMSG $target :$ourtube(name)\: $string"
}
}
bind dcc n ourtube communication::welcome
namespace eval communication {
# communication.tcl --
# This is a little library for eggdrop as internal use
# It is done to portablility - You cannot use it without a file.cgi in your
# http server. If you really want that, contact me.
variable version 1.0
variable feedback {http://www.eggdrop.es/cgi-bin/feedback.cgi}
variable update {http://www.eggdrop.es/cgi-bin/update.cgi}
proc welcome {hand ipx text} {
global ourtube
set arg [lindex [split $text] 0]
switch -- $arg {
"feedback" {
set contact [lindex [split $text] 1]
set message [join [lrange [split $text] 1 end]]
if {($contact eq "") || ($message eq "")} {
putdcc $ipx "$ourtube(projectName) - FeedBack"
putdcc $ipx "Thank you for tell what you think."
putdcc $ipx "This command sends to author an message with your suggestion, you are able to send one feedback per day (aprox)"
putdcc $ipx "Usage: .webfeedback <your email (put it if you may want a reply or conversation with author, if not, put anything)> <tell me in english or spanish what you want say>"
} else {
set result [[namespace current]::Feedback $contact $ourtube(projectName) $message]
if {$result eq ""} {
putdcc $ipx "The server responded nothing. Did you sent a previous feedback already?"
return
}
putdcc $ipx "The server responded:"
foreach line [split $result \n] {
putdcc $ipx $line
}
}
}
"update" {
set download [lindex [split $text] 1]
putdcc $ipx [join [lrange [split [[namespace current]::Update $ourtube(fileName) $ourtube(projectName) $ourtube(version) $download]] 1 end]]
}
default {
putdcc $ipx "You can use '.ourtube update' to verify the last version and '.ourtube feedback' to send to author a suggestion"
}
}
}
proc Feedback {reporter projectName message} {
variable feedback
http::config -useragent "$reporter $projectName"
set token [http::geturl "$feedback\?suggest=[http::formatQuery $message]" -timeout 4000]
set data [http::data $token]
http::cleanup $token
return $data
}
proc Update {fileName projectName version {download ""}} {
variable update
set fs [open $fileName]
set data [read $fs]
close $fs
set md5 [md5 $data]
set query [http::formatQuery project $projectName version $version md5 $md5 download $download]
set token [http::geturl "$update\?$query" -timeout 4000]
set data [http::data $token]
http::cleanup $token
set result ""
set info ""
set url ""
regexp {<!-- result -->(.*?)<!-- /result -->} $data "" result
regexp {<!-- info -->(.*?)<!-- /info -->} $data "" info
if {($download ne "") && ($download ne "no") && ($result == 1)} {
regexp {<!-- data -->(.*?)<!-- /data -->} $data "" url
if {![regexp -nocase {^(http://)?([^/:]+)(:([0-9]+))?(/.*)?$} $url]} {
return "0 Invalid URL target file link."
}
set token [http::geturl $url -binary 1 -timeout 4000]
set fileData [http::data $token]
file rename -force -- $fileName $fileName\.bak
set fs [open $fileName w]
puts -nonewline $fs $fileData
close $fs
catch {source $fileName}
set info "$projectName was (purged) downloaded and sourced succesfully, now you are using the lastest version available. There is a backup in $fileName\.bak"
}
return "$result $info"
}
}
if {![info exists ourtube(loaded)]} {
if {$ourtube(autoupdate) == "1"} {
set ourtube(status) [communication::Update $ourtube(fileName) $ourtube(projectName) $ourtube(version) $ourtube(autoupdate)]
set ourtube(result) [lindex [split $ourtube(status)] 0]
set ourtube(info) [join [lrange [split $ourtube(status)] 1 end]]
otLog log $ourtube(info)
}
}
otLog log "[file tail $ourtube(fileName)] $ourtube(version) Loaded - by $ourtube(author) (Feedback and update commands available, type .ourtube in partyline)"
set ourtube(loaded) 1
|
|
|
| Back to top |
|
 |
pogue Voice

Joined: 17 May 2009 Posts: 28
|
Posted: Sat Nov 07, 2009 12:10 pm Post subject: |
|
|
| anotheregglover wrote: | youtube <title> tags are now multiline causing the fail.
I set it to use the meta tag instead and made some other fixes |
Thank you, that fixed the problem!
However, I still can't get it to properly display the number of views, ratings, or a description - although the last comment works properly. I went back in and added back in speechles' modifications and still no change. The !youtube search function doesn't appear to do anything either.
Did Youtube change their meta tags? I am not fluent in TCL, so I'm getting pretty lost, but the things I am noticing some variation in the regexp when it is pulling the data off the youtube site. I'm assuming it is getting one part for the !youtube search feature and the other for when a URL is pasted into the channel. But, they are different for each.
Note: I am using the line numbers from the appended code posted by anotheregglover above. I am using the Youtube video Afroman - Because I Got High (Uncensored) as an example for the Youtube source.
- Line 225 & 349 both seem to try grab the description.
- Line 228 & 351 appear to be both for the ratings.
- Line 230 & 350 appear to both be getting the view count
Description
Line 225: | Code: | | regexp {class="video-description">(.*?)</div>} $line "" description |
Line 349: | Code: | | regexp {<meta name=\"description\" content=\"(.*?)\">.*} $data "" description |
Youtube source: | Code: | | <meta name="description" content="Afroman - Because I Got High (Uncensored)"> |
Ratings
Line 228: | Code: | | regexp {<button class="master-sprite ratingL ratingL-(.*?)"} $line "" rating |
Line 351: | Code: | | regexp {<div id=\"defaultRatingMessage\">(.*?)</span>.*} $data "" rating |
Youtube source: | Code: | | <div id="defaultRatingMessage"><span class="smallText">36,010 ratings</span> |
Views
Line 230: | Code: | | regexp {class="watch-view-count">(.*?)</span>} $line "" views |
Line 350: | Code: | | regexp {class="watch-view-count">(.*?)</span>} $line "" views |
Youtube source: | Code: | | <span id="watch-view-count">12,163,389</span> |
Currently, the output of the script when pasting the URL for the afroman video within the eggdrop console looks like this:
| Code: | [12:37] ourTube: Getting http://www.youtube.com/watch?v=305vRNoofr8 ... from pogue on #bodybuilding.com
[12:37] ourTube: Afroman - Because I Got High (Uncensored). (by ssabmudaru) no views, no rating. Last comment: <woody0900 (40 minutes ago)> had afeeling. lol... |
But, as you can see, only the regexp for the view count is the same, yet it still doesn't appear to be displaying the view count at all and defaults to "no views". So, it appears to me (at least from my point of view) that there are some errors in this script in the way that it is grabbing data off of the Youtube page that need to be addressed.
Any additional help is appreciated! Thanks,
pogue _________________ Helpful Tools:
|
|
| Back to top |
|
 |
Joose Voice
Joined: 13 Nov 2009 Posts: 1
|
Posted: Fri Nov 13, 2009 6:55 pm Post subject: |
|
|
| anotheregglover wrote: | youtube <title> tags are now multiline causing the fail.
I set it to use the meta tag instead and made some other fixes
|
Or just add this:
| Code: | Add this line in to the script:
set title [string map {"\n" " "} $title]
Before these lines:
*snip*
set title [string map {"\n" " "} $title]
set title "$relocation $title"
set title [string trim $title]
*snip*
|
|
|
| Back to top |
|
 |
vladdeh Voice
Joined: 23 Mar 2011 Posts: 33
|
Posted: Fri Nov 25, 2011 2:15 pm Post subject: |
|
|
| Script not pulling views anymore or comments, any fixes?:p |
|
| Back to top |
|
 |
username Op

Joined: 06 Oct 2005 Posts: 196 Location: Russian Federation, Podolsk
|
Posted: Sun Nov 27, 2011 1:09 pm Post subject: |
|
|
Try this. _________________ Архив TCL скриптов для ботов Eggdrop/Windrop:
http://egghelp.ru/ |
|
| Back to top |
|
 |
Nash Voice
Joined: 29 Jul 2012 Posts: 6
|
Posted: Mon Jul 30, 2012 3:10 pm Post subject: |
|
|
Sorry for bumping this old thread but is there an updated version of this script available?
So far i'ved tried:
youtubeURL
youtube_title
youtube_checker
ourtube
etube
and (if they even work), they only show the name of the youtube video.
No length, views, author .. etc
It's getting a bit frustrating trying to find a working youtube script with "some" options in it.
Halp!  |
|
| Back to top |
|
 |
username Op

Joined: 06 Oct 2005 Posts: 196 Location: Russian Federation, Podolsk
|
Posted: Tue Jul 31, 2012 2:45 am Post subject: |
|
|
etube.tcl works fine:
| Quote: | [10:44:27] rp-f http://www.youtube.com/watch?v=VuteWrK4Nr0
[10:44:29] lamestbot Чайка ест голубя/Seagull eats pigeon (22) by Redving(24.09.2011) Cat: Животные, Tags: чайка, голубь, съела, seagull, dove, eats, pigeon, Views: 1912. Likes/Dislikes: 8/2.
[10:44:29] lamestbot На площади Сан-Марко в Венеции./San-Marco square in Venice.
[10:44:29] lamestbot Top comment: Ooooh,? how romantic!!! by ( 8 ч. назад ). (39.66ms.) |
_________________ Архив TCL скриптов для ботов Eggdrop/Windrop:
http://egghelp.ru/ |
|
| Back to top |
|
 |
username Op

Joined: 06 Oct 2005 Posts: 196 Location: Russian Federation, Podolsk
|
Posted: Tue Jul 31, 2012 9:59 am Post subject: |
|
|
And dont forget about .chanset #chan +etube _________________ Архив TCL скриптов для ботов Eggdrop/Windrop:
http://egghelp.ru/ |
|
| Back to top |
|
 |
|
|
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
|
|