【问题标题】:How can I find a movie's rating from TMDB in如何从 TMDB 中找到电影的评分
【发布时间】:2020-04-15 06:48:13
【问题描述】:

我一直在 Perl 中使用 TMDB 来获取很多关于电影的信息,例如:

my @results = $tmdb->search->movie("Back To The Future");

我得到了很多信息,很多哈希和数组,我得到了我正在寻找的所有信息。但无论我挖多深,我似乎都找不到找到 MPAA 对电影分级的路径。

有人有这方面的经验吗?我觉得我陷入了一个永恒的循环。

【问题讨论】:

  • 最好打印一个Dumper 值并查看。

标签: perl themoviedb-api


【解决方案1】:

您可以获得这样的认证:

use feature qw(say);
use strict;
use warnings;

use TMDB;

my $tmdb = TMDB->new(
   apikey => '?????????',  # API Key
   lang   => 'en',             # A valid ISO 639-1 (Aplha-2) language code
);

my @results = $tmdb->search->movie("Back To The Future");

for my $result (@results) {
    my $id = $result->{id};
    my $movie = $tmdb->movie( id => $id );
    my $releases = $movie->releases;
    my @cert = map { $_->{certification} } @$releases;
    say $result->{title}, " : ", join ",", @cert;
}

输出

Back to the Future : ,,,,,,,,,,,,,,,11,11,11,12,6,6,6,6,7,A,A,K-10,L,M/6,PG,PG,PG,PG,PG,PG,PG12,T
Back to the Future Part II : ,,,,,,,,,,,,,,,,11,12,6,6,6,6,7,K-10,L,M/12,PG,PG,PG,PG,PG,T,U
Back to the Future Part III : ,,,,,,,,,,,,,,,11,12,12,12+,6,6,6,6,7,K-10,M/12,PG,PG,PG,T,U
Project 88: Back to the Future Too : 
Romesh's Look Back to the Future : 
Looking Back to the Future : NR
Back to the Future: Making the Trilogy : 
Back To The Future... The Ride : 
Back to the Future Part II. Behind the scenes. : 
The Making of Back to the Future : 
The Secrets of the Back to the Future Trilogy : 
Back to the Future: Hilarious Outtakes : PG
Looking Back to the Future: Raymond Loewy, Industrial Designer : 
Back to the Future: Greater Scott Edition : 
The Making of Back to the Future Part 2 : 
Back to the 2015 Future : 
Looking Back at the Future : 
Ivan Vasilyevich Changes His Profession : 12+

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-07-01
    • 2019-04-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-10-20
    • 2015-02-17
    • 2011-04-12
    相关资源
    最近更新 更多