Skip to content

Commit

Permalink
fix: added user agent to get the search result from search engine
Browse files Browse the repository at this point in the history
  • Loading branch information
iamatulsingh committed May 27, 2024
1 parent 8b43c0e commit ca93e64
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pinscrape/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "3.2.1"
__version__ = "3.2.2"
2 changes: 1 addition & 1 deletion pinscrape/pinscrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def start_scraping(max_images, key=None, proxies: dict = {}):
keyword = key + " pinterest"
keyword = keyword.replace("+", "%20")
url = f'https://www.bing.com/search?q={keyword}&first=1&FORM=PERE'
res = get(url, proxies=proxies)
res = get(url, proxies=proxies, headers={"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0"})
searched_urls = PinterestImageScraper.get_pinterest_links(res.content, max_images)

return searched_urls, key.replace(" ", "_"), res.status_code
Expand Down

0 comments on commit ca93e64

Please sign in to comment.