Closed alinemati-uwm closed 10 months ago
from GoogleNews import GoogleNews
def show_routine(results): for num,page in enumerate(results): print(f"{num}. {page['date']} - {page['title']}")
keywords="covid cava de' tirreni" period='10d' google_news = GoogleNews(lang='it',period=period) google=GoogleNews(lang='it',period=period)
google_news.get_news(keywords) results_gnews=google_news.results(sort=True) show_routine(results_gnews)
google.search(keywords) results_google=google.results(sort=True) show_routine(results_google)
Have you tried to use
keywords="APPLE"
period='10d'
google_news = GoogleNews(period=period)
google=GoogleNews(period=period)
google_news.get_news(keywords)
results_gnews=google_news.results(sort=True)
print(results_gnews)
google.search(keywords)
results_google=google.results(sort=True)
print(results_google)
yes, I am looking to ahve 'desc': which return None for any code.
for example, if I run this code
keywords="APPLE" google.search(keywords) googlenews.get_page(2) or any page the result is
it was working until yesterday.
Hello, I've also been encountering this issue for the last 12 hours. Prior to that the google.search(keyword) portion of the code was working wonderfully. However, now it outputs 'NoneType' object is not iterable. I've noticed the google_news.get_news(keywords) option still runs properly. Any other ideas on how to get google.search to not return a NoneType object?
It seems google change its web page source code recently, I will fixed it ASAP if I have time, or if some else fix it, can merge into this project.
let me see if I can fix your code. I will keep you post it.
by the way, when I ran below code, it includes the desc. it might help. it is working now. @HurinHu
from GoogleNews import GoogleNews
googlenews = GoogleNews()
googlenews.clear()
import pandas as pd
googlenews = GoogleNews(lang='en')
googlenews.get_news('india road accident')
googlenews.search('india road accident')
result_0 = googlenews.page_at(1)
desc_1 = googlenews.get_texts()
link_1 = googlenews.get_links()
link = googlenews.get_links()
for i in list(range(2, 5)):
result = googlenews.page_at(i)
desc = googlenews.get_texts()
link = googlenews.get_links()
desc_1 = desc_1 + desc
link_1 = link_1 + link
... rest of code convert to pandas
...
Hello again, I wanted to follow up to see if anyone has resolved the issue? I still received the same 'NoneType' object output this morning. I could also make an attempt at updating it over the weekend if others haven't been able to work on it. Thank you!
Not yet. I am try to later.
New release v1.6.9 solved this issue, but .total_count()
is not working with .search()
anymore.
thanks for update, I can see two bugs there
I search for chatgot to check
Mycode:
from GoogleNews import GoogleNews googlenews = GoogleNews() googlenews.enableException(True) googlenews.set_lang('en') googlenews.set_period('1d') googlenews.set_time_range('08/11/2023','02/28/2020') googlenews.set_encode('utf-8') googlenews.search('Chatgpt') result = googlenews.page_at(2) result
My result:
[{'title': 'Hackers take on ChatGPT with support from White House', 'media': 'CNN', 'date': '6 hours ago', 'datetime': datetime.datetime(2023, 8, 11, 20, 8, 33, 681797), 'desc': '', 'link': '/url?esrc=s&q=&rct=j&sa=U&url=https://www.cnn.com/videos/world/2023/08/11/exp-hackers-ai-vegas-lkl-081102pseg2-cnni-world.cnn&ved=2ahUKEwi11JzzhNaAAxUxm1YBHTz2Dx04ChDF9AF6BAgDEAI&usg=AOvVaw14nsFJTPwZeSPlNUzqrOE5', 'img': 'data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='},
Hello , when I ran this line of code
googlenews.search('APPLE')
return is
'NoneType' object is not iterable
googlenews.get_page(2) 'NoneType' object is not iterable