3 import java.io.IOException;
4 import java.io.InputStreamReader;
6 import java.util.ArrayList;
7 import java.util.HashMap;
11 import javax.json.Json;
12 import javax.json.JsonArray;
13 import javax.json.JsonObject;
15 import pnews.Category;
19 public static Feed[] getFeeds() {
26 r = new InputStreamReader(Config.class.getClassLoader().getResourceAsStream("feeds.json"));
27 jfeeds = Json.createReader(r).readObject();
30 try { r.close(); } catch (IOException e) { };
33 feeds = new ArrayList<Feed>(jfeeds.size());
35 jfeeds.forEach((k, v)-> {
37 JsonArray jcategories;
40 jcategories = jf.getJsonArray("categories");
41 feeds.add(new Feed(k, Category.valueOf(jcategories.getString(0))));
44 return feeds.toArray(new Feed[] {});
47 public static Map<Category, String[]> getFeedsByCategory() {
48 Map<Category, String[]> result;
50 result = new HashMap<>();
52 result.put(Category.ACTUALITE,
54 "http://www.europe1.fr/var/export/rss/europe1/actus.xml",
55 "http://www.francetvinfo.fr/titres.rss",
56 "http://www.rfi.fr/general/rss",
57 "http://www.cnews.fr/rss/une",
58 "http://www.ladepeche.fr/rss/a-la-une.rss",
59 "https://www.franceinter.fr/rss/a-la-une.xml",
60 "https://www.francebleu.fr/rss/a-la-une.xml",
61 "http://www.bfmtv.com/rss/info/flux-rss/flux-toutes-les-actualites/"
64 result.put(Category.SPORT,
65 new String[] { "http://www.europe1.fr/var/export/rss/europe1/sport.xml",
66 "http://www.sportune.fr/feed",
67 "http://www.france24.com/fr/sports/rss" });
69 result.put(Category.FRANCE,
70 new String[] { "http://www.france24.com/fr/france/rss",
71 "http://www.francetvinfo.fr/france.rss",
72 "http://www.rfi.fr/france/rss"});
74 result.put(Category.EUROPE,
75 new String[] { "http://www.france24.com/fr/europe/rss" });
77 result.put(Category.MONDE,
78 new String[] { "http://www.europe1.fr/var/export/rss/europe1/international.xml",
79 "http://www.france24.com/fr/actualites/rss" });
82 result.put(Category.ECONOMIE,
83 new String[] { "http://www.france24.com/fr/economie/rss",
84 "http://www.europe1.fr/var/export/rss/europe1/economie.xml",
85 "http://www.rfi.fr/economie/rss" });
87 result.put(Category.ESSONNE,
88 new String[] { "http://www.tourisme-essonne.com/rss/actus/",
89 "http://www.ville-palaiseau.fr/rss/actualites.htm" });
91 result.put(Category.PEOPLE,
92 new String[] { "http://www.premiere.fr/rss/actu-live",
93 "http://www.purepeople.com/rss/news_t0.xml"
96 result.put(Category.TECHNOLOGIE,
97 new String[] { "http://www.generation-nt.com/export/rss.xml",
98 "http://www.europe1.fr/var/export/rss/europe1/sciences.xml",
99 "http://feeds.feedburner.com/lesnumeriques/news",
100 "http://www.zdnet.fr/feeds/rss/actualites/",
101 "http://www.frandroid.com/feed",
102 "http://www.silicon.fr/feed",
103 "http://www.fredzone.org/feed",
104 "http://www.futura-sciences.com/rss/actualites.xml",
105 "https://www-03.ibm.com/press/fr/fr/rssfeed.wss?keyword=null&maxFeed=&feedType=RSS&topic=all"});
110 public static void main(String[] args) {
115 System.out.println("Number of feeds: " + feeds.length);
117 System.out.println(f);