Home > Software engineering >  Can I google search using python in combination with RegEx?
Can I google search using python in combination with RegEx?

Time:05-18

I am trying to use python to google search to fetch results using a specific RegEx. Is this possible?

CodePudding user response:

You can use the Google's Python package googlesearch-python:

pip install googlesearch-python

It's then as simple as specifying what you want to search, how many items you want returned, and the language you want to search in. Example:

googlesearch.search(str: "stackoverflow", int: num_results=10, str: lang="en") -> list

Reference: https://github.com/Nv7-GitHub/googlesearch

CodePudding user response:

In theory you could using a scraper library like BeautifoulSoup but given Google is protecting its services, you might face a captcha in your results. You can do this legit with Google Search Console

  • Related