XML::RSS::FOXSports - An XML::RSS::Parser subclass for parsing Foxsports.com RSS feeds.
#!/usr/bin/perl -w use strict; use XML::RSS::FOXSports; my $fsp = new XML::RSS::FOXSports; my $soc_feed = $fsp->parse_soccer; my $mlb_feed = $fsp->parse_mlb; print "item count: ", $soc_feed->item_count()."\n\n"; foreach my $i ( $soc_feed->items ) { map { print $_->name.": ".$_->value."\n" } $i->children; print "\n"; } #-- retrieve values for attribution my $img = $mlb_feed->image(); print $img->children('title')->value, "\n"; print $img->children('url')->value, "\n"; print $img->children('link')->value, "\n"; print $img->children('width')->value, "\n"; print $img->children('height')->value,"\n"; my @leagues = $fsp->get_available_leagues my @teams = $fsp->get_available_teams
#!/usr/bin/perl -w use strict; use XML::RSS::FOXSports; my $fsp = XML::RSS::FOXSports->new; my $glxy_feed = $fsp->parse_mls_team('galaxy'); #-- output some values my $glxy_title = $glxy_feed->query('/channel/title'); print $glxy_title->text_content,"\n"; print $glxy_feed->item_count, "\n"; foreach my $i ( $glxy_feed->query('//item') ) { my $node = $i->query('title'); print ' ', $node->text_content, "\n"; }
XML::RSS::FOXSports is an XML::RSS::Parser subclass providing an object oriented interface to FOXSports.com RSS 2.0 feeds.
XML::RSS::FOXSports provides retrieval and parsing functionality for FOXSports.com's RSS 2.0 feeds. It is a subclass of Timothy Appnel's XML::RSS::Parser. This module has an object oriented interface and creates a hidden HTTP client with LWP::UserAgent for feed retrieval. Each XML::RSS::FOXSports parser object encapsulates its own XML::RSS::FOXSports::Utils object unless the NoUtil option is passed to the constructor method.
NoUtil
The naming conventions used in this module (e.g., method and team names) have followed those from FOXSports.com's website as closely as possible. However, some method and team names have additional alternatives or mnemonics where it seems intuitive.
Excepting the team parsing methods, all parsing methods name the feed they are retrieving. For example the parse_soccer and parse_mlb methods parse the Soccer and MLB feeds respectively.
This module was originally written for and used with XML::RSS::Parser Version 2.15. It has been modified for compatibility with XML::RSS::Parser Version 4.0 and has worked successfully with both versions. However, be aware that it was intended for use with Version 2.15 and testing with version 4.0 has been relatively limited.
FOXSports.com requires attribution for use of their content.
From FOXSports.com website: "The feeds are free of charge to use for individuals and non-profit organizations for non-commercial use. Attribution (included in each feed) is required."
Please see the FOXSports.com RSS website for terms of use: http://msn.foxsports.com/story/2005035
The following methods are provided in this package in addition to those inherited from XML::RSS::Parser.
All parse_* methods retrieve the named RSS feed over HTTP, parse the feed, and return a XML::RSS::Parser::Feed object. A die is thrown if a parse error occurs.
Constructor method. The folowing options are allowed.
Prevents creation of the XML::RSS::FOXSports::Utils object. Access to its methods via a XML::RSS::FOXSports parser object will not be available. See Below.
These methods retrieve and parse the named RSS headline feed data.
parse_baseball is an equivalant mnemonic
parse_football is an equivalant mnemonic
parse_college_football is an equivalant mnemonic
parse_basketball is an equivalant mnemonic
parse_hockey is an equivalant mnemonic
parse_college_basketball is an equivalant mnemonic
These methods retrieve and parse the named RSS video feed data.
parse_baseball_video is an equivalant mnemonic
parse_football_video is an equivalant mnemonic
parse_college_football_video is an equivalant mnemonic
parse_basketball_video is an equivalant mnemonic
parse_hockey_video is an equivalant mnemonic
parse_college_basketball_video is an equivalant mnemonic
These methods retrieve and parse the RSS feed for a given sports team. See the README file for the list of available league and team values. Also see below
$league can be one of MLS, SOCCER, MLB, NFL, NBA, or NHL. $team must be an existing team name within the given $league. See the README file for the complete list of available team values. Also see below.
Returns the current timeout value of the wrapped HTTP client requesting the RSS feed.
Sets the timeout value of the wrapped HTTP client requesting the RSS feed.
These methods will not be available if the NoUtil option is passed to the constructor method.
Returns a list of all headline and video feed names this package parses
Returns a list of headline feed names this package parses
Returns a list of video feed names this package parses
Returns a list of league names that can be passed to the parse_team method
Returns a list of all team names that can be passed to the parse_team method
Returns a hash reference of teams names indexed by league name
Returns the url of the named feed
Returns the urls for headline and video feeds
The following league and team options are currently provided.
Usage example: my $giants_feed = $fsp->parse_team('MLB', 'giants');
my $giants_feed = $fsp->parse_team('MLB', 'giants');
MLS los_angeles dc_united columbus chicago san_jose fc_dallas real_salt_lake colorado metrostars new_england kansas_city chivas_usa MLB angels astros athletics blue_jays braves brewers cardinals cubs devil_rays diamondbacks dodgers giants indians mariners marlins mets nationals orioles padres phillies pirates rangers red_sox reds rockies royals tigers twins white_sox yankees NFL forty_niners bears bengals bills broncos browns buccaneers cardinals chargers chiefs colts cowboys dolphins eagles falcons giants jaguars jets lions packers panthers patriots raiders rams ravens redskins saints seahawks steelers texans titans vikings NBA sixers bobcats bucks bulls cavaliers celtics clippers grizzlies hawks heat hornets jazz kings knicks lakers magic mavericks nets nuggets pacers pistons raptors rockets spurs suns supersonics timberwolves trail_blazers warriors wizards NHL avalanche blackhawks blue_jackets blues bruins canadiens canucks capitals coyotes devils flames flyers hurricanes islanders kings lightning maple_leafs mighty_ducks oilers panthers penguins predators rangers red wings sabres senators sharks stars thrashers wild
XML::Parser XML::RSS::Parser 2.15 Class::XPath
XML::RSS::Parser::Element, XML::RSS::Parser::Feed, XML::SAX, XML::Elemental, Class::ErrorHandler
Brian Perez <perez@cpan.org>
Copyright (c) Brian Perez 2005. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
Expected text after =item, not a bullet
To install XML::RSS::FOXSports, copy and paste the appropriate command in to your terminal.
cpanm
cpanm XML::RSS::FOXSports
CPAN shell
perl -MCPAN -e shell install XML::RSS::FOXSports
For more information on module installation, please visit the detailed CPAN module installation guide.