avatar

【Python - IMDbPY】Output the cover URLs from a list of IMDb movie IDs

Used IMDbPY

Reference: Python IMDbPY – Getting cover URL of the series - GeeksforGeeks

python
import imdb

f = open('imdb-coverURL-20211029.txt', 'w')

ia = imdb.IMDb()

# list of IMDb movie ID
code = ['0026778','0033717','0040246','0047647','0050539']

for i in code:
try:
series = ia.get_movie(i)
cover = series.data['cover url']
f.write(cover)
f.write('\n')
except KeyError:
f.write('NULL')
f.write('\n')

# close the file
f.close()
print('finished')

Output in the txt file

Code
https://m.media-amazon.com/images/M/MV5BYTJmNmQxNGItNDNlMC00MDU3LWFhNzMtZDQ2NDY0ZTVkNjE3XkEyXkFqcGdeQXVyMDI2NDg0NQ@@._V1_SX101_CR0,0,101,150_.jpg
https://m.media-amazon.com/images/M/MV5BYzg2MzBjNWUtMDgyZS00ZWFmLTljMDEtZmUxMTEwNGM4M2RlXkEyXkFqcGdeQXVyMDI2NDg0NQ@@._V1_SX101_CR0,0,101,150_.jpg
https://m.media-amazon.com/images/M/MV5BNzNlYmY0ZTMtMGJmOC00OTY4LWE2ZDUtODIyOWI5ZmRkZDNiXkEyXkFqcGdeQXVyNDQ3NDM5OQ@@._V1_SY150_CR61,0,101,150_.jpg
https://m.media-amazon.com/images/M/MV5BYTBlZGI3YmMtZGI1NC00OTA3LTk3OTYtYWE0YzhkYzkwZGNmXkEyXkFqcGdeQXVyMjI4MjA5MzA@._V1_SY150_CR0,0,101,150_.jpg
https://m.media-amazon.com/images/M/MV5BOTYxNTI0MjA5OV5BMl5BanBnXkFtZTgwMDA1OTc5MTE@._V1_SX101_CR0,0,101,150_.jpg

如果您喜歡我的文章,歡迎幫我在下面按5下讚!感謝您的鼓勵和支持!

文章作者: ouoholly
文章鏈接: https://ouoholly.github.io/post/python-IMDb-cover-url/
版權聲明: 本博客所有文章除特別聲明外,均採用 CC BY-NC-SA 4.0 許可協議。歡迎「部份引用」與介紹(如要全文轉貼請先留言詢問),轉載引用請註明來源 ouoholly 的倉庫,謝謝!

評論