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.
k
koom
Voice
Posts: 22
Joined: Sat Jul 30, 2005 9:23 pm

Tv.com tv show info grabber?

Post by koom »

Hey all,

I'm looking for a script to use in my channel to find out the info of a tv show. for example :

When i trigger the trigger, !TVinfo 24 in this case (24 obviously being the tv show)

http://www.tv.com/24/show/3866/summary.html
Genre: : Action/Adventure , Drama
Tagline: Counter-Terrorism agent Jack Bauer (Kiefer Sutherland) fights the bad guys of the world, one day at a time.
Runtime: 60 minutes
Rating: 9.0 Superb

I would look into doing this myself, but i am a complete noob at tcl scripting..

Hopefully someone can help me out :)
Thanks alot,
Koom
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

that someone could only be greenbear ;) check out his tv.com script in the other forum and hope he'll be bored enough, having nothing better to do, to implement what you want
k
koom
Voice
Posts: 22
Joined: Sat Jul 30, 2005 9:23 pm

Post by koom »

thanks demond, will ask him now :)
t
theauth0r
Voice
Posts: 6
Joined: Thu Aug 04, 2005 5:01 pm

Post by theauth0r »

any update on this topic..
I wouldnt mind having this script if possible


:)

thx
k
koom
Voice
Posts: 22
Joined: Sat Jul 30, 2005 9:23 pm

Post by koom »

i completely forgot to ask him! will do now
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

Sure, I wouldnt mind doing this.. The only problem is I dont see any of that info you asked for on that tv.com page.
A page search returns nothing on both genre, tagline and runtime.
w
w0lfstar
Voice
Posts: 22
Joined: Fri May 20, 2005 9:26 am

Post by w0lfstar »

i think a script that tells latest and next episode is what people would like more, since all the scripts that are available are outdated because of tv.com changes.

example:

Joe: !tv 24
Bot: Tv Info for: 24 (Action/Adventure , Drama)
Bot: Latest: S04E24 - Day 4: 6:00 A.M.-7:00 A.M. on 5/23/2005
Bot: Next: Unknown.

Joe: !tv desperate housewives
Bot: Tv Info for: Desperate Housewives (Drama , Comedy)
Bot: Latest: S01E23 - One Wonderful Day on 5/22/2005
Bot: Next: S02E01 - Season 2 Premiere (TBA) on 9/25/2005

etc..what do you think? I'm not sure if epguides.com is more easy, but such a script might be wanted by many :)

greets wolfy.
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

ok, I think this is somewhat what koom had in mind...

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]
 foreach line [split $data \n] {
   if [regexp {<title>(.*).TV Show} $line . show] {
     putserv "PRIVMSG $target :Show: $show"
   }
   if [string match -noc "*Airs:*" $line] {
     regsub -all {<(.|\n)*?>} $line {} airs
     putserv "PRIVMSG $target :[concat [join $airs]]"
   }
   if [string match -noc "*Status:*" $line] {
     regsub -all {<(.|\n)*?>} $line {} status
     putserv "PRIVMSG $target :[concat [join $status]]"
   }
   if [string match -noc "*Premiered*" $line] {
     regsub -all {<(.|\n)*?>} $line {} premiered
     putserv "PRIVMSG $target :[concat [join $premiered]]"
   }
   if [string match -noc "*Show Category:*" $line] {
     regsub -all {<(.|\n)*?>} $line {} category
     putserv "PRIVMSG $target :[concat [join $category]]"
   }
   if [string match -noc "*Full Summary*" $line] {
     regsub -all {<(.|\n)*?>} $line {} summary
     regexp {(.*) Full Summary} $summary . summary
     putserv "PRIVMSG $target :Summary: [concat [join $summary]]"
   }
 }
 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
}
EDIT: Added option for public/private replies.
Last edited by greenbear on Sat Aug 13, 2005 12:19 am, edited 3 times in total.
k
koom
Voice
Posts: 22
Joined: Sat Jul 30, 2005 9:23 pm

Post by koom »

thanks for your help greenbear, really appreciated :)

i just installed the script, but when i went to enable it by:
.chanset #koom +tv
this didnt work. errored with

chanset #koom +tv
::18:20:: -BTC|Bot- Error trying to set +tv for #koom, invalid mode.
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

oops, seems like I forgot to define it.. it's fixed now
k
koom
Voice
Posts: 22
Joined: Sat Jul 30, 2005 9:23 pm

Post by koom »

wow thanks for the fast reply ;)
seems the other error is gone now, but another one has appeared (as what happens always with tcl scripting, hehe)

::18:36:: -BTC|Bot- [03:07] Tcl error [pub:info.tv.com]: invalid command name "egghttp:geturl"

Thanks alot,
koom
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

load egghttp.tcl before this one
k
koom
Voice
Posts: 22
Joined: Sat Jul 30, 2005 9:23 pm

Post by koom »

sorry, but where can i find this egghttp.tcl? (like i said before, noob at this kinda stuff, :oops: :oops: )
k
koom
Voice
Posts: 22
Joined: Sat Jul 30, 2005 9:23 pm

Post by koom »

ah dont worry about it, a quick search found it,now to test it :)
k
koom
Voice
Posts: 22
Joined: Sat Jul 30, 2005 9:23 pm

Post by koom »

Yay, script works great, thanks alot greenbear :)

Also, anyway to make it so that script notices people instead of spamming the channel?

Other then that, it works like a charm :D

also, is it possible for it to display the link last?

Thanks :)
Koom
Post Reply