Showing 1 changed files with 12 additions and 3 deletions
+12 -3
sources/news-huffingtonpost.fr.php
... ...
@@ -66,12 +66,13 @@ foreach ($articles as $article ) {
66 66
   $article_content = file_get_contents($article['link']);
67 67
   $SEARCH_SUB1='<article class="entry__content ">';
68 68
   $pos_start = strpos($article_content, $SEARCH_SUB1);
69
+  if(!$pos_start) {
70
+    $SEARCH_SUB1='<article class="entry__content">';
71
+    $pos_start = strpos($article_content, $SEARCH_SUB1);
72
+  }
69 73
   $pos_start += strlen($SEARCH_SUB1);
70 74
   $SEARCH_SUB2='<a class="follow-us__correction"';
71 75
   $pos_stop = strpos($article_content, $SEARCH_SUB2);
72
-  //~ echo "pos_start: ".$pos_start."<br>";
73
-  //~ echo "pos_stop : ".$pos_stop."<br>";
74
-  //~ echo "strlen : ".strlen($article_content)."<br>";
75 76
   $article_only = substr($article_content, $pos_start, $pos_stop - $pos_start);
76 77
   
77 78
   $SEARCH_SUB2='<p><strong>Lire aussi :</strong></p>';
... ...
@@ -80,6 +81,14 @@ foreach ($articles as $article ) {
80 81
   if( $pos_stop ) {
81 82
     $article_only = substr($article_content, $pos_start, $pos_stop - $pos_start);
82 83
   }
84
+  if(!$pos_stop) {
85
+    $SEARCH_SUB2='<div class="more-videos__container">';
86
+    $pos_stop = strpos($article_content, $SEARCH_SUB2);
87
+    $article_only = substr($article_content, $pos_start, $pos_stop - $pos_start);
88
+  }
89
+  /*echo "pos_start: ".$pos_start."<br>";
90
+  echo "pos_stop : ".$pos_stop."<br>";
91
+  echo "strlen : ".strlen($article_content)."<br>";*/
83 92
 
84 93
   $orgStrings = array( ' width="500" height="281" frameborder="0" ');
85 94
   $newStrings = array( ' width="100%" frameborder="0" ');