目前,我正尝试使用python从twitter上搜索“2015-02-01 00:00:00”和“2022-05-04 00:00:00”之间的所有tweet。然而,我的输出开始于2022-05-03 23:58:59,结束于2022-04-25 13:15:04。
import twint
import nest_asyncio
import pandas as pd
nest_asyncio.apply()
c = twint.Config()
c.Store_csv = True
c.User_full = True
search = ['#Pets OR #People OR Pets OR People']
c.Search = search
c.Since = '2015-02-01 00:00:00'
c.Until = '2022-05-04 00:00:00'
c.Pandas = True
twint.run.Search(c)
df = twint.storage.panda.Tweets_df我的输出和“.”类似在日期范围之间的其他推特。
产出:
1521640495159693314 2022-05-03 23:58:59 +0000 <vtv> @jeff #Pets
....
....
....
1518579343643004928 2022-04-25 13:15:04 +0000 <> #People; 发布于 2022-08-19 18:07:19
您应该尝试取出大括号并将字符串与关键字直接放在一起:
import twint
import nest_asyncio
import pandas as pd
nest_asyncio.apply()
c = twint.Config()
c.Store_csv = True
c.User_full = True
c.Search ='#Pets OR #People OR Pets OR People'
c.Since = '2015-02-01 00:00:00'
c.Until = '2022-05-04 00:00:00'
c.Pandas = True
twint.run.Search(c)
df = twint.storage.panda.Tweets_dfhttps://stackoverflow.com/questions/72116571
复制相似问题