下面是我搜集有关家庭暴力新闻的代码。这段代码在我第一次使用时运行得很好。但当时我只覆盖了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)非常感谢!
发布于 2021-01-24 02:53:49
我找到了答案。我写错了日期格式。应该是2020年1月24日
https://stackoverflow.com/questions/65862968
复制相似问题