import requests
import KMP

url = 'https://fabiaoqing.com/search/search/keyword/%E4%BA%8C%E6%AC%A1%E5%85%83%E5%A6%B9%E5%AD%90/type/bq/page/'
store_path = 'D://tensorflow//萌妹子//'


KMP.KMPinit()
total = 0
file = store_path
for page in range(1,20):
    pages = url+str(page)+'.html'
    response = requests.get(pages)
    Word = KMP.findWord(response.text)
    num = len(Word)
    for step in range(num):
        saver = requests.get(Word[step]).content
        hander=open(store_path+str(total)+'.jpg','wb')
        hander.write(saver)
        hander.close()
        total = total+1
    print("At Page :%d %d %d"%(page,num,total))