I’m having a problem collecting Arabic tweets and save them in a CSV file
when I open the CSV file the tweets is like this
here is the code
import tweepy
import csv
# Twitter API credentials
consumer_key = "..."
consumer_secret = ".."
access_key = "..."
access_secret = "...."
auth= tweepy.OAuthHandler(consumer_key,consumer_secret)
auth.set_access_token(access_key,access_secret)
api= tweepy.API(auth,wait_on_rate_limit=True)
csvFile=open('tweets.csv','a',newline='')
csvWriter=csv.writer(csvFile)
#truncated=False,
for tweet in tweepy.Cursor(api.search,q="اكتئاب",since="2021-01-30",truncated=False,tweet_mode="extended", count=1).items():
if (not tweet.retweeted) and ('RT @' not in tweet.full_text):
csvWriter.writerow([tweet.full_text.encode('utf-8-sig')])
please I need your help :'(
2
Answers
I found my answer that if I add these two lines to my code it will fix it
the source
newline=''
to theopen(...)
statementCursor()
tweet_mode='extended'
full_text
instead of justtext
to get the text of each tweet.