Mingus Iamblichus has asked for the wisdom of the Perl Monks concerning the following question:
Yo! I just got this script but I can't quite get it to work. I am unclear on the usage at the command line. I am looking for theaters in the 95501 area code and i believe 392 is the theater number. Is the usage 'theater_rss.pl <392>' or 'theater_rss.pl 392'? Any disecction of this code would be helpful. Ideally. i need my hand held. Any one got the time to give me a step-by-step? Thanx.
#!/usr/bin/perl # theater_rss.pl #Accepts a Yahoo! Movies theater ID and prints # an RSS feed of currently playing movies. # Usage: theater_rss.pl <theater_ID> # # You can find theater IDs at Yahoo! Movies # at http://movies.yahoo.com/ use strict; use XML::RSS::SimpleGen; # Grab the incoming theater ID my $tid = join(' ', @ARGV) or die "Usage: theater_rss.pl <theater_ID>\ +n"; my $theater_title = "My favorite theater"; # Set the theater schedule URL my $url = "http://acid1.oa.yahoo.com/mbl/mov/tdet?tid=$tid"; # Download the schedule page my $content = get_url($url); # Find the theater name if ($content =~ m!<dl><dt>(.*?)</dt>!sg) { $theater_title = $1; } # Start the RSS Feed rss_new($url, "$theater_title Schedule"); rss_language('en'); rss_webmaster('insert your email address'); rss_daily(); # Set the regular expression to find data my $regex = '<table.*?>.*?mid=(.*?)">(.*?)</a></td>.*?'; $regex .= '<td>(.*?)</td>.*?</table>'; # Loop through the HTML, grabbing elements while ($content =~ m!$regex!sg) { # rss_item accepts url, title, description. my $url = "http://movies.yahoo.com/shop?d=hv&cf=info&id=$1"; rss_item($url, $2, $3); } # Warn if nothing was found die "No items in this content?! {{\n$_\n}}\nAborting" unless rss_item_count(); # Save the rss file as <theater_ID>.rss rss_save("$tid.rss"); exit;
Edited by planetscape - added code tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Stripping Movie Showtimes from a text file and inserting them into a mysql DB
by planetscape (Chancellor) on Apr 08, 2006 at 17:05 UTC | |
|
Re: Stripping Movie Showtimes from a text file and inserting them into a mysql DB
by McDarren (Abbot) on Apr 08, 2006 at 16:40 UTC | |
|
Re: Stripping Movie Showtimes from a text file and inserting them into a mysql DB
by graff (Chancellor) on Apr 08, 2006 at 16:45 UTC | |
|
Re: Stripping Movie Showtimes from a text file and inserting them into a mysql DB
by helphand (Pilgrim) on Apr 09, 2006 at 18:41 UTC | |
by Mingus Iamblichus (Initiate) on Apr 11, 2006 at 00:22 UTC |