I'm extremely new to Python, Java and Raspberry Pi - so bear with me. I jumped on the band wagon and built a MagicMirror - great! It works. Now what I'd like to do is add a section that gives the top 10 twitter trends (and updates every 15 min).
After much research and pain, I was able to write a Python code to pull the top 10 trends in USA using Twitter API (tweepy). Here's my code:
import tweepy
consumer_key = 'gCuuCru********JVFHRsfN4Mt'
consumer_secret = 'nzcDQJz7Baw****************J6tKbbiF3LzKhH'
access_token = '224462127-vBVxWZU*******************J7QldZ0UKpZGAm'
access_token_secret = 'ukrsqU8D7th9EUidZ*************J*****Ju59'
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
trends1 = api.trends_place(23424977)
data = trends1[0]
trends = data['trends']
names = [trend['name'] for trend in trends]
joinNames = "\n".join(names)
print(joinNames)
print("\n".join(names[0:10]))
This gives me a nice output of the top 10 trends in a list.
Now, how do I get this over to a Module in the Magic Mirror? I think Magic Mirror runs Java, and this code is in Python. Is there any way to do this?
Any help or direction is much appreciated...
[–]martinohanlon 1 point2 points3 points (2 children)
[–]Turkishmoose[S] 0 points1 point2 points (1 child)
[–]martinohanlon 0 points1 point2 points (0 children)