1

With the code twint -s 'Nike SB Dunk Low Safari' --since "2020-03-07 00:00:00" --until "2020-03-14 00:00:00" --count -o file1.csv --csv we want to get the number of Tweets as output from Twint (Twitter). At the moment, we get the full data load (tweets specifications + number of tweets). But, we only want the number of tweets. The format (.csv, prompter, json, ...) of the data is not important. Any help is highly appreciated!

Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158

1 Answers1

0

If --count isn't working, you will have to count the output directly.

For example, assuming the .csv file prints a Tweet on each line, run this:

python3 -c "print( len( open( 'file1.csv').readlines() ) )"

That will print out the number of lines in the CSV file - which should be the number of Tweets retrieved by Twint.

Terence Eden
  • 14,034
  • 3
  • 48
  • 89
  • Hey Terence! Thank you very much for your fast reply. We tried the code and it does not give back any error, but also does not print out the number of lines in the csv file. Could you give any advice on that? That would be great! – Steffen Sturm Apr 17 '20 at 10:21
  • Is any data being written to the CSV file? – Terence Eden Apr 17 '20 at 13:24
  • For a sample (~ 1'000 pieces) we like to find out how many tweets about a piece have been posted within a certain time. We created the 1'000 search commands (see code above for example). The difficulty is to extract the "count" of the tweets per shoe model so that we can generate a column containing only the number of tweets for each shoe. Now, the count is displayed at the end of the output in the terminal, but not in the CSV. Counting lines in the CSV doesn't work (tweets aren't separated/listed properly). Is there a possibility within the terminal output to extract only the count directly? – Steffen Sturm Apr 18 '20 at 07:55