Commit e34332ec authored by Taddeus Kroes's avatar Taddeus Kroes

Fixed issue where sometimes the details would be blank

parent d72afd60
...@@ -6,20 +6,19 @@ $page = file_get_contents($url); ...@@ -6,20 +6,19 @@ $page = file_get_contents($url);
preg_match('/<div\s+id="prog-content">\s*(.*?)\s*<div\s+class="prog-functionbar">/s', $page, $m1); preg_match('/<div\s+id="prog-content">\s*(.*?)\s*<div\s+class="prog-functionbar">/s', $page, $m1);
assert($m1); assert($m1);
$description = trim(strip_tags($m1[1], '<p><strong><em><b><i><font><a><span>')); $description = strip_tags($m1[1], '<p><strong><em><b><i><font><a><span>');
$description = str_replace('showVideoPlaybutton()', '', $description); $description = str_replace('showVideoPlaybutton()', '', $description);
$description = preg_replace('/\s+/', ' ', $description); $description = preg_replace('/\s+/', ' ', $description);
$description = htmlentities($description, ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE, 'ISO-8859-1');
$description = str_replace(array('&lt;', '&gt;'), array('<', '>'), $description);
preg_match('/<ul\s+id="prog-info-content-colleft">\s*(.*?)\s*<\/ul>/s', $page, $m2); preg_match('/<ul\s+id="prog-info-content-colleft">\s*(.*?)\s*<\/ul>/s', $page, $m2);
assert($m2); assert($m2);
preg_match_all('/<li><strong>(\w+):<\/strong>(.*?)<\/li>/', $m2[1], $m3); preg_match_all('/<li><strong>(\w+):<\/strong>(.*?)<\/li>/', $m2[1], $m3);
assert($m3); assert($m3);
$props = array(); $properties = array();
foreach ($m3[1] as $i => $name) foreach ($m3[1] as $i => $name)
$props[] = array('name' => $name, 'value' => $m3[2][$i]); $properties[] = array('name' => $name, 'value' => $m3[2][$i]);
echo json_encode(array( echo json_encode(compact('description', 'properties'), JSON_UNESCAPED_SLASHES);
'description' => $description,
'properties' => $props
));
?> ?>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment