我尝试使用Google图片搜索窗口抓取图片网址。
但是我只有20个网址,我想要更多的网址而不是20个我应该做什么?
def get_images_links(searchTerm):
searchUrl = "https://www.google.com/search?q={}&site=webhp&tbm=isch".format(searchTerm)
data = requests.get(searchUrl).text
soup = BeautifulSoup(data, 'html.parser')
img_tags = soup.find_all('img')
imgs_urls = []
for img in img_tags:
if img['src'].startswith("http"):
imgs_urls.append(img['src'])
return(imgs_urls)
get_images_links('black jeans')