0

I am doing a project using Python for emoji recommendation system. The first step is collecting data from twitter. Specifically, I need tweets using top popular emojis. I am thinking about crawling the website or use the twitter API. But I didn't see anywhere in twitter document about how to search with certain emoji(maybe using its unicode, for example, U+1F602).

Thanks in advance!

0

The Twitter Rest API specify a call to search/tweets

Returns a collection of relevant Tweets matching a specified query.

The query param q should be UTF-8 encoded so try passing the UTF-8 encoding of the emojis you are looking for.

Edit: I just went over tweets with emojis in them, they are images, so it doesn't look like you can search on them.

  • Yes, but there is no help on how to search only tweets with EMOJI! – Vicky Sep 25 '15 at 18:27
  • @Vicky I edited the answer. – Forge Sep 25 '15 at 18:29
  • Thanks, I have tried this but I don't think it works :( – Vicky Sep 25 '15 at 19:09
0

I manage to so with the help of this article https://medium.com/@mroth/how-i-built-emojitracker-179cfd8238ac#a5d7

Instead of searching u'\U0001F602', I searched 1F602 and I started the following getting results:

api = tweepy.API(auth)
print api
query = '1F602' # u'\U0001F602'   
print query
max_tweets = 10
search = tweepy.Cursor(api.search, q=query).items(max_tweets)
for status in search:
    print status.text

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.