Link | yahoo_news |
Author | Jason Huck |
Category | Utility |
Version | 8.x |
License | http://opensource.org/licenses/artistic-license.php |
Posted | 20 Jul 2006 |
Updated | 20 Jul 2006 |
More by this author... |
Given a valid feed name for Yahoo! News, returns the current feed data as an array of maps.
var('mynews') = yahoo_news('topstories'); iterate($mynews, local('i')); '' + #i->find('title') + '
\n'; '' + #i->find('pubDate')->format('%D') + '\n'; '' + #i->find('description') + '
\n'; /iterate;
Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
define_tag( 'news', -namespace='yahoo_', -req='feed', -priority='replace', -description='Retrieves the specified news feed from Yahoo! News.' ); local('out' = array); protect; local('data') = xml_tree(include_url('http://rss.news.yahoo.com/rss/' + #feed)); handle_error; return; /handle_error; /protect; local('nodes') = array( 'title', 'link', 'guid', 'pubDate', 'description', 'content', 'text', 'credit' ); iterate(#data->channel->item, local('i')); local('temp' = map); iterate(#nodes, local('n')); protect; local('raw') = decode_html(#i->getnode(#n)->contents); #raw->trim; #n == 'pubDate' ? #raw = date(#raw, -format='%a, %d %b %Y %H:%M:%S GMT'); // Thu, 20 Jul 2006 16:22:22 GMT #temp->insert(#n = #raw); /protect; /iterate; #out->insert(#temp); /iterate; return(#out); /define_tag;
No comments
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft