CompanySearch - hooshid/imdb-scraper GitHub Wiki
CompanySearch Class
The CompanySearch
class provides functionality to search for production companies and studios on IMDb, returning detailed information about each matching company.
search()
Method Documentation
Searches for production companies, studios, and other entertainment industry companies on IMDb. Returns comprehensive company data including ranking information, country of origin, and company types.
Method Signature
public function search(string $company, int $limit = 50): array
Parameters
Parameter | Type | Default | Required | Description |
---|---|---|---|---|
company | string | YES | Company name to search for | |
limit | int | 50 | NO | Maximum number of results to return |
Example Usage
$companySearch = new \Hooshid\ImdbScraper\CompanySearch();
$warnerResults = $companySearch->search("warner brothers");
$disneyResults = $companySearch->search("disney", 20);
Return Value
Key | Type | Description |
---|---|---|
id | string | IMDb company ID |
name | string | Official company name |
rank | array | Ranking information with sub-fields |
rank.current_rank | int|null | Current rank position |
rank.change_direction | string|null | Direction of rank change (UP/DOWN) |
rank.difference | int|null | Amount of rank change |
country | string|null | Country of origin |
types | string[] | Array of company types |
Example Return
[
{
"id": "co0185428",
"name": "Warner Brothers Entertainment",
"rank": {
"current_rank": 1660,
"change_direction": "UP",
"difference": 1884
},
"country": "United States",
"types": [
"Production",
"Distributor",
"Special Effects"
]
}
]
Error Handling
- Returns empty array when:
- Search term is empty after trimming
- No matching companies found
- API returns invalid data structure
- Throws Exception on:
- API request failures
- Network connectivity issues
Notes
- Search is case-insensitive
- Results include both active and inactive companies
- Some fields may be null if data is unavailable
- Company types vary and may include multiple categories
- Rank information is only available for some companies