Search code examples
pythontwittertweepytwitterapi-python

Tweepy mining result just ends in the middle of the tweet with "..."


Hello so I am mining tweets using tweepy with this following code

api_key = ""
api_secret = ""
consumer_token = ""
consumer_token_secret= ""

auth = tweepy.OAuthHandler(api_key, api_secret)

auth.set_access_token(consumer_token,consumer_token_secret)


api = tweepy.API(auth)

search_words = "new normal -filter:retweets"
date_since = "2020-06-30"
tweets = tweepy.Cursor(api.search,
              q=search_words,
              lang="id",
              since=date_since).items(1000)
with io.open('file.csv', 'w', newline='', encoding="utf-16") as file:
         writer = csv.writer(file, quoting=csv.QUOTE_ALL)
         writer.writerow(["Comment"])
         for tweet in tweets:
             writer.writerow([tweet.text])

I notice when the results are tweet with an image, the result just ends in the middle of the tweet with "...". For example

Bhabinkamtibmas desa Cipurwasari sambangi masyarakat dan berikan Himbauan Kamtibmas serta himbauan new normal pada… https://t.co/*********

New Normal masih bingung apa aja yang harus disiapkan? #sinokkemayu bantu kamu siapkan kebutuhan saat #newnormal ni… https://t.co/*********

Any solution so that I can get the whole text?


Solution

  • Add tweet_mode=extended to your API call.