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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions