dataabc / weibo-crawler

新浪微博爬虫,用python爬取新浪微博数据,并下载微博图片和微博视频
3.47k stars 770 forks source link

报错“ValueError: time data 'Fri Jan 15 08:36:13 +0800 2021' does not match format '%Y-%m-%d'” #158

Open Lemanxiaoyu opened 3 years ago

Lemanxiaoyu commented 3 years ago

之前爬取正常,爬了60个账号左右报错:ValueError: time data 'Fri Jan 15 08:36:13 +0800 2021' does not match format '%Y-%m-%d',请教一下,应该如何修改呢?下面是all.log文件的内容 Progress: 0%| | 0/529 [00:00<?, ?it/s]time data 'Fri Jan 15 18:12:14 +0800 2021' does not match format '%Y-%m-%d' Traceback (most recent call last): File "weibo.py", line 688, in get_one_page wb['created_at'], '%Y-%m-%d') File "D:\Anaconda3\lib_strptime.py", line 577, in _strptime_datetime tt, fraction, gmtoff_fraction = _strptime(data_string, format) File "D:\Anaconda3\lib_strptime.py", line 359, in _strptime (data_string, format)) ValueError: time data 'Fri Jan 15 18:12:14 +0800 2021' does not match format '%Y-%m-%d'

dataabc commented 3 years ago

感谢反馈。

普通情况下日期都是yyyy-mm-dd形式或者类似的,上面的是“Fri Jan 15 08:36:13 +0800 2021”,是不是相关账号的显示语言是英文?

Lemanxiaoyu commented 3 years ago

感谢反馈。

普通情况下日期都是yyyy-mm-dd形式或者类似的,上面的是“Fri Jan 15 08:36:13 +0800 2021”,是不是相关账号的显示语言是英文?

不是的,我爬的用户id:1977902724,用户昵称:央广神州之声;账号的显示语言是中文,我又换了好几个爬取的用户id还是报这个错误: Progress: 0%| | 0/529 [00:00<?, ?it/s]time data 'Fri Jan 15 18:12:14 +0800 2021' does not match format '%Y-%m-%d' Traceback (most recent call last): File "weibo.py", line 670, in get_one_page wb['created_at'], '%Y-%m-%d') File "D:\Anaconda3\lib_strptime.py", line 577, in _strptime_datetime tt, fraction, gmtoff_fraction = _strptime(data_string, format) File "D:\Anaconda3\lib_strptime.py", line 359, in _strptime (data_string, format)) ValueError: time data 'Fri Jan 15 18:12:14 +0800 2021' does not match format '%Y-%m-%d'

dataabc commented 3 years ago

明白了,应该是微博接口有改动。刚才我太想当然了,我稍后修复下,太感谢了。

Lemanxiaoyu commented 3 years ago

明白了,应该是微博接口有改动。刚才我太想当然了,我稍后修复下,太感谢了。

好的,辛苦大佬啦,非常感谢,修复之后麻烦给我说一下非常非常感谢大佬!!!

dataabc commented 3 years ago

客气了,已经修复了,如果还有问题欢迎继续讨论

zitup commented 3 years ago

客气了,已经修复了,如果还有问题欢迎继续讨论

感谢,刚遇到就已经解决了~

Lemanxiaoyu commented 3 years ago

感谢~问题已经解决了

yuqwang913 commented 3 years ago

客气了,已经修复了,如果还有问题欢迎继续讨论

您好,我刚刚更新了git,这个问题依然没有修复,请问能否再帮忙查一下bug?

dataabc commented 3 years ago

@yuqwang913

是不是运行的旧文件?如果方便,能否提供出错的id,方便调试,感谢。

HikarisMH commented 3 years ago

File "C:\Users\Joseph\Downloads\weibo-crawler-master (3)\weibo-crawler-master\weibo.py", line 673, in get_one_weibo weibo_info['created_at']) File "C:\Users\Joseph\Downloads\weibo-crawler-master (3)\weibo-crawler-master\weibo.py", line 544, in standardize_date temp = datetime.strptime(created_at, '%c') File "C:\Python27\Lib_strptime.py", line 332, in _strptime (data_string, format)) ValueError: time data 'Wed Jun 03 00:00:02 2020' does not match format '%c'

几乎所有id都报这个错,但是日期和格式是相对应的

dataabc commented 3 years ago

@HikarisMH

我刚刚运行了下,没有问题,不知道是不是程序不是最新的,或者使用python3,如果还有问题欢迎继续讨论。