CSV error
Hello, I want to extract all tweets from the tennis player Djokovic in 2018. So I basically took the provided code "automate.py" and I just changed the username and added the time period (see code below).
However, when I run it, it extracts the tweets, but I am not able to get the desired output. I get the following error message "CRITICAL:root:twint.output:_output:CSV:Error:list indices must be integers or slices, not str list indices must be integers or slices, not str [x] output._output". I cannot find the error...
import twint
import schedule
import time
def jobone():
print ("Fetching Tweets")
c = twint.Config()
# choose username (optional)
c.Username = "djokernole"
# choose beginning time (narrow results)
c.Since = "2018-01-01"
# choose beginning time (narrow results)
c.Until = "2018-12-01"
# set limit on total tweets
c.Limit = 1000
# no idea, but makes the csv format properly
c.Store_csv = True
# format of the csv
c.Custom = ["date", "time", "username", "tweet", "link", "likes", "retweets", "replies", "mentions", "hashtags"]
# change the name of the csv file
c.Output = "filename.csv"
twint.run.Search(c)
def jobtwo():
print ("Fetching Tweets")
c = twint.Config()
# choose username (optional)
c.Username = "djokernole"
c.Since = "2018-01-01"
# set limit on total tweets
c.Until = "2018-12-01"
# set limit on total tweets
c.Limit = 1000
# no idea, but makes the csv format properly
c.Store_csv = True
# format of the csv
c.Custom = ["date", "time", "username", "tweet", "link", "likes", "retweets", "replies", "mentions", "hashtags"]
# change the name of the csv file
c.Output = "filename2.csv"
twint.run.Search(c)
Hi, I'm sorry but automate.py is quite outdated
You should edit c.Custom lines according the Wiki.
I'll update the code ASAP
Hi, I'm sorry but
automate.pyis quite outdatedYou should edit
c.Customlines according the Wiki.I'll update the code ASAP
I have same problem