1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
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;
|