...
|
...
|
@@ -25,7 +25,6 @@ if ($xml === false) {
|
25
|
25
|
$article['timestamp'] = strtotime($item->pubDate);
|
26
|
26
|
$article['description'] = $item->description;
|
27
|
27
|
$article['image'] = $item->enclosure['url'];
|
28
|
|
- //$articles[$article['timestamp']] = $article;
|
29
|
28
|
$articles[$cpt] = $article;
|
30
|
29
|
echo '<div onclick="onArticle('.$cpt.')" style="display:inline;">';
|
31
|
30
|
echo '<img src="'.$article['image'].'" style="display:inline;" width="100%"><br>';
|
...
|
...
|
@@ -55,7 +54,7 @@ foreach ($articles as $article ) {
|
55
|
54
|
echo "<hr>";
|
56
|
55
|
echo "<a name=\"article-$cpt\">";
|
57
|
56
|
$article_content = http_get_contents($article['link']);
|
58
|
|
-
|
|
57
|
+/*
|
59
|
58
|
$SEARCH_SUB1='<h1 class="art-titre list-view">';
|
60
|
59
|
$pos_start = strpos($article_content, $SEARCH_SUB1);
|
61
|
60
|
$pos_stop = false;
|
...
|
...
|
@@ -84,15 +83,28 @@ foreach ($articles as $article ) {
|
84
|
83
|
|
85
|
84
|
//echo "pos_start : $pos_start<br>";
|
86
|
85
|
//echo "pos_stop : $pos_stop<br>";
|
87
|
|
-
|
|
86
|
+ */
|
|
87
|
+ $doc = new DOMDocument();
|
|
88
|
+ $doc->preserveWhiteSpace = false;
|
|
89
|
+ $doc->formatOutput = true;
|
|
90
|
+ $doc->loadHTML($article_content);
|
|
91
|
+ //$articles = $doc->getElementsByTagName('article_container');
|
|
92
|
+ $articles = $doc->getElementsByTagName('div');
|
|
93
|
+ $article_only="";
|
|
94
|
+ foreach ( $articles as $node) {
|
|
95
|
+ if(0==strcmp("article_container",$node->getAttribute('class'))) {
|
|
96
|
+ $article_only = DOMinnerHTML($node);
|
|
97
|
+ }
|
|
98
|
+ }
|
|
99
|
+
|
88
|
100
|
$orgStrings = array( ' href="/',
|
89
|
101
|
' src="/sites/',
|
90
|
102
|
'<img src=',
|
91
|
103
|
' data-src="/');
|
92
|
|
- $newStrings = array( ' href="https://www.lepoint.fr/',
|
93
|
|
- ' src="https://www.lepoint.fr/sites/',
|
|
104
|
+ $newStrings = array( ' href="https://www.lexpress.fr/',
|
|
105
|
+ ' src="https://www.lexpress.fr/sites/',
|
94
|
106
|
'<img width="100%" src=',
|
95
|
|
- ' data-src="https://www.lepoint.fr/' );
|
|
107
|
+ ' data-src="https://www.lexpress.fr/' );
|
96
|
108
|
$article_only = str_replace($orgStrings, $newStrings, $article_only);
|
97
|
109
|
|
98
|
110
|
$orgStrings = array( '<div class="row">',
|
...
|
...
|
@@ -118,7 +130,7 @@ foreach ($articles as $article ) {
|
118
|
130
|
'<div>',
|
119
|
131
|
'<div>');
|
120
|
132
|
$article_only = str_replace($orgStrings, $newStrings, $article_only);
|
121
|
|
-
|
|
133
|
+ /*
|
122
|
134
|
$temp = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $article_only);
|
123
|
135
|
$article_only = $temp;
|
124
|
136
|
$temp = preg_replace('/\s\s+/', ' ', $article_only);
|
...
|
...
|
@@ -129,11 +141,11 @@ foreach ($articles as $article ) {
|
129
|
141
|
$re = '/<noscript>(.+?)<\/noscript>/ms';
|
130
|
142
|
$temp = preg_replace($re, '', $article_only);
|
131
|
143
|
$article_only = $temp;
|
132
|
|
-
|
133
|
|
- $orgStrings = array( 'http://www.lepoint.fr/' );
|
134
|
|
- $newStrings = array( 'https://www.lepoint.fr/' );
|
|
144
|
+*/
|
|
145
|
+ $orgStrings = array( 'http://www.lexpress.fr/' );
|
|
146
|
+ $newStrings = array( 'https://www.lexpress.fr/' );
|
135
|
147
|
$article_only = str_replace($orgStrings, $newStrings, $article_only);
|
136
|
|
-
|
|
148
|
+/*
|
137
|
149
|
$re = '/<img class="w100" alt="(.+?)" data-lazyload="loading" onclick="(.+?)" src="(.+?)" title="(.+?)" data-src="(.+?)" \/>/';
|
138
|
150
|
$temp = preg_replace($re, '<img width="100%" src="\\5">', $article_only);
|
139
|
151
|
$article_only = $temp;
|
...
|
...
|
@@ -157,12 +169,12 @@ foreach ($articles as $article ) {
|
157
|
169
|
$re = '/<a onclick="(.+?)" data-shadowbox="#authform" href="(.+?)" id="connect_viafreemium" class="w100 block txtcenter br-4-all bg-grey-medium-blue pas font-black bold br-4-all upper">Identifiez-vous<\/a>/';
|
158
|
170
|
$temp = preg_replace($re, '', $article_only);
|
159
|
171
|
$article_only = $temp;
|
160
|
|
-
|
|
172
|
+*/
|
161
|
173
|
echo '<div id="nav-up" style="display:inline;"><a href="#top"><i class="fa fa-home fa-2x"></i></a></div> ';
|
162
|
174
|
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> ';
|
163
|
175
|
echo '<div id="nav-prev" onclick="onArticle('.$cpt_prev.')" style="display:inline;"><i class="fa fa-chevron-left fa-2x"></i></div> ';
|
164
|
176
|
echo '<div id="nav-next" onclick="onArticle('.$cpt_next.')" style="display:inline;"><i class="fa fa-chevron-right fa-2x"></i></div>';
|
165
|
|
- echo '<div class="extract-content" id="'.$cpt.'">'.$article_only.'</div>';
|
|
177
|
+ echo '<div class="extract-content" id="'.$cpt.'"><h3>'.$article['title'].'</h3><img width="100%" src="'.$article['image'].'">'.$article_only.'</div>';
|
166
|
178
|
echo '<div id="nav-up" style="display:inline;"><a href="#top"><i class="fa fa-home fa-2x"></i></a></div> ';
|
167
|
179
|
echo '<div id="nav-up" style="display:inline;"><a href="#article-top"><i class="fa fa-chevron-up fa-2x"></i></a></div> ';
|
168
|
180
|
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> ';
|