icrawler
icrawler copied to clipboard
I want to download the image along with its name
like when you google search it will show the image and the text below it code python below:
def auto_down_img(_keyword):
rm_temp()
create_Temp_img()
class DefaultNameDownloader(ImageDownloader):
def get_filename(self, task, default_ext):
filename = super().get_filename(task, default_ext)
return filename
google_crawler = GoogleImageCrawler(
feeder_threads=1,
parser_threads=1,
downloader_threads=4,
storage={'root_dir': 'Temp_image'},
downloader_cls=DefaultNameDownloader
)
filters = dict(
size='large',
# license='commercial,modify',
date=(None, None))
google_crawler.crawl(keyword=_keyword, filters=filters, offset=0, max_num=9,
min_size=(800, 800), max_size=None, file_idx_offset=0)
This is the code I'm using, it seems that the "class DefaultNameDownloader" doesn't work at all.