避免在 IMDb 名称搜索中出现相似名称
我的目标是使用 IMDb 姓名搜索来获取与我要查找的姓名完全相同的人的 ID。不幸的是,我也用这个代码得到了所有相似的名字。
import imdb
# creating instance of IMDb
ia = imdb.IMDb()
# list of names
names = ["Paul Alexander Abel", "Viktor Abel", "Heinz Abosch"]
# searching the name
for n in names:
print("-----", n, "-----")
search = ia.search_person(n)
# loop for printing the name and id
for i in range(len(search)):
# getting the id
id = search[i].personID
print(search[i]['name'] + " : " + id)
# output:
----- Viktor Abel -----
Viktor Vrabec : 0903968
Viktor Brabec : 0102632
Viktor Abroi : 6636627
Viktor Absolutov : 5153732
Viktoriia Bessarab : 10441797
Viktoriya Brabec : 13413004
Viktor Abolduyev : 0008850
Viktor Abramov : 12453191
Viktor Abramov : 11944753
Viktor Abakumov : 12360818
Viktor Abramovskiy : 3277781
Viktor Abramyan : 8311765
Viktor Abrosimov : 1480489
Viktoriya Belyakova : 11558430
Viktoriya Belova : 1495496
Viktoriya Belyaeva : 5274884
Viktoria Believein : 3637309
Viktoria Belovonskaya : 10260945
Viktoriya Belyavskaya : 10267906
Viktorie Isabella Ter-Akopow : 9422886
----- Heinz Abosch -----
Heinz Ambrosch : 0024376
有办法改变吗?
My goal is to use the IMDb name search to get the ID for a person with exactly the name I'm looking for. Unfortunately, I also get all the similar names with this code.
import imdb
# creating instance of IMDb
ia = imdb.IMDb()
# list of names
names = ["Paul Alexander Abel", "Viktor Abel", "Heinz Abosch"]
# searching the name
for n in names:
print("-----", n, "-----")
search = ia.search_person(n)
# loop for printing the name and id
for i in range(len(search)):
# getting the id
id = search[i].personID
print(search[i]['name'] + " : " + id)
# output:
----- Viktor Abel -----
Viktor Vrabec : 0903968
Viktor Brabec : 0102632
Viktor Abroi : 6636627
Viktor Absolutov : 5153732
Viktoriia Bessarab : 10441797
Viktoriya Brabec : 13413004
Viktor Abolduyev : 0008850
Viktor Abramov : 12453191
Viktor Abramov : 11944753
Viktor Abakumov : 12360818
Viktor Abramovskiy : 3277781
Viktor Abramyan : 8311765
Viktor Abrosimov : 1480489
Viktoriya Belyakova : 11558430
Viktoriya Belova : 1495496
Viktoriya Belyaeva : 5274884
Viktoria Believein : 3637309
Viktoria Belovonskaya : 10260945
Viktoriya Belyavskaya : 10267906
Viktorie Isabella Ter-Akopow : 9422886
----- Heinz Abosch -----
Heinz Ambrosch : 0024376
Is there a way to change that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
限制返回结果的数量:
您的循环:
Limit the number of result returned:
Your loop: