Giter VIP home page Giter VIP logo

vinitshahdeo / jobtweets Goto Github PK

View Code? Open in Web Editor NEW
112.0 3.0 80.0 1.42 MB

:mag: This project is about searching the twitter for job opportunities using popular hashtags and applying sentiment analysis on this. :hash: :bird:

Home Page: https://vinitshahdeo.github.io/jobtweets/

License: MIT License

Python 100.00%
python sentiment-analysis tweepy textblob jobsearch jobs twitter twitter-api job-opportunities hashtag

jobtweets's Introduction

Job Opportunities using Twitter

Twitter Sentiment Analysis using Python

Generic badge Generic badge Generic badge

The project is about searching the twitter for job opportunities using popular #hashtags and applying sentiment analysis on this.

GitHub repo size GitHub code size in bytes GitHub top language

Few popular #hashtags

jobs Careers JobOpening

FreshHiring Recruitments JobOpportunities

Motivation

Twitter is all about enabling users to send out brief messages to large audiences. If you haven’t been taking advantage of Twitter as a job search tool, it’s time to jump in. When used intelligently, Twitter can have a profound impact on your job search success – or lack thereof. Small steps can help you turn Twitter into your own personal job search platform. Try them today and see what a difference they make in your overall job search success.

About the Project

What is Sentiment Analysis?

Sentiment Analysis is the process of ‘computationally’ determining whether a piece of writing is positive, negative or neutral. It’s also known as opinion mining, deriving the opinion or attitude of a speaker.

Steps involved in this project

3 major steps in jobtweets.py code :

  1. Authorize twitter API client.
  2. Make a GET request to Twitter API to fetch tweets for a particular query.
  3. Parse the tweets. Classify each tweet as positive, negative or neutral.

Made with Python Made with love Makes people smile

Explanation

  • First of all, I've created a TwitterClient class. This class contains all the methods to interact with Twitter API and parsing tweets. We use __init__ function to handle the authentication of API client.

  • In get_tweets function, I have used fetched_tweets = self.api.search(q = query, count = count) to call the Twitter API to fetch tweets. 'query' is basically, the hashtags.

  • In get_tweet_sentiment I've used textblob module. analysis = TextBlob(self.clean_tweet(tweet))

  • clean_tweet method to remove links, special characters, etc. from the tweet using some simple regex.

  • I have used sentiment.polarity method of TextBlob class to get the polarity of tweet between -1 to 1.

if analysis.sentiment.polarity > 0:
       return 'positive'
elif analysis.sentiment.polarity == 0:
       return 'neutral'
else:
       return 'negative'
  • Finally, I've printing the percentage of positive, negative and neutral tweets about a #hashtag(query).

Note - You can change the hashtags by changing query = 'WRITE YOUR OWN HASHTAG'

tweets = api.get_tweets(query = 'Job Opportunities', count = 500)

Libraries Used

tweepy textblob

  • Tweepy - tweepy is the python client for the official Twitter API.
  • TextBlob - textblob is the python library for processing textual data.

Installation

  • Install Tweepy using pip command: pip install tweepy
  • Install TextBlob using pip command: pip install textblob

How to run?

python

  • Get started with Twitter API by signing up for Twitter Developer Account.
  • In order to fetch tweets through Twitter API, you need to register an App through your twitter account.
  • Follow this link to register your app.
  • Get the API keys. Need help, follow this link
  • Open jobtweets.py and replace 'XXXXXXXXXXXX' with your API keys.
        consumer_key = 'XXXXXXXXXXXX'
        consumer_secret = 'XXXXXXXXXXXX'
        access_token = 'XXXXXXXXXXXX'
        access_token_secret = 'XXXXXXXXXXXX'
  • Run python jobtweets.py
  • It may take a minute to fetch the results from Twitter. Make sure that you've proper internet connection.

Project Reports

PPT report

Useful Links

Related Work

Sentiment Analysis GitHub top language

Twitter Sentiment Analyzer - A web app to search the keywords(Hashtags) on Twitter and analyze the sentiments of it. The source code is written in PHP and it performs Sentiment Analysis on Tweets by using the Datumbox API.

Contributing

PRs Welcome GitHub issues GitHub pull requests GitHub commit activity

  • Clone this repository:
git clone https://github.com/vinitshahdeo/jobtweets.git

Need help?

Facebook Instagram LinkedIn

📧 Feel free to contact me @ [email protected]

GMAIL Twitter Follow

License

FOSSA Status

MIT © Vinit Shahdeo

Author

Vinit Shahdeo

GitHub license GitHub forks GitHub stars GitHub followers


🤗
Check out my other projects here!


jobtweets's People

Contributors

vinitshahdeo 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

jobtweets's Issues

Security: Vulnerable Twitter API keys

Description

The Twitter API keys should never be added to a code file because of security reasons. Exchanging the files with someone or uploading them somewhere can result in a potential security threat (An example commit from your repository (I hope they have been regenerated now) - here).

Possible fix

Using environment variables one can store these keys somewhere else (not in the file) but can still access them using the os library. This is the standard way of using sensitive API keys in a python project.

Edit: Just saw #35 oops, my bad.

Taking query(#hashtags) as input from user

Currently, the query is hardcoded in jobtweets.py i.e.

tweets = api.get_tweets(query = 'Job Opportunities', count = 500)

Taking the input for query (i.e. #hashtag) from the user through CLI seems better!

Question to answer?

Can we take input as a comma-separated string for processing multiple hashtags at a time?

Enter hashtags: jobs, openings, job opportunities

Note:

  • Make changes only in jobtweets.py
  • Your PR should not break the functionality of the existing code.
  • Add me( @vinitshahdeo ) as reviewer
  • Do not make any changes to other files.

variable to access a twitter should be loaded from .env file

these variables must be loaded from the .env file so they don't have to enter the code just to modify them
consumer_key = 'XXXXXXXXXXXX'
consumer_secret = 'XXXXXXXXXXXX'
access_token = 'XXXXXXXXXXXX'
access_token_secret = 'XXXXXXXXXXXX

and this issue could be assigned to me

consumer & access token keys are exposed

The keys used to authenticate with Twitter API are exposed. I think you already know this but you might forgot to .gitignore the personal keys. Its not safe to expose these keys out as recommended by twitter.

Just a suggestion 🙃 🤗

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.