Python 3.x BeautifulSoup crawling image URLs -
i try crawling image urls google image search window.
but got 20 urls want more urls 20 should do?
source code
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 = [] img in img_tags: if img['src'].startswith("http"): imgs_urls.append(img['src']) return(imgs_urls) get_images_links('black jeans')
Comments
Post a Comment