QianyanTech / Image-Downloader

Download images from Google, Bing, Baidu. 谷歌、百度、必应图片下载.
MIT License
2.15k stars 561 forks source link

Key error: 'listnum' #38

Open Ivan-Fan opened 3 years ago

Ivan-Fan commented 3 years ago

Really thanks for your great work! However, recently I have met a strange problem like the following. Any suggestions would help!

Keywords: 杨凡小时候 Number: 100 Face Only: False Safe Mode: True Query URL: https://image.baidu.com/search/index?tn=baiduimage&word=%E6%9D%A8%E5%87%A1%E5%B0%8F%E6%97%B6%E5%80%99 Traceback (most recent call last): File "Myimage_downloader.py", line 143, in main(sys.argv[1:]) File "Myimage_downloader.py", line 76, in main browser=args.driver) File "Image-Downloader-master\crawler.py", line 326, in crawl_image_urls proxy=proxy, proxy_type=proxy_type) File "Image-Downloader-master\crawler.py", line 207, in baidu_get_image_url_using_api total_num = init_json['listNum'] KeyError: 'listNum'

Sander-houqi commented 3 years ago

same error... http log: {"antiFlag":1,"message":"Forbid spider access","bfe_log_id":"9576621861689003963"}

Sander-houqi commented 3 years ago

emmm..... , I have a tmp solution, change get url way from baidu_get_image_url_using_api to baidu_image_url_from_webpage in image_downloader.py function crawl_image_urls, it can download.