1

I faced an issue when I want to scrape data from Twitter configuring Since and Until. I use the format like this '2020-01-01 00:00:00':

config = twint.Config()
# ...
config.Since = "2020–04–29 00:00:00"
config.Until = "2020–05–29 00:00:00"
twint.run.Search(config)

and this error shows to me

ValueError: time data '2020–04–29 00:00:00' does not match format '%Y-%m-%d %H:%M:%S'

do you have any solution for this?

Wolf
  • 9,679
  • 7
  • 62
  • 108
jpko
  • 21
  • 3

2 Answers2

3

This was driving me crazy, but the following works perfectly

import datetime
since = datetime.datetime(2021, 1, 1)
until = datetime.datetime(2021, 5, 1)
print(since)
print(until)

That gets it into a format TWINT will accept. Then...

c.Since = str(since) 
c.Until = str(until)

This worked perfectly for me

Robert Chestnutt
  • 302
  • 3
  • 13
2

try with this format "%Y-%m-%d %H:%M:%ss"

TimeFormat

ss: two digit second in minute (00-59). S: fractional seconds, up to nine (9) digits.