-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample.java
More file actions
65 lines (44 loc) · 2.77 KB
/
Copy pathExample.java
File metadata and controls
65 lines (44 loc) · 2.77 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import com.augmentedlogic.simplefeedreader.*;
public class Example
{
public static void main(String[] args)
{
SimpleFeedReader sfr = new SimpleFeedReader();
sfr.setPlainText(true);
Feed feed = null;
try {
feed = sfr.readSource("https://www.theguardian.com/world/rss");
System.out.println("Status Code: " + sfr.getStatusCode());
System.out.println(sfr.getPayload());
System.out.println(feed.getTitle());
for(FeedItem item: feed.getFeedItems()) {
System.out.println(" " + item.getTitle());
System.out.println(" " + item.getPubDate());
System.out.println(" " + item.getAuthor());
System.out.println(" " + item.getDescription());
System.out.println(" " + item.getGuid());
System.out.println(" " + item.getMediaFile());
System.out.println(" " + item.getMediaType());
System.out.println(" " + item.getLink());
}
} catch(Exception e) {
System.out.println(e);
}
try {
feed = sfr.readSource("test.atom");
System.out.println(feed.getTitle());
for(FeedItem item: feed.getFeedItems()) {
System.out.println(" " + item.getTitle());
System.out.println(" " + item.getPubDate());
System.out.println(" " + item.getAuthor());
System.out.println(" " + item.getDescription());
System.out.println(" " + item.getGuid());
System.out.println(" " + item.getMediaFile());
System.out.println(" " + item.getMediaType());
System.out.println(" " + item.getLink());
}
} catch(Exception e) {
System.out.println(e);
}
}
}