GithubHelp home page GithubHelp logo

the-javapocalypse / twitter-sentiment-analysis Goto Github PK

View Code? Open in Web Editor NEW
155.0 8.0 112.0 10 KB

This script can tell you the sentiments of people regarding to any events happening in the world by analyzing tweets related to that event

License: MIT License

Python 100.00%
tweets twitter-sentiment-analysis sentiment twitter python python3 tweepy nlp textblob sentiment-analysis

twitter-sentiment-analysis's Introduction

Twitter-Sentiment-Analysis

This script can tell you the sentiments of people regarding to any events happening in the world by analyzing tweets related to that event. It will search for tweets about any topic and analyze each tweet to see how positive or negative it's emotion is. You might want to check out this complete text and video based detailed tutorial link

alt text

Getting Started

First of all login from your Twitter account and goto Twitter Apps. Create a new app (How to create twitter app) and goto Keys and access tokens and copy Consumer Key, Consumer Secret, Access Token and Access Token Secret. We will need them later.

Installation

Download or Clone the repo, Navigate to the directory containing the files and run

python setup.py install

or if you have different versions of python installed then

python3 setup.py install 

to install the dependencies.

Usage

Once you have created an app on twitter and installed all the dependencies by running setup.py, open main.py and paste your Consumer Key, Consumer Secret, Access Token and Access Token Secret. After that save and run the script. You will be prompted to enter the keyword/hashtag you want to analyze and the number of tweets you want to analyze. Once the analysis is completed, a pie chart will be generated disclosing the results of analysis.

Built With

  • Python 3.6
  • tweepy
  • textblob
  • matplotlib

Contributing

  1. Fork it
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request

Authors

Muhammad Ali Zia

License

This project is licensed under the MIT License - see the LICENSE.md file for details

twitter-sentiment-analysis's People

Contributors

the-javapocalypse avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

twitter-sentiment-analysis's Issues

API call limit

How to avoid the following error?

Traceback (most recent call last):
File "tweet.py", line 30, in
for tweet in tweets:
File "/usr/local/lib/python3.7/dist-packages/tweepy/cursor.py", line 49, in next
return self.next()
File "/usr/local/lib/python3.7/dist-packages/tweepy/cursor.py", line 197, in next
self.current_page = self.page_iterator.next()
File "/usr/local/lib/python3.7/dist-packages/tweepy/cursor.py", line 108, in next
data = self.method(max_id=self.max_id, parser=RawParser(), *self.args, **self.kargs)
File "/usr/local/lib/python3.7/dist-packages/tweepy/binder.py", line 250, in _call
return method.execute()
File "/usr/local/lib/python3.7/dist-packages/tweepy/binder.py", line 234, in execute
raise TweepError(error_msg, resp, api_code=api_error_code)
tweepy.error.TweepError: Twitter error response: status code = 429

thanks

how to avoid the following error

Traceback (most recent call last):
File "C:\Users\HP\Desktop\New folder\main.py", line 145, in
sa.DownloadData()
File "C:\Users\HP\Desktop\New folder\main.py", line 27, in DownloadData
self.tweets = tweepy.Cursor(api.search, q=searchTerm, lang="eng").items(NoOfTerms)
File "C:\Users\HP\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\tweepy\cursor.py", line 40, in init
raise TweepyException('This method does not perform pagination')
tweepy.errors.TweepyException: This method does not perform pagination

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.