Web Scraping Images | Scrapy | extracting images with a specific class name
Dr Pi
Web Scraping images using Scrapy and saving them using "response.body" with 'wb' to write as binary to a file. We look at how to find only images with a specific class name using an Xpath selector.
◉ x = response.xpath("//*[@class='c-link']//img/@src").getall()
I also remove a "filestore" directory each time, and make a new one.
This uses "shutil" plus there's some more Scrapy shell action for you too.
See the Scrapy code at : https://github.com/RGGH/Tiny-Scrapy/blob/master/covers-spider.py
Cheers, See you around yeah? Dr P. ... https://www.youtube.com/watch?v=fzVANnmKsCg
2020-10-12
0.0 LBC
Copyrighted (contact publisher)
79079061 Bytes