Skip to content
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
17 changes: 15 additions & 2 deletions jobtweets.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,22 @@ def get_tweets(self, query, count = 10):

def main():
api = TwitterClient()
tweets = api.get_tweets(query = 'Job Opportunities', count = 500)
# tweets = api.get_tweets(query = 'Job Opportunities', count = 500)

tweets = []
subjects = []
cli = input('Enter #hashtag to search: ')

for comma in cli.split(','):
# print(comma)
subjects.append(comma.strip(' '))
# print(subjects)

for sub in subjects:
tweets += (api.get_tweets(query = sub, count = 500))

ptweets = [tweet for tweet in tweets if tweet['sentiment'] == 'positive']

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

ntweets = [tweet for tweet in tweets if tweet['sentiment'] == 'negative']
Expand Down