1.terminal安装命令行pip install gnews -i https://pypi.tuna.tsinghua.edu.cn/simple
2.开启新的py粘贴上即可运行
from gnews import GNews google_news = GNews(language='en', country='US', period='7d', max_results=20) # 搜索新闻 news_list = google_news.get_news('Israel Palestine military conflict') for news in news_list: print(news['title']) print(news['published date']) print(news['url']) print(news['publisher']['title']) print('-' * 80).
2