Skip to content

Top Stories - incorrect documentation and no results #122

Description

@MrZANO

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?)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions