The telecom industry's largest conference and exhibition is always a combination of tech demos, big-name speakers, and behind-the-scenes talks and negotiations. This year was no exception.
What everyone was talking about
To identify the topics that created the most buzz at this year's MWC, we streamed two hours worth of tweets after the conference ended using Twitter's Streaming API and Tweepy, a Python wrapper for the same.
After collecting every tweet containing “MWC” or “MobileWorldCongress,” we removed punctuation, retweets, and then sorted all terms used based on frequency:
After eliminating tweets containing MWC or 2017, we can use this data to create a list of the most-tweeted about releases at Mobile World Congress. In order of popularity:
- Nokia 3310: It's the classic brick phone you know and love, revived in partnership with HMD. It's $52, and it has Snake. The unique blend of nostalgia and simplicity that this phone embodies (only in 2017 can you “unplug” by getting a phone) has made it a hot topic of discussion.
- Huawei P10: The Chinese manufacturer, which hasn't always used its appearance at MWC as an opportunity to show off its flagship line, changed that this year. It's being suggested that the P10's unveiling marks the start of a new attempt by Huawei to start winning over European consumers.
- LG G6: LG's rebooted G6 model took home several awards at Mobile World Congress, including Best Phone and Best in Show. Interestingly, it will be one of the first non-Google Pixel phones out there to ship with the Google Assistant installed.
When we ran the same type of frequency analysis on the hashtags used to talk about MWC, we saw some interesting and divergent results:
Mobile World Congress-related terms took first place again. Next, though, came not the 3310, but:
- #IoT: The Internet of Things came out of MWC with many people talking about it, largely due to the impressive showcase of IoT solutions shown at GSMA's Innovation City exhibit. Business Insider now predicts that 22.5 billion IoT devices will be installed in 2021 (about triple what there is today) as a result of $4.8 trillion in aggregate investment.
- #Google: Google owns Android, so it should be no surprise that the “pure Google” phone was a hot topic of discussion all throughout the conference. Then there was Google Assistant, pitted up against Amazon Alexa, and Google's extensive “Android Global Village.” Lots of conversations about Mobile World Congress involved Google in one way or another.
- #Android: Apple's presence at trade shows in general has been virtually nonexistent since the mid-2000s. For the other big names in mobile, MWC is the place to unveil the newest entrants in their flagship lines. 2017, Android's tenth anniversary, was no exception, and the top Android manufacturers were all out at MWC.
Now for the technique that we used to prove the buzziest events above!
Getting started with the Twitter Streaming API
Getting started using the Twitter Streaming API yourself requires you to get app credentials, which you can acquire by setting up a developer account on Twitter. Go to https://apps.twitter.com/ and select Create New App.
After filling in all the information (when you're asked for a website, you can use a placeholder like a social media profile) click on the app you created. You'll see a button that says Keys and Access Tokens at the top of the page, and when you click on that, you'll see a page with the four different credentials you need to get started:
- Consumer Key
- Consumer Secret
- Access Token
- Access Token Secret
Don't upload these to Github, at least not in a private repo, or put them up on a blog or share them everywhere.
Twitter's APIs limit your rate pretty reliably if you attempt to connect too many times—and extend your lockout exponentially in time for every additional request you make after being blocked. If you run into the rate limiter while you're playing around with the API, know that that's tied to your token credentials.
Using Tweepy to start streaming tweets
Tweepy is a Python library that makes it at lot easier to quickly get started with the Twitter Streaming API. You have a few different ways you can go about installing it:
pip install tweepy
git clone git://github.com/tweepy/tweepy.git
python setup.py install
Once you have Tweepy installed you're ready to write your script. First, import Tweepy into your project along with some important methods. Then, define the credentials that you created earlier and authenticate yourself to the Twitter API through Tweepy. Here's what all of that looks like:
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
consumer_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxx'
consumer_secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
access_token = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
access_secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
auth = OAuthHandler(consumer_key, consumer_secret)
api = tweepy.API(auth)
Then, you'll want to set up a proper stream that will take the tweets you want and output them to a JSON file. By default, Tweepy returns a stream of data that's a little bit hard to process:
Instead, use this code (courtesy of Marco Bonzanini) to stream each tweet to a new line in a JSON file:
def on_data(self, data):
with open('nameofyourfilehere.json', 'a') as f:
except BaseException as e:
print('Error on_data: %s' % str(e))
Change “nameofyourfilehere” to whatever you want to call your output file. Next, we'll follow the recommendation of Tweepy and set up an error handler that will automatically cancel the running of the script if we get error code 420—what Twitter sends you when you're being rate-limited:
def on_error(self, status_code):
if status_code == 420:
The last step—and the last two lines of your script—are where you decide what terms you want to be tracking.
twitter_stream = Stream(auth, MyListener())
Put all of this in a Python (.py) file, and upon running it you'll automatically start streaming every tweet that includes the word “nokia” into a JSON file. Choose a topic that's being talked about a lot, and you can pretty quickly have thousands of tweets (and hundreds of MB) of tweets on your hard drive. These tweets should look something like this:
When prettified, each tweet looks like this:
**"created_at"**:"Fri Mar 10 21:24:34 +0000 2017",
**"text"**:"Viber in consideration of nokia e71 yet e72 masterpiece phones: csqKZS https:\/\/t.co\/fp3mHhcpyN",
**"source"**:"\u003ca href=\"https:\/\/dlvrit.com\/\" rel=\"nofollow\"\u003edlvr.it\u003c\/a\u003e",
**"created_at"**:"Wed Feb 27 20:34:03 +0000 2013",
A lot of data to work with!
From here, the tweet is your oyster. The possibilities are pretty much unlimited for what you want to do.
If you're just getting started, work your way through the aforementioned Marco Bonzanini's “Mining Twitter Data with Python” tutorial. You'll learn how to pre-process tweets for easier analyzing later, do frequency analysis, co-occurrence analysis, sentiment analysis, and some basic data visualization.
If you're interested in doing more complex analysis of the linguistic aspects of tweets, Google's Cloud Natural Language API combined with BigQuery can be a good way to get some interesting results. More basic sentiment analysis, of course, can be done using any variety of projects available on Github—for example, TweetFeels.
Interested in the emojis being used on Twitter to talk about Nicki Minaj upon the release of her latest track, “No Frauds”? Easy!
Once you have your basic tweet-streaming script up and running, you can pretty quickly execute some interesting analysis of topics as they start happening in real time. Have you done any experimenting with live Twitter data? Let us know in the comments below!