用谷歌新闻抓取报纸文章标题

问题描述

以下是我用于抓取有关家庭暴力的新闻的代码。这段代码在我第一次使用时运行良好。但当时我只涵盖了 2-3 个月的时间,我在更宽的时间范围内重新尝试,它返回一个空字符串。为什么会这样,我该如何解决?

from GoogleNews import GoogleNews
from newspaper import Article
import pandas as pd

googlenews = GoogleNews(start='24/01/2020',end='23/01/2021')
googlenews.search('Domestic violence')
result = googlenews.result()
df = pd.DataFrame(result)
print(df.head())

for i in range(2,20):
    googlenews.getpage(i)
    result = googlenews.result()
    df = df.append(result)
    df = pd.DataFrame(df)

非常感谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)