ranahaani / GNews

A Happy and lightweight Python Package that Provides an API to search for articles on Google News and returns a JSON response.
https://pypi.org/project/gnews/
MIT License
745 stars 107 forks source link

Issue on setting date range #38

Closed plim001 closed 2 years ago

plim001 commented 2 years ago

Hi,

Below is the code provided, but I cant seem to set the date range

image

ehsong commented 2 years ago

I also have the same issue. I used the tuple (2022, 6, 11) but this gave errors. I also tried defining the objects before but this did not work either. How do I pass the date and max_results options?

from gnews import GNews
google_news = GNews()
google_news.results = 100
google_news.language = 'english'

google_news.start_date = (2022, 6, 11)
google_news.end_date = (2022, 7, 11)
vietnam_news = google_news.get_news('Vietnam')

print(vietnam_news[0])

Also as per comment below, having an option of collecting more than 100 results would be useful too.

ranahaani commented 2 years ago

Issue has been fixed https://github.com/ranahaani/GNews/pull/41

gianandreabertello commented 2 years ago

Issue has been fixed #41

Period is working with the new approved code But I cannot make the start_date end_date working. I tried both the ("2021, 7, 11") format and (2021, 7, 11) Can you help me? Thank you