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.

Tv.com tv show info grabber?

Support & discussion of released scripts, and announcements of new releases.
J
JAFO
Voice
Posts: 19
Joined: Thu Oct 13, 2005 1:18 pm

Post by JAFO »

A friend of mine did a lil work on the script

Code: Select all

###
# Parse show info from tv.com

# Enable with .chanset #channel +tvi

# [0/1] public or private reply's (public 0, private 1)
set tvreply 0

# offset to EST
# 6 hours makes sense for CET (Europe)
set tvoffset 6

if ![info exists egghttp(version)] {
  putlog "egghttp.tcl was NOT successfully loaded."
}

setudef flag tvi

bind pub - !tvinfo pub:info.tv.com

proc pub:info.tv.com {nick uhost hand chan text} {
  if ![channel get $chan tvi] return
  if {$::tvreply} {set target $nick} {set target $chan}
  if {$text==""} {putserv "PRIVMSG $target :Usage: $::lastbind <show>"; return}
  set search [join [lrange [split $text] 0 e] {+}]
  set d [date:offset [clock seconds] %m%d%y]
  set url "http://www.tv.com/search.php?type=11&stype=program&qs=$search&search=Search/"
  set sock [egghttp:geturl $url [list findrealurl:tv.com $target] -headers "Cookie: tv_promo_$d=1"]
}

proc findrealurl:tv.com {target sock} {
 set data [egghttp:data $sock]
 egghttp:cleanup $sock

 foreach line [split $data \n] {
  if [string match -noc "*returned no results*" $line] {
    putserv "PRIVMSG $target :Unknown show."
    return
  }
  if [string match -noc *www.tv.com*show*summary.html* $line] {
    regexp -nocase {(http://)[^\"]+} $line url
    set d [date:offset [clock seconds] %m%d%y]
    set s [egghttp:geturl $url [list parseinfo:tv.com $target $url] -headers "Cookie: tv_promo_$d=1"]
    return
  }
 }
}

proc parseinfo:tv.com {target url sock} {
 set data [egghttp:data $sock]
 egghttp:cleanup $sock

 set data [string map {"\n" "" "</div>" "</div>\n" "<br />" "<br />\n"} $data]
 set dV 0
 foreach line [split $data \n] {
   if [regexp {<title>(.*).TV Show} $line . show] {
     putserv "PRIVMSG $target :Show: $show"
   }
   if [string match -nocase "*Airs:*" $line] {
     regsub -all {<(.|\n)*?>} $line {} airs
     putserv "PRIVMSG $target :[concat [join $airs]]"
   }
   if [string match -nocase "*Status:*" $line] {
     regsub -all {<(.|\n)*?>} $line {} status
     putserv "PRIVMSG $target :[concat [join $status]]"
   }
   if [string match -nocase "*Premiered*" $line] {
     regsub -all {<(.|\n)*?>} $line {} premiered
     putserv "PRIVMSG $target :[concat [join $premiered]]"
   }
   if [string match -nocase "*Show Category:*" $line] {
     regsub -all {<(.|\n)*?>} $line {} category
     putserv "PRIVMSG $target :[concat [join $category]]"
   }
   if [string match -nocase "*, 200*" $line] {
     regsub -all {<(.|\n)*?>} $line {} Dates
     if ![string match -nocase "*Premiered*" $line] {
       if {$dV == 0} {
         putserv "PRIVMSG $target :Next Air Date: [concat [join $Dates]]"
       } else {
         putserv "PRIVMSG $target :Last Air Date: [concat [join $Dates]]"
       }
       incr dV
     }
   }
 }
 putserv "PRIVMSG $target :URL: $url"
}

proc date:offset {epox arg} {
 set t [expr $epox-((60*60)*$::tvoffset)]
 set w [clock format $t -format $arg]
 return $w
}

.chanset changed also from +tv >>> +tvi ( coz i allready used +tv in tv.com.tcl v0.2 by greenbear )

Might contain unlogical data , but it works :)

Code: Select all

<~me> !tvinfo 24
<@MyBot> Show: 24
<@MyBot> Airs: Monday 9:00 PM on FOX (60 mins)
<@MyBot> Status: Returning Series
<@MyBot> Premiered November 6, 2001
<@MyBot> Show Category: Action/Adventure , Drama
<@MyBot> Next Air Date: Sunday January 15, 2006
<@MyBot> Last Air Date: Monday May 23, 2005
<@MyBot> URL: http://www.tv.com/24/show/3866/summary.html?q=24
Njoy :D
I
InsideTheBox
Voice
Posts: 1
Joined: Mon Oct 17, 2005 5:56 pm

Post by InsideTheBox »

<luciverse> !tvinfo The Ultimate Fighter

Tcl error [pub.tvinfo.com]: unknown channel command: should be one of: add, set, info, remove

:cry:
T
Taz
Voice
Posts: 9
Joined: Sun Oct 23, 2005 10:18 pm

Thanx

Post by Taz »

Thanx to you and your friend JAFO. This is exactly what a lot of us wanted.
p
pEeDy
Voice
Posts: 2
Joined: Tue Nov 01, 2005 7:51 pm

Post by pEeDy »

Where do I type this '.chanset #channel +tvi' ?? I tried in a query, a private message and in channel... DCC chat doesn't work... help me please? :(

Edit; got it :D
For other noobs:
You have to put it in your telnet window :)
And you have to load egghttp.tcl too, before you load this tcl script.
o
outthere
Voice
Posts: 33
Joined: Sat Nov 26, 2005 7:25 pm

error

Post by outthere »

wow.. i have been looking for something like this... thx

i am getting an error though when i do !tvinfo ep

Tcl error [pub:info.tv.com]: invalid command name "Â "

i checked egghttp and tvi tcl and cant find that text anywhere..
i think it might be a simple problem a noob like me doesnt know anything about.. any help would be greatly appreciated...

thx :?
F
FriedCPU
Voice
Posts: 1
Joined: Sat Dec 03, 2005 12:11 am

Some changes

Post by FriedCPU »

Hey
I like the script, very nice :)
I made a few changes.
1) the way the adjusted script posted above grabs the next/prev date information, it done it by match 200*, meaning shows only in the year 2000+
2) for shows that have ended, it now says "first aired, last aired" instead of "next, last" which makes more sense.

note: i changed it back to +tv not +tvi, sorry if this is a problem for some people

Code: Select all

###
# Parse show info from tv.com

# Enable with .chanset #channel +tv

# [0/1] public or private reply's (public 0, private 1)
set tvreply 0

# offset to EST
# 6 hours makes sense for CET (Europe)
set tvoffset 6

if ![info exists egghttp(version)] {
    putlog "egghttp.tcl was NOT successfully loaded."
}

setudef flag tv

bind pub - !tvinfo pub:info.tv.com

proc pub:info.tv.com {nick uhost hand chan text} {
    if ![channel get $chan tv] return
    if {$::tvreply} {set target $nick} {set target $chan}
    if {$text==""} {putserv "PRIVMSG $target :Usage: $::lastbind <show>"; return}
    set search [join [lrange [split $text] 0 e] {+}]
    set d [date:offset [clock seconds] %m%d%y]
    set url "http://www.tv.com/search.php?type=11&stype=program&qs=$search&search=Search/"
    set sock [egghttp:geturl $url [list findrealurl:tv.com $target] -headers "Cookie: tv_promo_$d=1"]
}

proc findrealurl:tv.com {target sock} {
    set data [egghttp:data $sock]
    egghttp:cleanup $sock
    
    foreach line [split $data \n] {
        if [string match -noc "*returned no results*" $line] {
            putserv "PRIVMSG $target :Unknown show."
            return
        }
        if [string match -noc *www.tv.com*show*summary.html* $line] {
            regexp -nocase {(http://)[^\"]+} $line url
            set d [date:offset [clock seconds] %m%d%y]
            set s [egghttp:geturl $url [list parseinfo:tv.com $target $url] -headers "Cookie: tv_promo_$d=1"]
            return
        }
    }
}

proc parseinfo:tv.com {target url sock} {
    set data [egghttp:data $sock]
    egghttp:cleanup $sock
    
    set data [string map {"\n" "" "</div>" "</div>\n" "<br />" "<br />\n"} $data]
    set dV 0
    set ended "0"
    foreach line [split $data \n] {
        if [regexp {<title>(.*).TV Show} $line . show] {
            putserv "PRIVMSG $target :Show: $show"
        }
        if [string match -nocase "*Airs:*" $line] {
            regsub -all {<(.|\n)*?>} $line {} airs
            putserv "PRIVMSG $target :[concat [join $airs]]"
        }
        if [string match -nocase "*Status:*" $line] {
            regsub -all {<(.|\n)*?>} $line {} status
            if {[concat [join $status]] == "Status: Ended"} { set ended "1" }
            putserv "PRIVMSG $target :[concat [join $status]]"
        }
        if [string match -nocase "*Premiered*" $line] {
            regsub -all {<(.|\n)*?>} $line {} premiered
            putserv "PRIVMSG $target :[concat [join $premiered]]"
        }
        if [string match -nocase "*Show Category:*" $line] {
            regsub -all {<(.|\n)*?>} $line {} category
            putserv "PRIVMSG $target :[concat [join $category]]"
        }
        if [string match -nocase "*f-bold f-medium f-red mb-5*" $line] {
            regsub -all {<(.|\n)*?>} $line {} Dates
            if ![string match -nocase "*Premiered*" $line] {
                if {$dV == 0} {
                    if {$ended == "1"} {
                        putserv "PRIVMSG $target :First Air Date: [concat [join $Dates]]"
                    } else {
                        putserv "PRIVMSG $target :Next Air Date: [concat [join $Dates]]"
                    }
                } else {
                    putserv "PRIVMSG $target :Last Air Date: [concat [join $Dates]]"
                }
                incr dV
            }
        }
    }
    putserv "PRIVMSG $target :URL: $url"
}

proc date:offset {epox arg} {
    set t [expr $epox-((60*60)*$::tvoffset)]
    set w [clock format $t -format $arg]
    return $w
}
J
JAFO
Voice
Posts: 19
Joined: Thu Oct 13, 2005 1:18 pm

Post by JAFO »

thx for updating :)
s
semaja2
Voice
Posts: 1
Joined: Sat Mar 18, 2006 10:39 pm

Post by semaja2 »

hey im trying to get this script to work but when i try to do !tv stargate it doesnt say anything, any ideas?

UPDATE: i now get this error in the windrop logs unexpected integer but got "1142703097.0"
h
hpostiga
Voice
Posts: 3
Joined: Thu Dec 29, 2005 12:13 am

Post by hpostiga »

the script don't work now :s

[00:53:05] <@H_P0STiGa> !tvinfo the o.c
[00:53:30] <@Up2yoU-Team> URL: http://www.tv.com/talk-show/genre/13/summary.html
B
Bman
Voice
Posts: 9
Joined: Tue Apr 04, 2006 9:50 pm

Post by Bman »

[06:42:38PM] <@|Bman|> !tvinfo 24
[06:42:43PM] -CIA- URL: http://www.tv.com/talk-show/genre/13/summary.html

yeah i get the same errors
s
silver
Voice
Posts: 8
Joined: Tue Apr 18, 2006 11:09 pm

Post by silver »

jup, tv.com changed layout/scripts again :s

i started on modding it to work again but blah.. too lazy :>
here's how far i was ;)

change
set url "http://www.tv.com/search.php?type=11&st ... ch=Search/"
to
set url "http://www.tv.com/search.php?type=11&st ... qs=$search"

change
if [string match -noc *www.tv.com*show*summary.html* $line] {
to
if [string match -noc *www.tv.com*\/show\/*summary.html* $line] {
(cuz there's multiple http://www.tv.com/shows/blabla/summarty.html links in the html now)

change
if [regexp {<title>(.*).TV Show} $line . show] {
to
if [regexp {<title>(.*).TV Show - } $line . show] {

etc,etc :)

its a bit harder to parse now... also it seems like there's some flood protection now as search.php sometimes returns empty page, could be wrong tho

maybe someone else wants to finish? :D
s
skipyy
Voice
Posts: 3
Joined: Sat Apr 22, 2006 12:56 pm

Post by skipyy »

can some1 please finish this script? :X
only the next episode and last episode are important
J
JAFO
Voice
Posts: 19
Joined: Thu Oct 13, 2005 1:18 pm

Post by JAFO »

try the tvrage version. Should be around here somewhere ;)

http://forum.egghelp.org/viewtopic.php?t=11208

there it is ,
S
Sparky66
Voice
Posts: 4
Joined: Mon Jun 12, 2006 9:32 am

Can anyone get this to work please

Post by Sparky66 »

Looking for this script to be fixed if anyone can help
##
# Parse show info from tv.com

# Enable with .chanset #channel +tv

# [0/1] public or private reply's (public 0, private 1)
set tvreply 0

# offset to EST
# 6 hours makes sense for CET (Europe)
set tvoffset 6

if ![info exists egghttp(version)] {
putlog "egghttp.tcl was NOT successfully loaded."
}

setudef flag tv

bind pub - !tvinfo pub:info.tv.com

proc pub:info.tv.com {nick uhost hand chan text} {
if ![channel get $chan tv] return
if {$::tvreply} {set target $nick} {set target $chan}
if {$text==""} {putserv "PRIVMSG $target :Usage: $::lastbind <show>"; return}
set search [join [lrange [split $text] 0 e] {+}]
set d [date:offset [clock seconds] %m%d%y]
set url "http://www.tv.com/search.php?type=11&st ... qs=$search"
set sock [egghttp:geturl $url [list findrealurl:tv.com $target] -headers "Cookie: tv_promo_$d=1"]
}

proc findrealurl:tv.com {target sock} {
set data [egghttp:data $sock]
egghttp:cleanup $sock

foreach line [split $data \n] {
if [string match -noc "*returned no results*" $line] {
putserv "PRIVMSG $target :Unknown show."
return
}
if [string match -noc *www.tv.com*\/show\/*summary.html* $line] {
regexp -nocase {(http://)[^\"]+} $line url
set d [date:offset [clock seconds] %m%d%y]
set s [egghttp:geturl $url [list parseinfo:tv.com $target $url] -headers "Cookie: tv_promo_$d=1"]
return
}
}
}

proc parseinfo:tv.com {target url sock} {
set data [egghttp:data $sock]
egghttp:cleanup $sock

set data [string map {"\n" "" "</div>" "</div>\n" "<br />" "<br />\n"} $data]
set dV 0
set ended "0"
foreach line [split $data \n] {
if [regexp {<title>(.*).TV Show - } $line . show] {
putserv "PRIVMSG $target :Show: $show"
}
if [string match -nocase "*Airs:*" $line] {
regsub -all {<(.|\n)*?>} $line {} airs
putserv "PRIVMSG $target :[concat [join $airs]]"
}
if [string match -nocase "*Status:*" $line] {
regsub -all {<(.|\n)*?>} $line {} status
if {[concat [join $status]] == "Status: Ended"} { set ended "1" }
putserv "PRIVMSG $target :[concat [join $status]]"
}
if [string match -nocase "*Premiered*" $line] {
regsub -all {<(.|\n)*?>} $line {} premiered
putserv "PRIVMSG $target :[concat [join $premiered]]"
}
if [string match -nocase "*Show Category:*" $line] {
regsub -all {<(.|\n)*?>} $line {} category
putserv "PRIVMSG $target :[concat [join $category]]"
}
if [string match -nocase "*f-bold f-medium f-red mb-5*" $line] {
regsub -all {<(.|\n)*?>} $line {} Dates
if ![string match -nocase "*Premiered*" $line] {
if {$dV == 0} {
if {$ended == "1"} {
putserv "PRIVMSG $target :First Air Date: [concat [join $Dates]]"
} else {
putserv "PRIVMSG $target :Next Air Date: [concat [join $Dates]]"
}
} else {
putserv "PRIVMSG $target :Last Air Date: [concat [join $Dates]]"
}
incr dV
}
}
}
putserv "PRIVMSG $target :URL: $url"
}

proc date:offset {epox arg} {
set t [expr $epox-((60*60)*$::tvoffset)]
set w [clock format $t -format $arg]
return $w
}
this is what its saying
[2:29pm] <+didibot> Show: Lost
[2:29pm] <+didibot> Airs Next: ABC at Wednesday 8:00 PM (60 min.) Status: Returning Series   
Premiered: September 22, 2004
[2:29pm] <+didibot> Airs Next: ABC at Wednesday 8:00 PM (60 min.) Status: Returning Series   
Premiered: September 22, 2004
[2:29pm] <+didibot> URL: http://www.tv.com/lost/show/24313/summa ... sults;imag
e;0
Post Reply