I am using the following python code to get the ad results for a query:
However, there are no ad results coming through on the response. When I google search "pest control" I see that there are search ads.
Is there a reason serpapi is not capturing the ad postings?
from serpapi import GoogleSearch
params = {
"q": "pest control",
"location": "Halifax, Nova Scotia, Canada",
"hl": "en",
"gl": "ca",
"api_key": "API_KEY"
}
search = GoogleSearch(params)
results = search.get_dict()
ads = results["ads"]
print(ads)
I used the above code to find the ads
It depends on Google search results and how the ads are set up. As @mark suggested, ads are shown in search without location (
gl
andhl
) parameters.