You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For anyone still having this issue, the problem lies within the regex for parsing the image URL. It gets extra junk in there which breaks the image link. To fix the code, modify google_image_url_from_webpage function in crawler.py to this:
# (line 121)image_elements=driver.find_elements(By.CLASS_NAME, "islib")
image_urls=list()
url_pattern=r"imgurl=\S*?&"# explanation: \S -> match any whitespace character# *? -> match previous token \S between 0 and unlimited times and do so lazily, aka match until the first & and not the last oneforimage_elementinimage_elements[:max_number]:
outer_html=image_element.get_attribute("outerHTML")
re_group=re.search(url_pattern, outer_html)
ifre_groupisnotNone:
image_url=unquote(re_group.group()[len("imgurl=") : -len("&")])
image_urls.append(image_url)
returnimage_urls
Hi,
Following error occcurs when I try to run the script.
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot find Chrome binary
Any help will be appreciate!
The text was updated successfully, but these errors were encountered: