Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added CLI input #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion jobtweets.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import tweepy
from tweepy import OAuthHandler
from textblob import TextBlob
import sys
import argparse

class TwitterClient(object):
'''
Expand Down Expand Up @@ -85,8 +87,14 @@ def get_tweets(self, query, count = 10):
print("Error : " + str(e))

def main():
tweets = []
category = []
cli_input = raw_input("Search your query : ")
api = TwitterClient()
tweets = api.get_tweets(query = 'Job Opportunities', count = 500)
for each_comma in cli_input.split(','):
category.append(each_comma.strip(" "))
for t in category:
tweets += (api.get_tweets(query = t, count = 500))
ptweets = [tweet for tweet in tweets if tweet['sentiment'] == 'positive']

print("Positive tweets percentage: {} %".format(100*len(ptweets)/len(tweets)))
Expand Down