Skip to content
Snippets Groups Projects
Commit b90fa4c3 authored by Braun, Fabian's avatar Braun, Fabian
Browse files

Upload New File

parents
No related branches found
No related tags found
No related merge requests found
%% Cell type:code id:cbd16dcf-4126-482e-9ceb-092e39e5c9db tags:
``` python
import tweepy
from textblob import TextBlob
consumer_key = "gRgxkWG&dU*2&J@6S*3MDXoT!pJALE38V$b462Lz%jGbdPvjUe"
consumer_secret = "cirBr#4ykVM38mD7@6jgMwmBUHzjD$8r&Rt@7Sa^vjcXau4K9$"
access_token = "vSb9wJr%RjAhhvd^$qUu3U$4d#zy6pHx#XPud$Fgu&p7hzR8p!"
access_token_secret = "gxHkNcsJL!d9^t^J3FTVApXtHLKuh2Pm3rZA#vu^!oKJH^gU5%"
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
search_query = "Ampel"
tweet_count = 1000
tweets = tweepy.Cursor(api.search, q=search_query, lang="de").items(tweet_count)
positiveTweets = 0
negativeTweets = 0
neutralTweets = 0
for tweet in tweets:
analysis = TextBlob(tweet.text)
polarity = analysis.sentiment.polarity
if polarity > 0:
positiveTweets += 1
elif polarity < 0:
negativeTweets += 1
else:
neutralTweets += 1
print(search_query, tweet_count, positiveTweets, negativeTweets, neutralTweets)
```
%% Output
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Cell In[1], line 1
----> 1 import tweepy
2 from textblob import TextBlob
4 consumer_key = "gRgxkWG&dU*2&J@6S*3MDXoT!pJALE38V$b462Lz%jGbdPvjUe"
ModuleNotFoundError: No module named 'tweepy'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment