How to get only tweets from Snscrape?

Question:

After scraping data from Twitter using Snscrape, I am unable to get only tweets.
Under the column for tweet.sourceLabel, I am getting a mixture of twitter, instagram and foursquare.

import snscrape.modules.twitter as sntwitter
keyword = '(COVID OR Corona Vírus)'
maxTweets = 30
tweets = []

for i,tweet in enumerate(sntwitter.TwitterSearchScraper(keyword + ' since:2020-01-01 lang:pt').get_items()) :
    if i > maxTweets :
        break
    tweets.append([tweet.date, tweet.id, tweet.content, tweet.user.username, tweet.sourceLabel])
Asked By: fygeng go

||

Answers:

I’m not seeing any other social media other than Twitter for tweet.sourceLabel. I have fixed few typos in your code as well.

import snscrape.modules.twitter as sntwitter
keyword = '(COVID OR Corona Vírus)'
maxTweets = 30
tweets = []

for i,tweet in enumerate(sntwitter.TwitterSearchScraper(keyword + ' since:2020-01-01 lang:pt').get_items()) :
    if i > maxTweets :
        break
    tweets.append([tweet.sourceLabel])

print(tweets)

Output:
enter image description here

Answered By: Kulasangar
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.