Mikulas / csfd-api

Abandoned
31 stars 8 forks source link

Some movies returns blank plot #9

Closed legendik closed 10 years ago

legendik commented 10 years ago

Some movies (For example The Great Gatsby - ID 293006) returns blank plot.

Thats caused because of csfd.cz source code. This movie does not contains the "P" element in movie description.

I've created hotfix in class Movie. After

$plot = [];
            foreach ($content->find('p') as $paragraph) {
                $text = trim($paragraph->innertext);
                if (strlen($text) > 10) { // skip meaningless glues
                    $plot[] = $text;
                }
            }

Add

if (empty($plot)) {
                $text = $content->innertext;
                if (strlen($text) > 10) {
                    $plot[] = strip_tags($text);
                }
            }
Mikulas commented 10 years ago

:+1: thanks :)