From 02ba246d3646c03f82208726ba8989cf301dd17f Mon Sep 17 00:00:00 2001
From: Alessandro Elias <ale.elias2011@gmail.com>
Date: Wed, 10 Jul 2019 15:42:20 -0300
Subject: [PATCH] Fix bug; set count of tweets outside of loop

Signed-off-by: Alessandro Elias <ale.elias2011@gmail.com>
---
 twitter-api-example.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/twitter-api-example.py b/twitter-api-example.py
index 120cc0a..c503032 100755
--- a/twitter-api-example.py
+++ b/twitter-api-example.py
@@ -11,9 +11,11 @@ import logging
 logging.basicConfig(level=logging.INFO)
 
 def search(api, sincedate, untildate, csvFile, jsonFile):
-    searchQuery = '((cota OR cotas OR universidade OR universidades) AND (racial OR raciais)) OR ((universidade OR universidades) AND (cota OR cotas))'
-    maxTweets = 10000000
+    ##### You can change here
+    # Variable with the desireable query.
+    searchQuery = ''
 
+    maxTweets = 10000000
     tweetsPerQry = 100  # this is the max the API permits
 
     csvWriter = csv.writer(csvFile)
@@ -61,8 +63,8 @@ def search(api, sincedate, untildate, csvFile, jsonFile):
                     tweet.lang,
                     tweet.text.encode('utf-8')])
                 tweetCount += len(new_tweets)
-                print("Downloaded {0} tweets".format(tweetCount))
-                max_id = new_tweets[-1].id
+            print("Downloaded {0} tweets".format(tweetCount))
+            max_id = new_tweets[-1].id
         except tweepy.TweepError as e:
             print("some error: " + str(e))
             continue
-- 
GitLab