Reputation: 15
I am using the following library to extract google search urls:
from googlesearch import search
This is the function that performs the google search:
search(query, tld='com', lang='en', num=10, start=0, stop=None, pause=2.0)
My question is: How do I use this function to exclude certain domains in my search results?
Upvotes: 1
Views: 547
Reputation: 3775
If you want use search interface to exclude a domain, add an argument
extra_params={'-site' : 'youtube.com'}
e.g.
search(query,
tld='com',
lang='en',
num=10,
start=0,
stop=None,
pause=2.0,
extra_params={'-site' : 'youtube.com'}
)
Alternatively, you can just append -site:youtube.com
or whatever needed into your query.
Upvotes: 2