#coding:utf-8
import os
import requests
from urllib import request
from time import sleep
def get_img(keywordpage_size = 30):
“““
:param keyword: 查询关键字
:param page_size: 单次查询的条数
“““
dir_path = “D:\\工作\\88学习\\3Python学习\\baidu_img\\“+keyword
os.mkdir(dir_path)
url = “https://image.baidu.com/search/acjson?tn=resultjson_com&ipn=rj&ct=201326592&is=&fp=result&queryWord=%E5%93%88%E5%A3%AB%E5%A5%87&cl=2&lm=-1&ie=utf-8&oe=utf-8&adpicid=&st=-1&z=&ic=0&word=%E5%93%88%E5%A3%AB%E5%A5%87&s=&se=&tab=&width=&height=&face=0&istype=2&qc=&nc=1&fr=&pn=30&rn=30&gsm=1e&1535439331790=“
headers = {
“Referer“: “https://image.baidu.com/search/index?tn=baiduimage&ipn=r&ct=201326592&cl=2&lm=-1&st=-1&fm=index&fr=&hs=0&xthttps=111111&sf=1&fmq=&pv=&ic=0&nc=1&z=&
评论
共有 条评论