Iceloof / GoogleNews

Script for GoogleNews
https://pypi.org/project/GoogleNews/
MIT License
316 stars 88 forks source link

0 Search Results #14

Closed dinahjoe closed 4 years ago

dinahjoe commented 4 years ago

I've tried this a couple of ways but I'm still not getting any search results... any idea what I'm doing wrong here? Code:

from GoogleNews import GoogleNews
googlenews = GoogleNews()
googlenews.search('dinosaur')
links = [googlenews.getlinks()]
for link in links:
    print(link)
mjlabe commented 4 years ago

getlinks() should return a list itself, so there is no need to put it in a list:

links = [googlenews.getlinks()]

Should be:

links = googlenews.getlinks()

On Thu, Feb 20, 2020, 7:18 AM Dinah J notifications@github.com wrote:

I've tried this a couple of ways but I'm still not getting any search results... any idea what I'm doing wrong here? Code:

from GoogleNews import GoogleNews googlenews = GoogleNews() googlenews.search('dinosaur') links = [googlenews.getlinks()] for link in links: print(link)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/HurinHu/GoogleNews/issues/14?email_source=notifications&email_token=AG3DIIPQP35DT4RXS5H3KVTRDZYJVA5CNFSM4KYNVC2KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IO67EOA, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG3DIINVVXJAKSBRB36VPGTRDZYJVANCNFSM4KYNVC2A .

dinahjoe commented 4 years ago

Thank you - I tried your suggestion still not getting any results. The code runs without errors and outputs an empty list. Here's what I tried:

from GoogleNews import GoogleNews

googlenews = GoogleNews()
googlenews.search('dinosaur')
links = googlenews.getlinks()
print(links)

I also tried adding a for loop to iterate through the list and print each element but in both cases I'm getting this output: []

HurinHu commented 4 years ago

I copy your code and run with this result,

['https://www.cnn.com/2020/02/17/world/dinosaurs-eggs-blood-warm-scn/index.html', 'https://scitechdaily.com/disease-found-in-60-million-year-old-dinosaur-tail-that-still-afflicts-humans-today/', 'https://www.theguardian.com/science/2020/feb/10/reaper-of-death-t-rex-dinosaur-species-canada', 'https://www.zmescience.com/science/dinosaur-names-complete-your-vocabulary-with-these-awesome-dinosaurs/', 'https://futurism.com/the-byte/dinosaur-walk-upside-down', 'https://nypost.com/2020/02/17/cancer-seen-in-humans-also-found-in-66-million-year-old-dinosaur-fossil/', 'https://www.foxnews.com/science/dinosaurs-were-warm-blooded', 'https://bgr.com/2020/02/18/dinosaur-prints-cave-ceiling-mystery/', 'https://www.newscientist.com/article/2233396-75-million-year-old-eggshells-suggest-most-dinosaurs-were-warm-blooded/', 'https://nypost.com/2020/02/15/the-top-6-places-in-the-world-to-go-dinosaur-hunting/']

So it should work, please check your network is not behind proxy and google is not block your IP, and update to the latest version of Google News.

Kind Regards,

Hurin Hu Web Developer https://hurin.iceloof.comhttps://hurin.iceloof.com/

On 21/02/2020, at 07:51, Dinah J notifications@github.com wrote:

print(links)

dinahjoe commented 4 years ago

Thank you I will try that and hopefully it will work for me.