Closed jianglin8-hub closed 2 months ago
Mm it all works fine here, are you using the latest commit version?
And don't use "tt" only the numbers when calling the class
Mm it all works fine here, are you using the latest commit version?
And don't use "tt" only the numbers when calling the class
The usage starting with tt will be automatically processed in setid.
This error only appears in some IMDB IDs, here is my usage.
$mid = 'tt5430428';
$config = new Config();
$config->language = 'en-US,en';
$fail_msgs = [];
$data = [];
if (preg_match('/tt\d+/', $mid)) {
$obj = new Title($mid, $config);
$class_methods = get_class_methods($obj);
$miss_fields = [
'__construct', 'faq', 'recommendation', 'mpaa',
];
} elseif (preg_match('/nm\d+/', $mid)) {
$obj = new Name($mid, $config);
$class_methods = get_class_methods($obj);
$miss_fields = [
'__construct'
];
}
foreach ($class_methods as $method_name) {
if (in_array($method_name, $miss_fields)) {
continue;
}
try {
$data[$method_name] = $obj->$method_name();
} catch (Exception $e) {
$fail_msgs[] = "($method_name) -> " . $e->getMessage();
}
var_dump($data);
}
mm this not the way this class is designed.
For language new Config() is not necessary as en-Us is default. $config->language is not supported You added _construct to dismiss array? __construct is needed otherwise $id is never set hence all your errors i guess? What does get_class_methods($obj) do?
I suggest you start by reading the readme and wiki pages, all info is in there
Your understanding is incorrect
Not all imdb ids will encounter this issue, and there is no problem with initializing objects.
try {
$title = new \Imdb\Title(5430428);
$rating = $title->rating();
$plotOutline = $title->plotoutline();
$movietype = $title->movietype();
var_dump($rating);
var_dump($plotOutline);
var_dump($movietype);
} catch (\Exception $e) {
var_dump($e->getMessage());
}
Following the example method, we also received this error message.
string(33) "Failed to retrieve query [Rating]"
Mm okay there might then be a issue with accessing the imdb api url in your country? Or there is a issue with this specific imdbid? I do know that at imdbphp some users have the same issue, but there not seems to be a solution https://github.com/tboothman/imdbphp/issues/329
I don't have any other clue
I am able to access the imdb API, but this error only occurs in some imdb IDs
tt3331846 tt12833056 tt11082644 tt12833030 tt0235134 tt0045886 tt8532970
Well, after checking the logs, it seems like there are quite a few
For example: tt5430428
Information can be queried through imdbPHP, but imdbGraphQLPHP reports an error
For example: tt5430428
Information can be queried through imdbPHP, but imdbGraphQLPHP reports an error
I'll try to investigate more
$movie = new \Imdb\Title(5430428);
$title = $movie->title();
Add this below line 2447 in Title class var_dump($this->imdbID); var_dump($query);
What is the output of those 2 var_dumps?
Did you enable localization in config? What happens when you disable/enable this setting?
That imdbphp works and my version don't might be that imdbphp uses scraper methods to get the data while my version only imdb GraphQL API uses.
I get the feeling that this is a issue with the imdbid or a request redirect? Which country is you server located?
I checked if this id tt5430428 is redirected but this is not the case
In file GraphQL
Add var_dump($request->getStatus()); just below line 92
What is the output? It will show if a redirect (for example 307) or not
var_dump($request->getStatus());
int(429) string(33) "Failed to retrieve query [Rating]"
In file GraphQL
Add var_dump($request->getStatus()); just below line 92
What is the output? It will show if a redirect (for example 307) or not
So, it seems that there are too many requests intercepted by IMDB, and currently there is no support for proxy.
Can you add this setting? This is very useful in batch crawling.
Mm this is clearly too many requests, you seem to do so many that imdb api responded this way.. There is nothing i can do about that.
I'm not planing to add proxy. You try to use a proxy to do even more requests from a proxy server.. i don't think that is a solution.
Here is some info about 429 https://blog.hubspot.com/website/http-error-429
Closing this one as nothing to fix
tt5430428
(movietype) -> Failed to retrieve query [TitleYear], (title) -> Failed to retrieve query [TitleYear], (originalTitle) -> Failed to retrieve query [TitleYear], (year) -> Failed to retrieve query [TitleYear], (endyear) -> Failed to retrieve query [TitleYear], (runtime) -> Failed to retrieve query [Runtimes], (rating) -> Failed to retrieve query [Rating], (votes) -> Failed to retrieve query [RatingVotes], (metacritic) -> Failed to retrieve query [Metacritic], (rank) -> Failed to retrieve query [Rank], (language) -> Failed to retrieve query [Languages], (genre) -> Failed to retrieve query [Genres], (plotoutline) -> Failed to retrieve query [PlotOutline], (photo) -> Failed to retrieve query [Poster], (country) -> Failed to retrieve query [Countries], (releaseDate) -> Failed to retrieve query [ReleaseDates], (alsoknow) -> Failed to retrieve query [AlsoKnow], (top250) -> Failed to retrieve query [TopRated], (plot) -> Failed to retrieve query [Plots], (tagline) -> Failed to retrieve query [Taglines], (principalCredits) -> Failed to retrieve query [PrincipalCredits], (cast) -> Failed to retrieve query [CreditQuery], (director) -> Failed to retrieve query [CreditCrew], (cinematographer) -> Failed to retrieve query [CreditCrew], (writer) -> Failed to retrieve query [CreditCrew], (producer) -> Failed to retrieve query [CreditCrew], (composer) -> Failed to retrieve query [CreditCrew], (stunts) -> Failed to retrieve query [CreditCrew], (thanks) -> Failed to retrieve query [CreditCrew], (visualEffects) -> Failed to retrieve query [CreditCrew], (specialEffects) -> Failed to retrieve query [CreditCrew], (crazyCredit) -> Failed to retrieve query [CrazyCredits], (episode) -> Failed to retrieve query [TitleYear], (isOngoing) -> Failed to retrieve query [IsOngoing], (goof) -> Failed to retrieve query [Goofs], (quote) -> Failed to retrieve query [Quotes], (trivia) -> Failed to retrieve query [Trivia], (soundtrack) -> Failed to retrieve query [Soundtrack], (location) -> Failed to retrieve query [FilmingLocations], (prodCompany) -> Failed to retrieve query [CompanyCredits], (distCompany) -> Failed to retrieve query [CompanyCredits], (specialCompany) -> Failed to retrieve query [CompanyCredits], (otherCompany) -> Failed to retrieve query [CompanyCredits], (connection) -> Failed to retrieve query [Connections], (extSites) -> Failed to retrieve query [ExternalSites], (budget) -> Failed to retrieve query [ProductionBudget], (gross) -> Failed to retrieve query [RankedLifetimeGrosses], (keyword) -> Failed to retrieve query [Keywords], (alternateVersion) -> Failed to retrieve query [AlternateVersions], (mainphoto) -> Failed to retrieve query [MainPhoto], (trailer) -> Failed to retrieve query [Video], (mainaward) -> Failed to retrieve query [MainAward], (award) -> Failed to retrieve query [Award], (sound) -> Failed to retrieve query [TechSpec], (color) -> Failed to retrieve query [TechSpec], (aspectRatio) -> Failed to retrieve query [TechSpec], (camera) -> Failed to retrieve query [TechSpec], (featuredReview) -> Failed to retrieve query [Reviews], (isAdult) -> Failed to retrieve query [Adult], (checkRedirect) -> Failed to retrieve query [Redirect]