serp-spider / search-engine-google

:spider: Google client for SERPS
https://serp-spider.github.io
Other
165 stars 61 forks source link

Top Stories - incorrect documentation and no results #122

Open MrZANO opened 4 years ago

MrZANO commented 4 years ago

Goodmorning everyone, I point out that the documentation is wrong, there are no brackets ")" and the array management is incorrect $newsTitle = $title; to $newsTitle = $news->title; the complete code generated by me to get the results of the word "homicide" is as follows

if ($result->is(NaturalResultType::TOP_STORIES)) {
                foreach ($result->news as $news) {
                    if ($news->is(NaturalResultType::TOP_STORIES_NEWS_CAROUSEL)) {
                        // carousel
                        $newsTitle = $news->title;
                        $newsUrl = $news->url;
                        echo "TOP_STORIES_NEWS_CAROUSEL-->" . $newsUrl . " " . $newsTitle;
                    } elseif ($news->is(NaturalResultType::TOP_STORIES_NEWS_VERTICAL)) {
                        // vertical
                        $newsTitle = $news->title;
                        $newsUrl = $news->url;
                        echo "TOP_STORIES_NEWS_VERTICAL-->" . $newsUrl . " " . $newsTitle;
                    }
                }
            }

ma nonostante ci siano "top stories" in SERPs non ottengo mai il parser dei risultati (bug?)