Giter Club home page Giter Club logo

Comments (4)

rizkysifaul avatar rizkysifaul commented on June 18, 2024

I found this problem too when I want to get specific keywords, but I found that something interesting, you can slightly lower the range of the date because at the first attempt I found a NoneType problem too.

My suggestion is lowering the range of date, maybe just for 1-2 days and one keyword first, and then you can increasing step by step.

from GoogleNews import GoogleNews
googlenews = GoogleNews()

googlenews = GoogleNews(start='17/02/2021',end='22/02/2021')

news_keywords = ["Apple","Microsoft"etc]

check = ['17/02/2021','18/02/2021','19/02/2021','20/02/2021','21/02/2021','22/02/2021']
cols =['Date','Title','Description','provider','company']
lst = []
for i in news_keywords:
print(i)
googlenews.search(i)
googlenews.get_page(1)
googlenews.get_page(2)
etc

currently returns
Apple
'NoneType' object is not iterable
'NoneType' object is not iterable
'NoneType' object is not iterable

for multiple companies over this time period.
Have ran the same code for each week over the past months so unsure if mabye im doing something wrong with latest update?

from googlenews.

GregorKerr1996 avatar GregorKerr1996 commented on June 18, 2024

hmm, needing data for the past week so this doesn't necessarily fix my problem, but thanks for your suggestion

from googlenews.

wonghinyan avatar wonghinyan commented on June 18, 2024

Likewise I have found the same
'NoneType' object is not iterable

from googlenews.

HurinHu avatar HurinHu commented on June 18, 2024

There are few mistakes in your code, you only need to create constructor once, and the date format should be mm/dd/yyyy, and the result should be retrieved by googlenews.results(), and please add delay few seconds within the loop, if you request too frequent, Google may block your IP. The return list should be something like [{'title':'xxx','media':'xxx','date':'xxx','datetime':'xxx','desc':'xxx','link':'xxx','img':'xxx'},{...}...]

from GoogleNews import GoogleNews
- googlenews = GoogleNews()
- (it is not necessary here, it will be reset by the next line)
- googlenews = GoogleNews(start='17/02/2021',end='22/02/2021')
+ googlenews = GoogleNews(start='02/17/2021',end='02/22/2021')

...

googlenews.search(i)
googlenews.get_page(1)
googlenews.get_page(2)
+ result = googlenews.results()
+ time.sleep(5)

from googlenews.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.