Python IMDbPY – 获取系列语言
在本文中,我们将了解如何获取该系列的语言。一个系列有多种语言可供选择,因为观众人数众多,他们倾向于用他们的语言制作系列,以便吸引越来越多的观众。
In order to get this we have to do the following –
1. Get the series details with the help of get_movie method
2. As this object will act as dictionary therefore we have to filter the object
3. Get the main data of object with the help of data method which will return dictionary
4. Get the languages details from the dictionary
下面是实现
# importing the module
import imdb
# creating instance of IMDb
ia = imdb.IMDb()
# id
code = "6473300"
# getting information
series = ia.get_movie(code)
# getting languages of the series
languages = series.data['languages']
# printing the object i.e name
print(series)
# print the languages
print(languages)
输出 :
Mirzapur
['Hindi']
另一个例子
# importing the module
import imdb
# creating instance of IMDb
ia = imdb.IMDb()
# id
code = "6468322"
# getting information
series = ia.get_movie(code)
# getting languages of the series
languages = series.data['languages']
# printing the object i.e name
print(series)
# print the languages
print(languages)
输出 :
Money Heist
['Spanish', 'Russian', 'Serbian', 'English']