@
holajamc 我爬豆瓣 250 电影,相关图片内容都下载完了,然后报出这样的错误:Traceback (most recent call last):
File "/Users/zzz/Documents/
Untitled.py", line 96, in <module>
main()
File "/Users/zzz/Documents/
Untitled.py", line 92, in main
download_covers( movies )
File "/Users/zzz/Documents/
Untitled.py", line 81, in download_covers
r = requests.get( imge_url )
NameError: name 'imge_url' is not defined,相关代码是:
def download_covers(movies):
for m in movies:
imag_url = m.cover_url
r = requests.get( imge_url )
path = 'covers/' + m.name.split( '/' )[0] + '.jpg'
with open( path, 'wb' ) as f:
f.write( r.content )
def main():
urls = urls_from_douban()
movies = movies_from_url( urls )
movie_log( movies )
download_covers( movies )
if __name__ == '__main__':
main()
感谢!