怎样在谷歌浏览器中爬图片详解

#!/usr/bin/env python
# -*- coding:utf-8 -*-
from icrawler.builtin import GoogleImageCrawler
#keyword = '动漫美女'
import sys
import os
from importlib import reload
reload(sys)
s = os.sep
root = "E:\\image"
for test in os.listdir(root):
    if os.path.isfile(os.path.join(root,test)) and test.__eq__("test.txt"):
        filename = os.path.join(root,test)
        with open(os.path.join(root,test)) as f:
            while 1:
                keyword = f.readline().strip()
                if not keyword:
                    break
                print("---filename---",test)
                google_crawler = GoogleImageCrawler(
                    feeder_threads=1,
                    parser_threads=2,
                    downloader_threads=16,
                    storage={'root_dir': keyword})

                google_crawler.crawl(keyword=keyword, max_num=10, file_idx_offset=0)

猜你喜欢

转载自www.cnblogs.com/tzwx/p/9276625.html
今日推荐