News - hooshid/imdb-scraper GitHub Wiki

News Class

The News class retrieves entertainment news articles from IMDb across various categories including movies, TV, celebrities, and more.

newsList()

Method Documentation

Fetches a list of news articles for a specified category. Returns structured news data including article metadata, content, and associated images.

Method Signature

public function newsList(string $listType, int $limit = 250): array

Parameters

Parameter Type Default Required Description
listType string YES News category (MOVIE, TV, CELEBRITY, TOP, INDIE)
limit int 250 NO Maximum number of articles to retrieve (max 250)

Valid listType Values

  • MOVIE: Film industry news
  • TV: Television news
  • CELEBRITY: Celebrity gossip and updates
  • TOP: Top trending entertainment news
  • INDIE: Independent film news

Example Usage

$news = new \Hooshid\ImdbScraper\News();
$movieNews = $news->newsList('MOVIE', 10);
$topStories = $news->newsList('TOP');

Return Value

Key Type Description
id string Unique article identifier
title string Article headline
author string|null Author byline
date string|null Publication date (Y-m-d H:i:s format)
source_url string|null Direct article URL
source_home_url string|null Publisher homepage URL
source_label string|null News source name
plain_html string|null Formatted HTML content
plain_text string|null Plain text content
image array|null Associated image data
image.url string Image URL
image.width int Image width in pixels
image.height int Image height in pixels

Example Return

{
    "id": "ni65348669",
    "title": "'28 Years Later' Ignites U.K., Ireland Box Office",
    "author": "Naman Ramachandran",
    "date": "2025-06-24 01:58:26",
    "source_url": "https://variety.com/2025/film/box-office/28-years-later-uk-ireland-box-office-1236438843/",
    "source_home_url": "http://variety.com/",
    "source_label": "Variety - Film News",
    "plain_html": "<a href=\"/title/tt10548174/\">28 Years Later</a> opened atop the U.K. and Ireland box office...",
    "plain_text": "28 Years Later opened atop the U.K. and Ireland box office...",
    "image": {
        "url": "https://m.media-amazon.com/images/M/MV5BNjgwYTI0YjctMWYzNS00MmI1LWI5YTctNmE1YjBkNDFlNWMxXkEyXkFqcGc@._V1_.jpg",
        "width": 1080,
        "height": 1350
    }
}

Error Handling

  • Returns empty array when:
    • No news articles found for specified category
    • Invalid API response structure
  • Throws InvalidArgumentException for invalid listType
  • Throws Exception for API request failures

Notes

  • The limit parameter has a maximum effective value of 250
  • Some fields may be null if data isn't available from the source
  • Plain HTML content includes IMDb entity links