Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Searching a query with Google's search techniques #66

Open
emremrah opened this issue May 21, 2021 · 3 comments
Open

Searching a query with Google's search techniques #66

emremrah opened this issue May 21, 2021 · 3 comments

Comments

@emremrah
Copy link
Contributor

Thanks for the great work. I would like to be able to use Google's search techniques as described here.

I tried to achieve this as follows:

googlenews = GoogleNews(lang='en', encode='utf-8')
# googlenews.search('coronavirus')  # with this, I saw some articles about Scotland. So I changed it to ->
googlenews.search('coronavirus -scotland')
news = googlenews.results()

But the news are still related to Scotland.

Is it possible to have this feature? It would be very good to have Google's search operators.

@HurinHu
Copy link
Member

HurinHu commented May 21, 2021

It seems google doesn't have exclude feature for the news at the moment, we might not able to create this feature at current stage.

@emremrah
Copy link
Contributor Author

emremrah commented May 21, 2021

Oh this is sad :( Okay then. This issue can be stay open as "feature request" if you would like to. It's a good feature IMO. Thanks for the work.

@meesterguyman
Copy link

meesterguyman commented Jul 20, 2022

I am attempting to do the following search:
googlenews.get_news('"big bank" -lender -national')

I didn't get any results, so I decided to look into this. As it turns out, Google doesn't like the url this produces, which includes pluses in between terms. This is a result of line #256:
key = "+".join(key.split(" "))

If you delete this line altogether, the pluses are gone, the url resolves correctly, and you get results. Since changing this single line will enable this additional functionality, might want to consider altering it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants