Browse Source

[Arte7] Fix content parsing

Elements are now put into separate JSON containers. As such
assignment changed from : to = and as only one container
is present in each element, the final , is omitted.
JSON data is html encoded and requires decoding before decoding
via json_decode.
logmanoriginal 7 years ago
parent
commit
8924722b93
1 changed files with 6 additions and 5 deletions
  1. 6 5
      bridges/Arte7Bridge.php

+ 6 - 5
bridges/Arte7Bridge.php

@@ -60,15 +60,16 @@
       $url = self::URI.'guide/'.$lang.'/plus7/'.$category;
       $input = getContents($url) or die('Could not request ARTE.');
       if(strpos($input, 'categoryVideoSet') !== FALSE){
-        $input = explode('categoryVideoSet: ', $input);
-        $input = explode('}},', $input[1]);
+        $input = explode('categoryVideoSet="', $input);
+        $input = explode('}}', $input[1]);
         $input = $input[0].'}}';
       }else{
-        $input = explode('videoSet: ', $input);
-        $input = explode('}]},', $input[1]);
+        $input = explode('videoSet="', $input);
+        $input = explode('}]}', $input[1]);
         $input = $input[0].'}]}';
       }
-      $input_json = json_decode($input, TRUE);
+
+      $input_json = json_decode(html_entity_decode($input, ENT_QUOTES), TRUE);
 
       foreach($input_json['videos'] as $element) {
             $item = array();