... | ... |
@@ -9,3 +9,4 @@ php news-numerama.fr.php > numerama.html 2> /dev/null |
9 | 9 |
php news-huffingtonpost.fr.php > huffingtonpostfr.html 2> /dev/null |
10 | 10 |
php news-lepoint.fr.php > lepointfr.html 2> /dev/null |
11 | 11 |
php news-lexpress.fr.php > lexpressfr.html 2> /dev/null |
12 |
+php news-franceinfo.php > franceinfo.html 2> /dev/null |
... | ... |
@@ -9,3 +9,4 @@ php news-numerama.fr.php > numerama.html 2> /dev/null |
9 | 9 |
php news-huffingtonpost.fr.php > huffingtonpostfr.html 2> /dev/null |
10 | 10 |
php news-lepoint.fr.php > lepointfr.html 2> /dev/null |
11 | 11 |
php news-lexpress.fr.php > lexpressfr.html 2> /dev/null |
12 |
+php news-franceinfo.php > franceinfo.html 2> /dev/null |
... | ... |
@@ -0,0 +1,140 @@ |
1 |
+<?php |
|
2 |
+include_once( 'news-constants.php' ); |
|
3 |
+ |
|
4 |
+$rss_content = file_get_contents(NEWS_RSS_FRANCEINFO); |
|
5 |
+$xml = simplexml_load_string($rss_content); |
|
6 |
+if ($xml === false) { |
|
7 |
+ echo 'Failed to read RSS'; |
|
8 |
+} else { |
|
9 |
+ $channel = array(); |
|
10 |
+ $channel['title'] = $xml->channel->title; |
|
11 |
+ $channel['link'] = $xml->channel->link; |
|
12 |
+ $channel['description'] = $xml->channel->description; |
|
13 |
+ $channel['pubDate'] = $xml->channel->pubDate; |
|
14 |
+ $channel['timestamp'] = strtotime($xml->channel->pubDate); |
|
15 |
+ echo '<h4>' . $channel['title'] . '</h4>'; |
|
16 |
+ $cpt=0; |
|
17 |
+ foreach ($xml->channel->item as $item) { |
|
18 |
+ $article = array(); |
|
19 |
+ $article['title'] = $item->title; |
|
20 |
+ $article['link'] = $item->link; |
|
21 |
+ $orgStrings = array('?xtor=RSS-3208'); |
|
22 |
+ $newStrings = array(''); |
|
23 |
+ $article['link'] = str_replace($orgStrings, $newStrings, $article['link']); |
|
24 |
+ $article['pubDate'] = $item->pubDate; |
|
25 |
+ $article['timestamp'] = strtotime($item->pubDate); |
|
26 |
+ $article['description'] = $item->description; |
|
27 |
+ $article['image'] = $item->enclosure['url']; |
|
28 |
+ $articles[$cpt] = $article; |
|
29 |
+ echo '<div onclick="onArticle('.$cpt.')" style="display:inline;">'; |
|
30 |
+ echo '<img src="'.$article['image'].'" style="display:inline;" width="100%"><br>'; |
|
31 |
+ echo '<div id="nav-up" style="display:inline;"><a href="#top"><i class="fa fa-home fa-2x"></i></a></div> '; |
|
32 |
+ echo '<div id="nav-up" style="display:inline;"><a href="#article-top"><i class="fa fa-chevron-down fa-2x"></i></a></div> '; |
|
33 |
+ echo $article['title'].' '; |
|
34 |
+ echo '<div id="nav-source" style="display:inline;"><a href="'.$article['link'].'" target="new-'.$cpt.'"><i class="fa fa-link fa-2x"></i></a><br></div></div>'; |
|
35 |
+ $cpt++; |
|
36 |
+ if( $cpt > $NEWS_RSS_MAX_ITEMS ) { |
|
37 |
+ break; |
|
38 |
+ } |
|
39 |
+ } |
|
40 |
+} |
|
41 |
+echo '</div><!-- ./panel-body -->'; |
|
42 |
+echo '</div><!-- ./panel panel-default -->'; |
|
43 |
+echo '</div><!-- ./col-md-6 -->'; |
|
44 |
+echo '<div class="col-md-6">'; |
|
45 |
+echo '<div class="panel panel-default">'; |
|
46 |
+echo '<div class="panel-body">'; |
|
47 |
+echo '<a name="article-top"></a><div id="article-current"></div>'; |
|
48 |
+$cpt=0; |
|
49 |
+foreach ($articles as $article ) { |
|
50 |
+ $cpt_prev=$cpt-1; |
|
51 |
+ $cpt_next=$cpt+1; |
|
52 |
+ echo '<!-- ==================== article '.$cpt.'============== -->'; |
|
53 |
+ echo "<div class=\"article\" id=\"article-$cpt\" style=\"display: none;\">\n"; |
|
54 |
+ echo "<hr>"; |
|
55 |
+ echo "<a name=\"article-$cpt\">"; |
|
56 |
+ $article_content = file_get_contents($article['link']); |
|
57 |
+ $doc = new DOMDocument(); |
|
58 |
+ $doc->preserveWhiteSpace = false; |
|
59 |
+ $doc->formatOutput = true; |
|
60 |
+ $doc->loadHTML($article_content); |
|
61 |
+ $articles = $doc->getElementsByTagName('article'); |
|
62 |
+ $article_only=""; |
|
63 |
+ foreach ( $articles as $node) { |
|
64 |
+ $article_only = DOMinnerHTML($node); |
|
65 |
+ } |
|
66 |
+ |
|
67 |
+ $orgStrings = array(' href="/'); |
|
68 |
+ //$newStrings = array(' href="https://www.lemonde.fr/'); |
|
69 |
+ $newStrings = array(' href="https://www.francetvinfo.fr/'); |
|
70 |
+ $article_only = str_replace($orgStrings, $newStrings, $article_only); |
|
71 |
+ |
|
72 |
+ $orgStrings = array( |
|
73 |
+ '<p class="txt3 description-article" itemprop="description">', |
|
74 |
+ '<p class="bloc_signature">', |
|
75 |
+ '<span id="publisher" itemprop="Publisher" data-source="LE MONDE">', |
|
76 |
+ '<div class="toolbar"></div>', |
|
77 |
+ '<div id="articleBody" class="contenu_article js_article_body" itemprop="articleBody">', |
|
78 |
+ '<h4>', |
|
79 |
+ '</h4>', |
|
80 |
+ '<h1 class="tt2" itemprop="Headline">', |
|
81 |
+ '</h1>', |
|
82 |
+ '<h2 class="taille_courante">', |
|
83 |
+ '<h2 class="intertitre">', |
|
84 |
+ '</h2>', |
|
85 |
+ '<span>Le Monde</span>', |
|
86 |
+ '<figure class="illustration_haut " style="width: 534px">', |
|
87 |
+ '<img width="534" data-lazyload="false" src="', |
|
88 |
+ ' onload="lmd.pic(this);" onerror="lmd.pic(this);" class="lazy-retina"' ); |
|
89 |
+ $newStrings = array( |
|
90 |
+ '<p>', |
|
91 |
+ '<p>', |
|
92 |
+ '<span>', |
|
93 |
+ '', |
|
94 |
+ '<div>', |
|
95 |
+ '<h5>', |
|
96 |
+ '</h5>', |
|
97 |
+ '<h3>', |
|
98 |
+ '</h3>', |
|
99 |
+ '<h4>', |
|
100 |
+ '<h4>', |
|
101 |
+ '</h4>', |
|
102 |
+ 'Le Monde', |
|
103 |
+ '<figure>', |
|
104 |
+ '<img width="100%" src="', |
|
105 |
+ '' ); |
|
106 |
+ |
|
107 |
+ $article_only = str_replace($orgStrings, $newStrings, $article_only); |
|
108 |
+ |
|
109 |
+ $temp = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $article_only); |
|
110 |
+ $article_only = $temp; |
|
111 |
+ $temp = preg_replace('/\s\s+/', ' ', $article_only); |
|
112 |
+ $article_only = $temp; |
|
113 |
+ //$re = '/<a target="_blank" onclick="return false;" (.+?)">(.+?)<\/a>/'; |
|
114 |
+ //$temp = preg_replace($re, '\\3', $article_only); |
|
115 |
+ //$article_only = $temp; |
|
116 |
+ $re = '/<a class="lien_interne rub"(.+?)>(.+?)<\/a>/'; |
|
117 |
+ $temp = preg_replace($re, '\\2', $article_only); |
|
118 |
+ $article_only = $temp; |
|
119 |
+ $re = '/<img (.+?)data-src="(.+?)"(.+?)data-lazyload="true"(.+?)>/'; |
|
120 |
+ $temp = preg_replace($re, '<img width="100%" src="\\2">', $article_only); |
|
121 |
+ $article_only = $temp; |
|
122 |
+ $re = '/<a href="http:\/\/ad.apsalar.com\/api\/v1\/ad(.+?)target="_blank(.+?)<\/a>/'; |
|
123 |
+ $temp = preg_replace($re, '', $article_only); |
|
124 |
+ $article_only = $temp; |
|
125 |
+ echo '<div id="nav-up" style="display:inline;"><a href="#top"><i class="fa fa-home fa-2x"></i></a></div> '; |
|
126 |
+ echo '<div id="nav-source" style="display:inline;"><a href="'.$article['link'].'" target="new-'.$cpt.'"><i class="fa fa-link fa-2x"></i></a></div> '; |
|
127 |
+ echo '<div id="nav-prev" onclick="onArticle('.$cpt_prev.')" style="display:inline;"><i class="fa fa-chevron-left fa-2x"></i></div> '; |
|
128 |
+ echo '<div id="nav-next" onclick="onArticle('.$cpt_next.')" style="display:inline;"><i class="fa fa-chevron-right fa-2x"></i></div>'; |
|
129 |
+ echo '<div class="extract-content" id="'.$cpt.'">'.$article_only.'</div>'; |
|
130 |
+ echo '<div id="nav-up" style="display:inline;"><a href="#top"><i class="fa fa-home fa-2x"></i></a></div> '; |
|
131 |
+ echo '<div id="nav-up" style="display:inline;"><a href="#article-top"><i class="fa fa-chevron-upi fa-2x"></i></a></div> '; |
|
132 |
+ echo '<div id="nav-source" style="display:inline;"><a href="'.$article['link'].'" target="new-'.$cpt.'"><i class="fa fa-link fa-2x"></i></a></div> '; |
|
133 |
+ echo '<div id="nav-prev" onclick="onArticle('.$cpt_prev.')" style="display:inline;"><i class="fa fa-chevron-left fa-2x"></i></div> '; |
|
134 |
+ echo '<div id="nav-next" onclick="onArticle('.$cpt_next.')" style="display:inline;"><i class="fa fa-chevron-right fa-2x"></i></div></div>'; |
|
135 |
+ $cpt++; |
|
136 |
+ if( $cpt > $NEWS_RSS_MAX_ITEMS ) { |
|
137 |
+ break; |
|
138 |
+ } |
|
139 |
+} |
|
140 |
+?> |
... | ... |
@@ -8,8 +8,9 @@ define('NEWS_RSS_NUMERAMA', 'https://www.numerama.com/rss/news.rss'); |
8 | 8 |
define('NEWS_RSS_HUFFINGTONPOSTFR', 'https://www.huffingtonpost.fr/feeds/index.xml'); |
9 | 9 |
define('NEWS_RSS_LEPOINTFR', 'http://www.lepoint.fr/24h-infos/rss.xml'); |
10 | 10 |
define('NEWS_RSS_LEXPRESSFR', 'https://www.lexpress.fr/rss/alaune.xml'); |
11 |
-define('NEWS_RSS_BUZZFEEDFR', 'https://www.buzzfeed.com/index.xml?country=fr'); |
|
11 |
+define('NEWS_RSS_FRANCEINFO', 'https://www.francetvinfo.fr/titres.rss'); |
|
12 | 12 |
|
13 |
+/* |
|
13 | 14 |
define('SRC_NEWS_RSS_LEMONDE', 'sources/lemonde.html'); |
14 | 15 |
define('SRC_NEWS_RSS_LIBERATION', 'sources/liberation.html'); |
15 | 16 |
define('SRC_NEWS_RSS_SLATEFR', 'sources/slatefr.html'); |
... | ... |
@@ -20,7 +21,7 @@ define('SRC_NEWS_RSS_HUFFINGTONPOSTFR', 'sources/huffingtonpostfr.html'); |
20 | 21 |
define('SRC_NEWS_RSS_LEPOINTFR', 'sources/lepointfr.html'); |
21 | 22 |
define('SRC_NEWS_RSS_LEXPRESSFR', 'sources/lexpressfr.html'); |
22 | 23 |
define('SRC_NEWS_RSS_BUZZFEEDFR', 'sources/buzzfeedfr.html'); |
23 |
- |
|
24 |
+ */ |
|
24 | 25 |
$array_title=array( |
25 | 26 |
"lemonde" => "LeMonde.fr", |
26 | 27 |
"liberation" => "Liberation.fr", |
... | ... |
@@ -30,7 +31,7 @@ $array_title=array( |
30 | 31 |
"lepointfr" => "LePoint.fr", |
31 | 32 |
"lexpressfr" => "L'Express.fr", |
32 | 33 |
"vicefr" => "Vice.fr", |
33 |
- "buzzfeedfr" => "Buzzfeed.com fr", |
|
34 |
+ "franceinfo" => "FranceInfo", |
|
34 | 35 |
"lesinrocks" => "LesInrocks.fr" |
35 | 36 |
); |
36 | 37 |
$array_url=array( |
... | ... |
@@ -42,7 +43,7 @@ $array_url=array( |
42 | 43 |
"lepointfr" => NEWS_RSS_LEPOINTFR, |
43 | 44 |
"lexpressfr" => NEWS_RSS_LEXPRESSFR, |
44 | 45 |
"vicefr" => NEWS_RSS_VICEFR, |
45 |
- "buzzfeedfr" => NEWS_RSS_BUZZFEEDFR, |
|
46 |
+ "franceinfo" => NEWS_RSS_FRANCEINFO, |
|
46 | 47 |
"lesinrocks" => NEWS_RSS_LESINROCKS |
47 | 48 |
); |
48 | 49 |
?> |