Sunday 10 January 2016

Katy Perry - Live Twitter Stream API with PYTHON

In [1]:
import twitter
import json


def oauth_login():
    CONSUMER_KEY = 'Q1'
    CONSUMER_SECRET = 'SQx'
    OAUTH_TOKEN = '7Yd'
    OAUTH_TOKEN_SECRET = 'Ah9'
    
    auth = twitter.oauth.OAuth(OAUTH_TOKEN, OAUTH_TOKEN_SECRET,
                               CONSUMER_KEY, CONSUMER_SECRET)
    
    twitter_api = twitter.Twitter(auth=auth)
    
    return twitter_api

# Sample usage

twitter_api = oauth_login()
    
# Nothing to see by displaying twitter_api except that it's now a
# defined variable

print twitter_api   

###
<twitter.api.Twitter object at 0x0000000003A48048>




In [3]:
#%% Example 4. 
import twitter
import json

def twitter_search(twitter_api, q, max_results=200, **kw):

    # See https://dev.twitter.com/docs/api/1.1/get/search/tweets and 
    # https://dev.twitter.com/docs/using-search for details on advanced 
    # search criteria that may be useful for keyword arguments
    
    # See https://dev.twitter.com/docs/api/1.1/get/search/tweets   
    
    search_results = twitter_api.search.tweets(q=q, count=100)
    statuses = search_results['statuses']
    
    # search_results = twitter_api.search.tweets(q=q, count=100, **kw)
    
    # statuses = search_results['statuses']
    
    # Iterate through batches of results by following the cursor until we
    # reach the desired number of results, keeping in mind that OAuth users
    # can "only" make 180 search queries per 15-minute interval. See
    # https://dev.twitter.com/docs/rate-limiting/1.1/limits
    # for details. A reasonable number of results is ~1000, although
    # that number of results may not exist for all queries.
    
    # Enforce a reasonable limit
    max_results = min(1000, max_results)
    
    for _ in range(10): # 10*100 = 1000
        try:
            next_results = search_results['search_metadata']['next_results']
        except KeyError, e: # No more results when next_results doesn't exist
            break
            
        # Create a dictionary from next_results, which has the following form:
        # ?max_id=313519052523986943&q=NCAA&include_entities=1
        kwargs = dict([ kv.split('=') 
                        for kv in next_results[1:].split("&") ])
        
        search_results = twitter_api.search.tweets(**kwargs)
        statuses += search_results['statuses']
        
        if len(statuses) > max_results: 
            break
            
    return statuses
#
# Sample usage

twitter_api = oauth_login()

q = "#rstats"
results = twitter_search(twitter_api, q, max_results=10)
        
# Show one sample search result by slicing the list...
print json.dumps(results[0], indent=1)
print
print
print
# print json.dumps(status_texts[0], indent=1)
#
{
 "contributors": null, 
 "truncated": false, 
 "text": "RT @JennyBryan: Or maybe Excel is like the dull pocket knife in 127 Hours. Eventually gets the job done but OMG THE PAIN. #rstats https://t\u2026", 
 "is_quote_status": true, 
 "in_reply_to_status_id": null, 
 "id": 686270001385488384, 
 "favorite_count": 0, 
 "source": "<a href=\"http://twitter.com/download/iphone\" rel=\"nofollow\">Twitter for iPhone</a>", 
 "retweeted": false, 
 "coordinates": null, 
 "entities": {
  "symbols": [], 
  "user_mentions": [
   {
    "id": 2167059661, 
    "indices": [
     3, 
     14
    ], 
    "id_str": "2167059661", 
    "screen_name": "JennyBryan", 
    "name": "Jenny Bryan"
   }
  ], 
  "hashtags": [
   {
    "indices": [
     122, 
     129
    ], 
    "text": "rstats"
   }
  ], 
  "urls": [
   {
    "url": "https://t.co/cHFctxrSGV", 
    "indices": [
     139, 
     140
    ], 
    "expanded_url": "https://twitter.com/gpavolini/status/686144596125028352", 
    "display_url": "twitter.com/gpavolini/stat\u2026"
   }
  ]
 }, 
 "in_reply_to_screen_name": null, 
 "in_reply_to_user_id": null, 
 "retweet_count": 17, 
 "id_str": "686270001385488384", 
 "favorited": false, 
 "retweeted_status": {
  "contributors": null, 
  "truncated": false, 
  "text": "Or maybe Excel is like the dull pocket knife in 127 Hours. Eventually gets the job done but OMG THE PAIN. #rstats https://t.co/cHFctxrSGV", 
  "is_quote_status": true, 
  "in_reply_to_status_id": null, 
  "id": 686239527489294336, 
  "favorite_count": 20, 
  "entities": {
   "symbols": [], 
   "user_mentions": [], 
   "hashtags": [
    {
     "indices": [
      106, 
      113
     ], 
     "text": "rstats"
    }
   ], 
   "urls": [
    {
     "url": "https://t.co/cHFctxrSGV", 
     "indices": [
      114, 
      137
     ], 
     "expanded_url": "https://twitter.com/gpavolini/status/686144596125028352", 
     "display_url": "twitter.com/gpavolini/stat\u2026"
    }
   ]
  }, 
  "quoted_status_id": 686144596125028352, 
  "retweeted": false, 
  "coordinates": null, 
  "quoted_status": {
   "contributors": null, 
   "truncated": false, 
   "text": "@BigParser @eightymgb #Excel is like pliers: works well in small tasks, but bad tool 4 all and every project. Consider better tools #rstats", 
   "is_quote_status": false, 
   "in_reply_to_status_id": 685643424033320960, 
   "id": 686144596125028352, 
   "favorite_count": 0, 
   "source": "<a href=\"http://twitter.com/download/android\" rel=\"nofollow\">Twitter for Android</a>", 
   "retweeted": false, 
   "coordinates": null, 
   "entities": {
    "symbols": [], 
    "user_mentions": [
     {
      "id": 4398413121, 
      "indices": [
       0, 
       10
      ], 
      "id_str": "4398413121", 
      "screen_name": "BigParser", 
      "name": "Big Parser"
     }, 
     {
      "id": 17047685, 
      "indices": [
       11, 
       21
      ], 
      "id_str": "17047685", 
      "screen_name": "eightymgb", 
      "name": "Greg  Ensell"
     }
    ], 
    "hashtags": [
     {
      "indices": [
       22, 
       28
      ], 
      "text": "Excel"
     }, 
     {
      "indices": [
       132, 
       139
      ], 
      "text": "rstats"
     }
    ], 
    "urls": []
   }, 
   "in_reply_to_screen_name": "BigParser", 
   "in_reply_to_user_id": 4398413121, 
   "retweet_count": 0, 
   "id_str": "686144596125028352", 
   "favorited": false, 
   "user": {
    "follow_request_sent": false, 
    "has_extended_profile": false, 
    "profile_use_background_image": true, 
    "default_profile_image": false, 
    "id": 319314608, 
    "profile_background_image_url_https": "https://abs.twimg.com/images/themes/theme2/bg.gif", 
    "verified": false, 
    "profile_text_color": "663B12", 
    "profile_image_url_https": "https://pbs.twimg.com/profile_images/567031757854502913/N0cjg-M-_normal.jpeg", 
    "profile_sidebar_fill_color": "DAECF4", 
    "entities": {
     "description": {
      "urls": []
     }
    }, 
    "followers_count": 180, 
    "profile_sidebar_border_color": "C6E2EE", 
    "id_str": "319314608", 
    "profile_background_color": "C6E2EE", 
    "listed_count": 33, 
    "is_translation_enabled": false, 
    "utc_offset": -21600, 
    "statuses_count": 2559, 
    "description": "Interested in #DataScience #DataViz #Productivity #rstats. Husband, father of 2. Productivity consultant. Ocassional opinion on #Colombia", 
    "friends_count": 284, 
    "location": "Colombia", 
    "profile_link_color": "1F98C7", 
    "profile_image_url": "http://pbs.twimg.com/profile_images/567031757854502913/N0cjg-M-_normal.jpeg", 
    "following": false, 
    "geo_enabled": false, 
    "profile_background_image_url": "http://abs.twimg.com/images/themes/theme2/bg.gif", 
    "screen_name": "gpavolini", 
    "lang": "en", 
    "profile_background_tile": false, 
    "favourites_count": 279, 
    "name": "Giovanni Pavolini", 
    "notifications": false, 
    "url": null, 
    "created_at": "Fri Jun 17 22:33:06 +0000 2011", 
    "contributors_enabled": false, 
    "time_zone": "Central Time (US & Canada)", 
    "protected": false, 
    "default_profile": false, 
    "is_translator": false
   }, 
   "geo": null, 
   "in_reply_to_user_id_str": "4398413121", 
   "lang": "en", 
   "created_at": "Sun Jan 10 11:16:34 +0000 2016", 
   "in_reply_to_status_id_str": "685643424033320960", 
   "place": null, 
   "metadata": {
    "iso_language_code": "en", 
    "result_type": "recent"
   }
  }, 
  "source": "<a href=\"http://tapbots.com/software/tweetbot/mac\" rel=\"nofollow\">Tweetbot for Mac</a>", 
  "in_reply_to_screen_name": null, 
  "in_reply_to_user_id": null, 
  "retweet_count": 17, 
  "id_str": "686239527489294336", 
  "favorited": false, 
  "user": {
   "follow_request_sent": false, 
   "has_extended_profile": false, 
   "profile_use_background_image": false, 
   "default_profile_image": false, 
   "id": 2167059661, 
   "profile_background_image_url_https": "https://abs.twimg.com/images/themes/theme1/bg.png", 
   "verified": false, 
   "profile_text_color": "000000", 
   "profile_image_url_https": "https://pbs.twimg.com/profile_images/660978605606875137/s3YrJetD_normal.jpg", 
   "profile_sidebar_fill_color": "000000", 
   "entities": {
    "url": {
     "urls": [
      {
       "url": "https://t.co/nTjYDvwGjK", 
       "indices": [
        0, 
        23
       ], 
       "expanded_url": "https://github.com/jennybc", 
       "display_url": "github.com/jennybc"
      }
     ]
    }, 
    "description": {
     "urls": []
    }
   }, 
   "followers_count": 3123, 
   "profile_sidebar_border_color": "000000", 
   "id_str": "2167059661", 
   "profile_background_color": "000000", 
   "listed_count": 175, 
   "is_translation_enabled": false, 
   "utc_offset": null, 
   "statuses_count": 4506, 
   "description": "prof at UBC, humane #rstats, statistics, genomics, teach @STAT545", 
   "friends_count": 449, 
   "location": "Vancouver, BC", 
   "profile_link_color": "ABB8C2", 
   "profile_image_url": "http://pbs.twimg.com/profile_images/660978605606875137/s3YrJetD_normal.jpg", 
   "following": true, 
   "geo_enabled": true, 
   "profile_banner_url": "https://pbs.twimg.com/profile_banners/2167059661/1442682715", 
   "profile_background_image_url": "http://abs.twimg.com/images/themes/theme1/bg.png", 
   "screen_name": "JennyBryan", 
   "lang": "en", 
   "profile_background_tile": false, 
   "favourites_count": 9878, 
   "name": "Jenny Bryan", 
   "notifications": false, 
   "url": "https://t.co/nTjYDvwGjK", 
   "created_at": "Thu Oct 31 18:32:37 +0000 2013", 
   "contributors_enabled": false, 
   "time_zone": null, 
   "protected": false, 
   "default_profile": false, 
   "is_translator": false
  }, 
  "geo": null, 
  "in_reply_to_user_id_str": null, 
  "possibly_sensitive": false, 
  "lang": "en", 
  "created_at": "Sun Jan 10 17:33:47 +0000 2016", 
  "quoted_status_id_str": "686144596125028352", 
  "in_reply_to_status_id_str": null, 
  "place": null, 
  "metadata": {
   "iso_language_code": "en", 
   "result_type": "recent"
  }
 }, 
 "user": {
  "follow_request_sent": false, 
  "has_extended_profile": false, 
  "profile_use_background_image": true, 
  "default_profile_image": false, 
  "id": 169136907, 
  "profile_background_image_url_https": "https://abs.twimg.com/images/themes/theme1/bg.png", 
  "verified": false, 
  "profile_text_color": "333333", 
  "profile_image_url_https": "https://pbs.twimg.com/profile_images/460466785230143488/K1AyvT0H_normal.jpeg", 
  "profile_sidebar_fill_color": "DDEEF6", 
  "entities": {
   "description": {
    "urls": []
   }
  }, 
  "followers_count": 369, 
  "profile_sidebar_border_color": "C0DEED", 
  "id_str": "169136907", 
  "profile_background_color": "C0DEED", 
  "listed_count": 22, 
  "is_translation_enabled": false, 
  "utc_offset": -21600, 
  "statuses_count": 3037, 
  "description": "Engineer. Banking Analyst. Econometric Modeling and Applied Statistics my passion. #F1 #Alonsista #IAmTheMan #BigDataIsTheFuture #IceMan #rstats #Samurai. EPN.", 
  "friends_count": 1265, 
  "location": "Quito - Ecuador", 
  "profile_link_color": "0084B4", 
  "profile_image_url": "http://pbs.twimg.com/profile_images/460466785230143488/K1AyvT0H_normal.jpeg", 
  "following": false, 
  "geo_enabled": false, 
  "profile_banner_url": "https://pbs.twimg.com/profile_banners/169136907/1368405020", 
  "profile_background_image_url": "http://abs.twimg.com/images/themes/theme1/bg.png", 
  "screen_name": "SilverCat89", 
  "lang": "es", 
  "profile_background_tile": false, 
  "favourites_count": 1352, 
  "name": "Ra\u00fal Fern\u00e1ndez", 
  "notifications": false, 
  "url": null, 
  "created_at": "Wed Jul 21 16:50:38 +0000 2010", 
  "contributors_enabled": false, 
  "time_zone": "Central Time (US & Canada)", 
  "protected": false, 
  "default_profile": true, 
  "is_translator": false
 }, 
 "geo": null, 
 "in_reply_to_user_id_str": null, 
 "possibly_sensitive": false, 
 "lang": "en", 
 "created_at": "Sun Jan 10 19:34:53 +0000 2016", 
 "in_reply_to_status_id_str": null, 
 "place": null, 
 "metadata": {
  "iso_language_code": "en", 
  "result_type": "recent"
 }
}



In [24]:
import twitter
import json

status_texts = [ status['text']
                 for status in statuses ]
#
screen_names = [ user_mention['screen_name']
                 for status in statuses
                     for user_mention in status['entities']['user_mentions'] ]
#
hashtags = [ hashtag['text']
             for status in statuses
                 for hashtag in status['entities']['hashtags'] ]
#
#
# Compute a collection of all words from all tweets
words = [ w
          for t in status_texts
              for w in t.split() ]
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-24-2fb589ed2a91> in <module>()
      3 
      4 status_texts = [ status['text']
----> 5                  for status in statuses ]
      6 #
      7 screen_names = [ user_mention['screen_name']

NameError: name 'statuses' is not defined
In [18]:
status_texts = [ status['text'] 
                 for status in statuses ]

screen_names = [ user_mention['screen_name'] 
                 for status in statuses
                     for user_mention in status['entities']['user_mentions'] ]

hashtags = [ hashtag['text'] 
             for status in statuses
                 for hashtag in status['entities']['hashtags'] ]

# Compute a collection of all words from all tweets
words = [ w 
          for t in status_texts 
              for w in t.split() ]

# Explore the first 5 items for each...

print json.dumps(status_texts[0:5], indent=1)
print json.dumps(screen_names[0:5], indent=1) 
print json.dumps(hashtags[0:5], indent=1)
print json.dumps(words[0:5], indent=1)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-18-429ca57a4375> in <module>()
      1 status_texts = [ status['text'] 
----> 2                  for status in statuses ]
      3 
      4 screen_names = [ user_mention['screen_name'] 
      5                  for status in statuses

NameError: name 'statuses' is not defined
In [12]:
# Explore the first 10 items for each...
import twitter
import json

print json.dumps(status_texts[0:10], indent=1)
print
print
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-12-46b90598bdd1> in <module>()
      3 import json
      4 
----> 5 print json.dumps(status_texts[0:10], indent=1)
      6 print
      7 print

NameError: name 'status_texts' is not defined
In [10]:
status_texts = [ status['text'] 
                 for status in statuses ]

screen_names = [ user_mention['screen_name'] 
                 for status in statuses
                     for user_mention in status['entities']['user_mentions'] ]

hashtags = [ hashtag['text'] 
             for status in statuses
                 for hashtag in status['entities']['hashtags'] ]

# Compute a collection of all words from all tweets
words = [ w 
          for t in status_texts 
              for w in t.split() ]

# Explore the first 5 items for each...

print json.dumps(status_texts[0:5], indent=1)
print json.dumps(screen_names[0:5], indent=1) 
print json.dumps(hashtags[0:5], indent=1)
print json.dumps(words[0:5], indent=1)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-10-429ca57a4375> in <module>()
      1 status_texts = [ status['text'] 
----> 2                  for status in statuses ]
      3 
      4 screen_names = [ user_mention['screen_name'] 
      5                  for status in statuses

NameError: name 'statuses' is not defined
In [13]:
# Finding topics of interest by using the filtering capablities it offers.
# Describe when to use search versus when to use streaming api - two different use cases.

import twitter
import sys

# Query terms

q = 'KATY PERRY' #comma separated list of terms

print >> sys.stderr, 'Filtering the public timeline for track="%s"' % (q,)

twitter_api = oauth_login() # Returns an instance of twitter.Twitter
twitter_stream = twitter.TwitterStream(auth=twitter_api.auth) # Reference the self.auth parameter

# See https://dev.twitter.com/docs/streaming-apis
stream = twitter_stream.statuses.filter(track=q)

# For illustrative purposes, when all else fails, search for Justin Bieber
# and something is sure to turn up (at least, on Twitter)

for tweet in stream:
    print tweet['text']
    # Save to a database in a particular collection
Katy Perry!!!!!! https://t.co/PodpvhcZWR
RT @radiotalentbr: ⚠  Lista de fĆ£-clubes oficiais que vĆ£o para o site! 

šŸ‘‰ Katy Perry
⭐@PortalKatyPerry 
⭐@katyperrybr https://t.co/lpGRL5D…
teenage dream by katy perry makes my heart cry happy tears
Lady Gaga is yet to have an album that outsells true blue  https://t.co/bYl3viRw80
Coarse tutus are so foppery weariful agreeable to katy perry else peculiar celebs: HMFSEJH https://t.co/6U2grkyfiU
kero https://t.co/j97gRqiALs
Unconditionally  https://t.co/PpNmlGRIqY
Seguimos recordando los mejores temas ! 2008 junto a la diosa de Katy Perry ! #HoyAniversarioPITA #CuentaRegresiva šŸŽˆ https://t.co/ZrtJXl9beA
Katy Perry. https://t.co/WHiL2lK9tD
RT @euqueroz: Katy Perry https://t.co/T5YMgMgW5p
RT @ZIPERATIVO: #TopGostosas šŸ‘™ šŸ”„

#3 Katy Perry https://t.co/16FS8lox88
RT @Portalddbr: Em sua playlist do spotify, Demi tem mĆŗsicas da (o) One Direction, Ariana Grande, Selena Gomez,  Katy Perry, Carly R. Jepse…
RT @flordebelieber: Top3 en  Vevo Australia:
1: Justin Bieber: ''Love Yourself''
2: Taylor Swift: ''Out Of The Woods''
3: Katy Perry: ''Roa…
@DMs_Y_Mas94  Katy Perry
RT @rttyourbae: Katy Perry http://t.co/nTqYOJwW0N
Vfbhhfgbjfb https://t.co/v4ekFLrXFC
firework  https://t.co/67QKkfEbty
Katy perry es una de las mujeres mƔs hermosas
RT @TheOITNBLife: Katy Perry is really Vauseman's love child https://t.co/g8BzzSIkgr
QuĆ© diosa Katy Perry šŸ’
RT @MortaKatyPerry: Katy Perry kkkkk #GoldenAwardsKatyPerry https://t.co/msx2SHJ7NV
RT @Helder_lo: Twitter resumido em: Katy Perry vai com o cabelo solto #GoldenAwardsKatyPerry
Somebody Snaps A Pic Of A Bent Over Katy Perry And... =&gt; https://t.co/thnNqu8fq5 https://t.co/TYWBAlUvqr
RT @jordansdiamonds: Katy Perry writes a song:
*Dr Luke produced instrumental*
I'm a tiger
Roses are red violets are blue
Ring around the r…
RT @HolySiaFurler: Katy Perry writing songs:
I wanna lick your ice cream cone
Make my heart explode like the Fourth of July
Get drunk and w…
to sofrendo Katy Perry &amp; Demi Lovato - Cool For The Dark Horse (Mashup) https://t.co/tVMwsyZWdB
Su #RadioGaia c'ĆØ:#Katy Perry Firework https://t.co/PktL5RKS32 #Christmas #NowPlaying #NP
Su #RadioGaia c'ĆØ: #Katy Perry Firework https://t.co/HLZqjUVqX0 #Christmas... https://t.co/ICa210cWrL
RT @radiotalentbr: ⚠  Lista de fĆ£-clubes oficiais que vĆ£o para o site! 

šŸ‘‰ Katy Perry
⭐@PortalKatyPerry 
⭐@katyperrybr https://t.co/lpGRL5D…
RT @IriAndre_: Katy perry es una de las mujeres mƔs hermosas
RT @ddlmrhughes: to sofrendo Katy Perry &amp; Demi Lovato - Cool For The Dark Horse (Mashup) https://t.co/tVMwsyZWdB
katy perry - legendary lovers https://t.co/oiH5CEULfX
RT @wikitetas: Miley Cyrus y Katy Perry tocƔndose las tetas. https://t.co/0nW6JKXgaf
RT @jordansdiamonds: Katy Perry hasn't done anything in the past year besides star in an H&amp;M holiday commercial.  https://t.co/920cnEEud6
RT @MortaKatyPerry: Katy Perry kkkkk #GoldenAwardsKatyPerry https://t.co/msx2SHJ7NV
RT @relatojovens: “Ɖ incrĆ­vel, as pessoas dizem que sentem falta, mas nĆ£o dĆ£o um passo pra te encontrar.”
— Katy Perry.
Now Playing: Dark Horse by Katy Perry https://t.co/MyotFQqvzK  #kool1053 #thebestvariety
Bad Lovers - Miley Cyrus ft. Katy Perry 

MILEY IS COMING
RT @euqueroz: Katy Perry https://t.co/T5YMgMgW5p
RT @euqueroz: Katy Perry https://t.co/T5YMgMgW5p
RT @tudomiley: Bad Lovers - Miley Cyrus ft. Katy Perry 

MILEY IS COMING
RT @tudomiley: Bad Lovers - Miley Cyrus ft. Katy Perry 

MILEY IS COMING
RT @ZIPERATIVO: #TopGostosas šŸ‘™ šŸ”„

#3 Katy Perry https://t.co/16FS8lox88
oh porra https://t.co/7Rp0bxTGkh
RT @tudomiley: Bad Lovers - Miley Cyrus ft. Katy Perry 

MILEY IS COMING
RT @euqueroz: Katy Perry https://t.co/T5YMgMgW5p
@daniluengas1 šŸ˜±šŸ˜± Katy Perry
RT @ShadyGagaFacts: #GoldenGlobes This Year

- Lady Gaga : Nominated &amp; Presenting
- Katy Perry : Presenting
- Taylor Swift : Watching
O QUE COMO ASSIM???  https://t.co/2oTLVCGynE
RT @tudomiley: Bad Lovers - Miley Cyrus ft. Katy Perry 

MILEY IS COMING
Katy Perry Showing Off Her Nips And Camel Toe In A Tight ... https://t.co/6lGOp6Og9D https://t.co/m1Z70dgEAI
RT @musicnews_shade: Artists releasing the most anticipated pop albums of 2016.

1 Rihanna
2 Katy Perry 
3 Sia 
4 Bruno Mars
5 Lady Gaga ht…
RT @crowdgoals: Katy Perry https://t.co/sV2EaOeBYp
@HarryPayneH katy Perry - thd
Fiz atƩ um bolo pra comemorar a saƭda da caverna de Katy Perry kkk
#GoldenAwardsKatyPerry
RT @MortaKatyPerry: Katy Perry sua linda #GoldenAwardsKatyPerry
RT @tudomiley: Bad Lovers - Miley Cyrus ft. Katy Perry 

MILEY IS COMING
RT @tudomiley: Bad Lovers - Miley Cyrus ft. Katy Perry 

MILEY IS COMING
RT @elegantgomezz: @HarryPayneH katy Perry - thd
RT @euqueroz: Katy Perry https://t.co/T5YMgMgW5p
roar https://t.co/NvereHPYGt
RT @MileysCyrusNews: You'd like a "Miley Cyrus ft Katy Perry" in Miley's new album? MILEY IS COMING! https://t.co/SrZKDHMEik
@Maxallica @touchdownactu @AlainMattei Foo Fighters, Metallica, AC/DC, The Hives... Pourtant au SB c'est Katy Perry, Black Eyed Peas BeyoncƩ
RT @crowdgoals: Katy Perry https://t.co/sV2EaOeBYp
RT @tudomiley: Bad Lovers - Miley Cyrus ft. Katy Perry 

MILEY IS COMING
RT @euqueroz: Katy Perry https://t.co/T5YMgMgW5p
How many fans has @katyperry in The world ? #RT if You Is fan of @katyperry ! https://t.co/pWhWTAOzx8 https://t.co/WlSveM49Rf
RT @MortaKatyPerry: Fiz atƩ um bolo pra comemorar a saƭda da caverna de Katy Perry kkk
#GoldenAwardsKatyPerry
Katy Perry Showing Off Her Nips And Camel Toe In A Tight ... https://t.co/xoKJ1VMGLa https://t.co/W1WriYUHPf
this is how we do  https://t.co/2VorvJnjA3
RT @ShadyGagaFacts: #GoldenGlobes This Year

- Lady Gaga : Nominated &amp; Presenting
- Katy Perry : Presenting
- Taylor Swift : Watching
RT @euqueroz: Katy Perry https://t.co/T5YMgMgW5p
RT @Helder_lo: Twitter resumido em: Katy Perry vai com o cabelo solto #GoldenAwardsKatyPerry
RT @tudomiley: Bad Lovers - Miley Cyrus ft. Katy Perry 

MILEY IS COMING
RT @LORDS_OF_ROCK: @Maxallica @touchdownactu @AlainMattei Foo Fighters, Metallica, AC/DC, The Hives... Pourtant au SB c'est Katy Perry, Bla…
Katy Perry album  https://t.co/py0seG9EJN
RT @crowdgoals: Katy Perry ♡  https://t.co/fFZufwyybF
RT @RollingStone: 20 most anticipated pop albums of 2016, including LPs from Rihanna, Katy Perry, Zayn Malik and more https://t.co/S8SCtUcu…
RT @wikitetas: Miley Cyrus y Katy Perry tocƔndose las tetas. https://t.co/0nW6JKXgaf
RT @HolySiaFurler: Katy Perry writing songs:
I wanna lick your ice cream cone
Make my heart explode like the Fourth of July
Get drunk and w…
Quem Ć© katy perry numa premiaĆ§Ć£o onde a Gaga vai apresentar e estĆ” indicada a uma categoria? GOOD LUCK LADY GAGA
RT @euqueroz: Katy Perry https://t.co/T5YMgMgW5p
RT @crowdgoals: Katy Perry https://t.co/sV2EaOeBYp
RT @futurodopopp: vĆ£o vazar fotos polemicas de rihkaty (Rihanna e Katy Perry)
RT @ringforsexx: Katy Perry https://t.co/qg7IZBf8zq
Na vida no clipe da Katy Perry - Last Friday Night eu sou ela na versĆ£o feia e continuo lĆ”.
RT @ringforsexx: Katy Perry https://t.co/qg7IZBf8zq
RT @tudomiley: Bad Lovers - Miley Cyrus ft. Katy Perry 

MILEY IS COMING
RT @BiiaFm: Na vida no clipe da Katy Perry - Last Friday Night eu sou ela na versĆ£o feia e continuo lĆ”.
RT @ShadyGagaFacts: #GoldenGlobes This Year

- Lady Gaga : Nominated &amp; Presenting
- Katy Perry : Presenting
- Taylor Swift : Watching
If i wanna headbang ill put on some metal or some Gangsta Rap, There is a Label and A Warning, katy perry feeds u candy with Anthrax
RT @rtsetransaria: RT: katy perry
FAV: lady gaga https://t.co/T1VADg8hoe
RT @radiotalentbr: ⚠  Lista de fĆ£-clubes oficiais que vĆ£o para o site! 

šŸ‘‰ Katy Perry
⭐@PortalKatyPerry 
⭐@katyperrybr https://t.co/lpGRL5D…
RT @rtqueens: Katy Perry http://t.co/kmx12mqnMH
RT @calabresadani: Achei camiseta da Katy Perry na https://t.co/cbXM8d60jQ loja do @rafaelaugustto_ ❤️️šŸ˜šŸ‘Ætem da Madonna tb,as rainha todas …
RT @calabresadani: KATY PERRY NA MINHA CASAšŸ’™šŸ˜šŸ’™šŸŒŸšŸ‘Æ meu amigo maquiador/cabeleireiro/desenhista/ danƧarino/drag queen… https://t.co/5MBo1bygLi
Katy Perry Coitada kkkkkkk
RT @ringforsexx: Katy Perry https://t.co/qg7IZBf8zq
RT @musicfacts_shdy: Katy Perry's 'I Kissed A Girl' needs less than 6M views to become her 15th VEVO certified video. https://t.co/oct0BZx8…
RT @ringforsexx: Katy Perry https://t.co/qg7IZBf8zq
RT @ZIPERATIVO: #TopGostosas šŸ‘™ šŸ”„

#3 Katy Perry https://t.co/16FS8lox88
RT @MortaKatyPerry: Fiz atƩ um bolo pra comemorar a saƭda da caverna de Katy Perry kkk
#GoldenAwardsKatyPerry
Katy Perry Showing Off Her Nips And Camel Toe In A Tight Bikini!!!(9pics) https://t.co/nNYxGBZkdz https://t.co/Lg4hswMnGG
RT @ShadyGagaFacts: #GoldenGlobes This Year

- Lady Gaga : Nominated &amp; Presenting
- Katy Perry : Presenting
- Taylor Swift : Watching
RT @ringforsexx: Katy Perry https://t.co/qg7IZBf8zq
I like a good boy, but sometimes you get bored.
-Katy Perry
RT @katyperry: I want to close this with a poll... https://t.co/5vO1SWSYQl
@Alexboy241 katy perry, firework. cause it's my favorite song ever.
RT @Helder_lo: Twitter resumido em: Katy Perry vai com o cabelo solto #GoldenAwardsKatyPerry
RT @ringforsexx: Katy Perry https://t.co/qg7IZBf8zq
https://t.co/qfied58ndm
RT @crowdgoals: Katy Perry ♡  https://t.co/fFZufwyybF
RT @tudomiley: Bad Lovers - Miley Cyrus ft. Katy Perry 

MILEY IS COMING
A Katy Perry tĆ” ganhando. 
GOOD LUCK LADY GAGA
#LadyGaGaTNT serĆ” a rainha do #GoldenGlobeNaTNT! Concorda? Vote! https://t.co/EqjAIH31Wi
RT @MusicsRebellion: Top 4 best Victoria's Secret Fashion Show performers:
• Rihanna
• Katy Perry
• Selena Gomez
• Ariana Grande https://t.…
RT @retweetorfav14: RT for Taylor Swift
FAV for Katy Perry
#TaylorSwift #katyperry #katyvstaylor http://t.co/7JoYurY4EL
@Alexboy241 šŸ¤” Hva med this is how we do ~ Katy PerryšŸ˜Š
RT @MileyFR_Source: Un featuring avec Katy Perry est prƩvu pour le prochain album de Miley MILEY IS COMING https://t.co/1WyTUNg2xC
RT @musicnews_shade: Katy Perry will be presenting at the 2016 Golden Globes, live this Sunday! https://t.co/ET1YSM4TsE
#KatyPerry #Deals KATY PERRY #Poster - TEENAGE DREAM - promotional #Poster - 11 x 17 inches https://t.co/rVntdxbEoB #Style #Forsale
RT @tudomiley: Bad Lovers - Miley Cyrus ft. Katy Perry 

MILEY IS COMING
RT @jordansdiamonds: Katy Perry writes a song:
*Dr Luke produced instrumental*
I'm a tiger
Roses are red violets are blue
Ring around the r…
I would have thought inviting Domhnall Gleeson over Katy Perry to the Golden Globes was more important??? Like seriously? #goldenglobes. Wtf
@miIeyscircus @DentrezDentrez @P0PTHATC0RN Katy isn't that relevant lol like in class my friend was like "what ever happened to Katy perry"šŸ˜‚
RT @MortaKatyPerry: Fiz atƩ um bolo pra comemorar a saƭda da caverna de Katy Perry kkk
#GoldenAwardsKatyPerry
RT @ShadyGagaFacts: #GoldenGlobes This Year

- Lady Gaga : Nominated &amp; Presenting
- Katy Perry : Presenting
- Taylor Swift : Watching
Look At Me Now by Seether featuring Katy Perry
RT @euqueroz: Katy Perry https://t.co/T5YMgMgW5p
RT @euqueroz: Katy Perry https://t.co/T5YMgMgW5p
RT @ocumleler: Milyonlarca insan evsiz ve aƧken, hayatta hiƧbir şeyden şikayet edemem. 

[Katy Perry]
RT @euqueroz: Katy Perry https://t.co/T5YMgMgW5p
RT @demisrawnn: oh porra https://t.co/7Rp0bxTGkh
RT @MuzikGercekleri: YouTube'da en Ƨok abonesi olan şarkıcılar;
#1 One Direction
#2 Rihanna
#3 Taylor Swift
#4 Katy Perry https://t.co/Dxas…
RT @radiotalentbr: ⚠  Lista de fĆ£-clubes oficiais que vĆ£o para o site! 

šŸ‘‰ Katy Perry
⭐@PortalKatyPerry 
⭐@katyperrybr https://t.co/lpGRL5D…
Katy Perry - Dark Horse (Sung in the style of Type O Negative) https://t.co/l6048NV1Wf vĆ­a @YouTube
#KatyPerryBestFans2016  https://t.co/Hhk8DJfhk3
RT @RollingStone: 20 most anticipated pop albums of 2016, including LPs from Rihanna, Katy Perry, Zayn Malik and more https://t.co/S8SCtUcu…
RT @rtqueens: Katy Perry http://t.co/kmx12mqnMH
RT @ringforsexx: Katy Perry https://t.co/qg7IZBf8zq
RT @1DCharts: Os artistas com mais inscritos no "VEVO" YouTube:
#1 One Direction
#2 Rihanna
#3 Taylor Swift
#4 Katy Perry https://t.co/jr5X…
RT @MileysCyrusNews: You'd like a "Miley Cyrus ft Katy Perry" in Miley's new album? MILEY IS COMING! https://t.co/SrZKDHMEik
Did you see these Katy Perry Super Bowl Outfit Memes? LMAO!! https://t.co/7kKralUXiV
It's been 4 years since someone first told me I look like Katy Perry and I still don't see it.
RT @euqueroz: Katy Perry https://t.co/T5YMgMgW5p
RT @papelpop: Katy Perry, Chris Evans e Lady Gaga estarĆ£o entre os apresentadores do Globo de Ouro 2016 https://t.co/vu9FEzAD70 https://t.c…
eu pensei na katy perry e apareceu uma foto falando dela oxe
Katy Perry Without Makeup: Cute Or Scary?? https://t.co/aULpKNPt1u https://t.co/y5sASnFBl5
Gostei de um vĆ­deo @YouTube de @andyyycarvalhoo https://t.co/kWyHfYL08O Katy Perry - I Kissed A Girl (MTV Unplugged)
Every time Katy Perry plays I think of @wkruzan325 šŸ˜‚
@eitagu_ lembro do tempo que vocĆŖ falava isso de katy perry
#busty #celebs #bustycelebs: Katy Perry - cleavy candids https://t.co/TZIZ17KBoh #KatyPerry
RT @euqueroz: Katy Perry https://t.co/T5YMgMgW5p
【å®šęœŸ】
Linkin park
Katy perry
Evanescence 
Marilyn Manson 
3OH!3

å„½ććŖ悂恮äø€ć¤ć§ć‚‚ć‚ć‚Œć°‼︎
#RT恗恟äŗŗå…Øå“”ćƒ•ć‚©ćƒ­ćƒ¼ć™ć‚‹
RT @BatataReal: CADƊ LADY GAGA KATY PERRY TAYLOR SWIFT BEYONCE ADELE DECEPCIONADO COM ESSAS CRIANƇAS DE HOJE EM DIA. #TheVoiceKidsBr
Confirmo https://t.co/ySxFy5GoAG
RT @1DCharts: Os artistas com mais inscritos no "VEVO" YouTube:
#1 One Direction
#2 Rihanna
#3 Taylor Swift
#4 Katy Perry https://t.co/jr5X…
RT @ShadyGagaFacts: The difference between Katy Perry &amp; Lady Gaga: https://t.co/D8BKA60pN0
LetĆ­cia vocĆŖ Ć© hetero  https://t.co/UXuijfOUlR
RT @allweneedisgaga: A Katy Perry tĆ” ganhando. 
GOOD LUCK LADY GAGA
#LadyGaGaTNT serĆ” a rainha do #GoldenGlobeNaTNT! Concorda? Vote! https:…
part of me https://t.co/vuaxYO9kuL
Katy Perry! #tits #boobs #breasts #cleavage #busty https://t.co/XGBnMphkvd
RT @ZIPERATIVO: #TopGostosas šŸ‘™ šŸ”„

#3 Katy Perry https://t.co/16FS8lox88
RT @LiaMarieJohnson: I just met Katy Perry at sushi...... She was so nice. I almost lost my shit but I played it cool.... I think. OH MY GO…
RT @StarCelebrityVs: Who is better singer? 

RT for Ariana Grande 
FAV for Katy Perry http://t.co/MmIqrD7hVv
RT @rttyourbae: Katy Perry http://t.co/nTqYOJwW0N
Katy Perry Showing Off Her Nips And Camel Toe In A Tight Bikini!!!(9pics) https://t.co/APNrDAiit3 https://t.co/P8mx9dl2qO
RT @AlgoBasico: Confirmo https://t.co/ySxFy5GoAG
RT @crowdgoals: Katy Perry https://t.co/sV2EaOeBYp
RT @wikitetas: Miley Cyrus y Katy Perry tocƔndose las tetas. https://t.co/0nW6JKXgaf
RT @thisorthispl: Kto wygląda lepiej na okładce?
#RT - Ariana Grande 
#Fav - Katy Perry http://t.co/j3O8F5f7gi
RT @euqueroz: Katy Perry https://t.co/T5YMgMgW5p
RT @ToCoLubie: Katy Perry
RT @ShadyGagaFacts: #GoldenGlobes This Year

- Lady Gaga : Nominated &amp; Presenting
- Katy Perry : Presenting
- Taylor Swift : Watching
RT @1DFAMlLY: Did You Know? 4 of Katy Perry's top 10 tweets are about/to Niall and the boys.
RT @bestxvocals: katy perry https://t.co/PrThjJkCng
RT @futurodopopp: vĆ£o vazar fotos polemicas de rihkaty (Rihanna e Katy Perry)
RT @jordansdiamonds: Katy Perry writes a song:
*Dr Luke produced instrumental*
I'm a tiger
Roses are red violets are blue
Ring around the r…
birthday  https://t.co/YefASl3xOf
RT @tudomiley: Bad Lovers - Miley Cyrus ft. Katy Perry 

MILEY IS COMING
@Scannain_com Apparently Katy Perry is invited to the Golden Globes and Domhnall Gleeson isn't.. thoughts?
i miss tour so much https://t.co/wRhxelVDS6
@wildifrie Ɖ A TINA TURNER E MINHA MƃE ACHANDO Q ERA A DEMI OU A KATY PERRY
RT @greetingsjunior: A vagabunda da katy perry vai fazer o que no golden globes hoje? Vai servir de red carpet pra Gaga desfilar lindamente…
RT @tudomiley: Bad Lovers - Miley Cyrus ft. Katy Perry 

MILEY IS COMING
RT @HolySiaFurler: Katy Perry writing songs:
I wanna lick your ice cream cone
Make my heart explode like the Fourth of July
Get drunk and w…
katy perry  https://t.co/FEw5S9hYuX
https://t.co/TRgzuWCeky
@biagrandeb We Love Katy Perry Pop #KatyPerryPop
@simcarter Interesting šŸ˜³ https://t.co/dqU2XRbZnm
Katy clearly will be late as usual, we dont call her Laty perry for no reason...
estoy escuchando Katy Perry y me acuerdo de que ella es mi verdadero amor jajaja que loser
@wildifrie pro meus pais td Ć© demi e katy perry eles sĆ³ conhecem elas
Am I the only one still wondering why Taylor Swift is so upset at Katy Perry for dating John Mayer where she wrote bad blood about her
NƃO TEM TAG PRA KATY PERRY NO GOLDEN GLOBES ?
RT @Helder_lo: Twitter resumido em: Katy Perry vai com o cabelo solto #GoldenAwardsKatyPerry
RT @ShadyGagaFacts: #GoldenGlobes This Year

- Lady Gaga : Nominated &amp; Presenting
- Katy Perry : Presenting
- Taylor Swift : Watching
Katy Perry Showing Off Her Nips And Camel Toe In A Tight ... https://t.co/4xtUuHa7UD
RT @VS_Artist: #ArianaGrande VS #KatyPerry

RT for Ariana Grande
LIKE for Katy Perry https://t.co/uEiBKAuqPY
RT @euqueroz: Katy Perry https://t.co/T5YMgMgW5p
RT @jordansdiamonds: Katy Perry writes a song:
*Dr Luke produced instrumental*
I'm a tiger
Roses are red violets are blue
Ring around the r…
tayloe https://t.co/vlqJU3LzWx
Katy Perry Showing Off Her Nips And Camel Toe In A Tight Bikini!!!(9pics) https://t.co/R8H7q8YVL9 https://t.co/adtxZEagmk
RT @crowdgoals: Katy Perry https://t.co/sV2EaOeBYp
RT @ListenThisMusic: How many fans has @katyperry in The world ? #RT if You Is fan of @katyperry ! https://t.co/pWhWTAOzx8 https://t.co/WlS…
RT LORDS_OF_ROCK: Maxallica touchdownactu AlainMattei Foo Fighters, Metallica, AC/DC, The Hives... Pourtant au SB c'est Katy Perry, Black E…
Cats, cadĆŖ o fandom unido pela Katy Perry?! #GoldenAwardsKatyPerry
Cat's usem ao mĆ”ximo o nome Katy Perry para os outros cats q ainda nĆ£o sabem da tag 
#GoldenAwardsKatyPerry
Katy Perry Showing Off Her Nips And Camel Toe In A Tight Bikini!!!(9pics) https://t.co/7AyX7edDU8 https://t.co/hTrRnbswdM
RT @crowdgoals: Katy Perry https://t.co/sV2EaOeBYp
RT @Sexiest_Celebs_: Katy Perry #Ass #Sexy #Celeb https://t.co/wLGNmhnTuY
RT @euqueroz: Katy Perry https://t.co/T5YMgMgW5p
RT @crowdgoals: Katy Perry ♡  https://t.co/fFZufwyybF
RT @jordansdiamonds: Katy Perry writes a song:
*Dr Luke produced instrumental*
I'm a tiger
Roses are red violets are blue
Ring around the r…
se a Katy aparecer feia hoje https://t.co/MiQ8f7zyPI
RT @crowdgoals: Katy Perry ♡  https://t.co/fFZufwyybF
part of me https://t.co/6Mgb4qf1dT
@RaoulVDG @Maxallica @AlainMattei @touchdownactu Yves Duteil en shorty Ơ la Katy Perry, s'envolant dans les airs entourƩ de feux d'artifices
Teenage dream  https://t.co/miNbvOrWxI
RT @crowdgoals: Katy Perry https://t.co/sV2EaOeBYp
RT @flordebelieber: Top3 en  Vevo Australia:
1: Justin Bieber: ''Love Yourself''
2: Taylor Swift: ''Out Of The Woods''
3: Katy Perry: ''Roa…
RT @ot5throwback: when niall proposed to Katy perry https://t.co/ZxEOC1QRmU
RT @crowdgoals: Katy Perry ♡  https://t.co/fFZufwyybF
@E_Mehdi ils parlent de quand on a ri de Friday de Rebecca Black et pas de Katy Perry, alors que c'Ć©tait nous qui Ć©tions risibles ?
@skill_specs Katy Perry - Fireworks :) Please play this song. https://t.co/irZ4VUwmIX . Also nice stream
RT @ringforsexx: Katy Perry https://t.co/qg7IZBf8zq
RT @rtsetransaria: RT: katy perry
FAV: lady gaga https://t.co/T1VADg8hoe
@giul_montaldo Perry, Katy Perry_ la amo
RT @MusicaEmImagem: Katy Perry - Dark Horse https://t.co/r40z5GdlTa
Katy Perry e o look do dia kkkk quero v sĆ³ momma
#GoldenAwardsKatyPerry
MakeAVoice Radio: Now playing "Katy Perry - I Kissed A Girl"
TuneIn Player @ https://t.co/2bFiAnrrxx
RT @dannyyonce: Me: I hate tigers
BeyoncƩ: I love Katy Perry's song "roar"
Me: https://t.co/DfDqr6tJ4F
RT @MortaKatyPerry: Katy Perry e o look do dia kkkk quero v sĆ³ momma
#GoldenAwardsKatyPerry
RT @MortaKatyPerry: Cat's usem ao mĆ”ximo o nome Katy Perry para os outros cats q ainda nĆ£o sabem da tag 
#GoldenAwardsKatyPerry
RT @tudomiley: Bad Lovers - Miley Cyrus ft. Katy Perry 

MILEY IS COMING
RT @tudomiley: Bad Lovers - Miley Cyrus ft. Katy Perry 

MILEY IS COMING
RT @crowdgoals: Katy Perry https://t.co/sV2EaOeBYp
RT @NiallsNotes: Los chicos forman parte de 4 de los 10 tweets con mĆ”s RTs de la cantante Kate Perry. #NN https://t.co/4oQaYhHC0j https://t…
RT @mi_katy25: Cats, cadĆŖ o fandom unido pela Katy Perry?! #GoldenAwardsKatyPerry
RT @portalselenabr: Selena adicionou vĆ”rias mĆŗsicas em sua Playlist no Spotify incluindo Ariana Grande, Justin Bieber, One Direction, Miley…
RT @crowdgoals: Katy Perry ♡  https://t.co/fFZufwyybF
RT @euqueroz: Katy Perry https://t.co/T5YMgMgW5p
RT @HolySiaFurler: Katy Perry writing songs:
I wanna lick your ice cream cone
Make my heart explode like the Fourth of July
Get drunk and w…
quem Ć© katy perry perto da lady gaga mesmo? #LadyGaGaTNT GOOD LUCK LADY GAGA
RT @euqueroz: Katy Perry https://t.co/T5YMgMgW5p
NƃO, coloco um sinistr0 pra fita ai quando acaba a mĆŗsica o spotify muda pra ROAR KATY PERRY O QUE TEM A VER AMO MAS NƃO
Dark Horse (feat. Juicy J) by Katy Perry is number 96 in Honduras iTunes Top 100 Songs https://t.co/GnConJ4AvL @ihotmusiccharts
RT @MortaKatyPerry: Fiz atƩ um bolo pra comemorar a saƭda da caverna de Katy Perry kkk
#GoldenAwardsKatyPerry
RT @mi_katy25: Cats, cadĆŖ o fandom unido pela Katy Perry?! #GoldenAwardsKatyPerry
RT @crowdgoals: Katy Perry https://t.co/sV2EaOeBYp
RT @ZIPERATIVO: #TopGostosas šŸ‘™ šŸ”„

#3 Katy Perry https://t.co/16FS8lox88
aLO @suporteladygaga kATY Perry ta ganhando de 91%. Vamos mobilizar os liros a votarem a @ladygaga  https://t.co/WOPo2UGSAJ
RT @crowdgoals: Katy Perry https://t.co/sV2EaOeBYp
Katy Perry. #GagaBestFans2016 GOOD LUCK LADY GAGA https://t.co/f9gfnBMMKP
old Katy perry songs are A1
RT @DavisGRuiz: JAJAJAJAJAJAJA SU CARA JAJAJA LA CARA PLS https://t.co/ZGiqyT0WLS
RT @RollingStone: 20 most anticipated pop albums of 2016, including LPs from Rihanna, Katy Perry, Zayn Malik and more https://t.co/S8SCtUcu…
RT @mi_katy25: Cats, cadĆŖ o fandom unido pela Katy Perry?! #GoldenAwardsKatyPerry
RT @MortaKatyPerry: Katy Perry e o look do dia kkkk quero v sĆ³ momma
#GoldenAwardsKatyPerry
RT @tudomiley: Bad Lovers - Miley Cyrus ft. Katy Perry 

MILEY IS COMING
RT @crowdgoals: Katy Perry https://t.co/sV2EaOeBYp
RT @HolySiaFurler: Katy Perry writing songs:
I wanna lick your ice cream cone
Make my heart explode like the Fourth of July
Get drunk and w…
RT @tudomiley: Katy Perry: Rola ou Enrola? MILEY IS COMING https://t.co/7UXwX1BkLH
RT @euqueroz: Katy Perry https://t.co/T5YMgMgW5p
RT @crowdgoals: Katy Perry https://t.co/sV2EaOeBYp
RT @LiaMarieJohnson: I just met Katy Perry at sushi...... She was so nice. I almost lost my shit but I played it cool.... I think. OH MY GO…
RT @TheSongMsgs: "I just wanna throw my phone away. Find out who is really there for me" - Katy Perry
RT @euqueroz: Katy Perry https://t.co/T5YMgMgW5p
RT @bestbrotp: Katy Perry and Robert Pattinson https://t.co/lLyDIQ9TRb
RT @World_Images_: Katy Perry Showing Off Her Nips And Camel Toe In A Tight Bikini (8 pics) https://t.co/q3EvEvJai9
RT @RollingStone: 20 most anticipated pop albums of 2016, including LPs from Rihanna, Katy Perry, Zayn Malik and more https://t.co/S8SCtUcu…
RT @jordansdiamonds: Katy Perry writes a song:
*Dr Luke produced instrumental*
I'm a tiger
Roses are red violets are blue
Ring around the r…
RT @jordansdiamonds: Katy Perry writes a song:
*Dr Luke produced instrumental*
I'm a tiger
Roses are red violets are blue
Ring around the r…
O que a Katy Perry vai fazer nesse Globo Ouro? AtĆ© agora nĆ£o sei
RT @MileysCyrusNews: You'd like a "Miley Cyrus ft Katy Perry" in Miley's new album? MILEY IS COMING! https://t.co/SrZKDHMEik
RT @mi_katy25: Cats, cadĆŖ o fandom unido pela Katy Perry?! #GoldenAwardsKatyPerry
RT @GringosDublando: Katy Perry, Miley Cyrus e Rihanna - Baile de Favela https://t.co/mRuXRUMp0i
my moms playing i kissed a girl by katy perry downstairs in the living room and i dont think she understands
šŸ“· celebped: Katy Perry Feet https://t.co/dCydTpOt94
RT @tudomiley: Bad Lovers - Miley Cyrus ft. Katy Perry 

MILEY IS COMING
HƤrlig musiksatsning pƄ @svt fn. U2, Adele, Katy Perry o BrƄvalla den senaste veckan. Me like!

HƄrdrocksmagasin hƤrnƤst kanske? :)
RT @RollingStone: 20 most anticipated pop albums of 2016, including LPs from Rihanna, Katy Perry, Zayn Malik and more https://t.co/S8SCtUcu…
No momento Katy Perry 

GOOD LUCK LADY GAGA 
#GagaBestFans2016  https://t.co/8123duBYx6
RT @RollingStone: 20 most anticipated pop albums of 2016, including LPs from Rihanna, Katy Perry, Zayn Malik and more https://t.co/S8SCtUcu…
@giul_montaldo E.T di Katy Perry
RT @KameronBennett: Taylor Swift is soooo Huge now... Crazy...  Her &amp; Katy Perry's careers are on another level
Katy Perry es, Katy Perry pues. Kakakka cuando no tienes palabras para una descripciĆ³n!
RT @portalselenabr: Selena adicionou vĆ”rias mĆŗsicas em sua Playlist no Spotify incluindo Ariana Grande, Justin Bieber, One Direction, Miley…
RT @RollingStone: 20 most anticipated pop albums of 2016, including LPs from Rihanna, Katy Perry, Zayn Malik and more https://t.co/S8SCtUcu…
RT @dannyyonce: Me: I hate tigers
BeyoncƩ: I love Katy Perry's song "roar"
Me: https://t.co/DfDqr6tJ4F
RT @HolySiaFurler: Katy Perry writing songs:
I wanna lick your ice cream cone
Make my heart explode like the Fourth of July
Get drunk and w…
Katy Perry Showing Off Her Nips And Camel Toe In A Tight Bikini!!!(9pics) https://t.co/VbJtbmvkEG https://t.co/RFIEI9WYvX
RT @KameronBennett: Taylor Swift is soooo Huge now... Crazy...  Her &amp; Katy Perry's careers are on another level
RT @ShadyNickiFacts: According to Billboard, Nicki Minaj is the 3rd Top Female of 2015, beating Ariana Grande, Selena Gomez &amp; Katy Perry. h…
RT @LGTForum: No momento Katy Perry 

GOOD LUCK LADY GAGA 
#GagaBestFans2016  https://t.co/8123duBYx6
RT @BattleCeleb: Zayn Malik VS Katy Perry
RT for Zayn
FAV for Katy http://t.co/aUufjwdCCR
RT @euqueroz: Katy Perry https://t.co/T5YMgMgW5p
RT @jordansdiamonds: Katy Perry writes a song:
*Dr Luke produced instrumental*
I'm a tiger
Roses are red violets are blue
Ring around the r…
RT @Katy_Updatess: UPDATE:The video of katy perry's Manager  say "The next album will be in 2016" HERE:https://t.co/UEueI5TQX0 #KP4 43:33 M…
#NP DARK HORSE by KATY PERRY FT. JUICEY J https://t.co/Oyi3cOX9cb
RT @RollingStone: 20 most anticipated pop albums of 2016, including LPs from Rihanna, Katy Perry, Zayn Malik and more https://t.co/S8SCtUcu…
RT @ringforsexx: Katy Perry https://t.co/qg7IZBf8zq
RT @ToCoLubie: Katy Perry
RT @tudomiley: Bad Lovers - Miley Cyrus ft. Katy Perry 

MILEY IS COMING
RT @LGTForum: No momento Katy Perry 

GOOD LUCK LADY GAGA 
#GagaBestFans2016  https://t.co/8123duBYx6
RT @crowdgoals: Katy Perry ♡  https://t.co/fFZufwyybF
RT @jordansdiamonds: Katy Perry writes a song:
*Dr Luke produced instrumental*
I'm a tiger
Roses are red violets are blue
Ring around the r…
RT @kpopassonggs: Katy Perry - Walking on Air https://t.co/bPTIpjZtYS
RT @wikitetas: Miley Cyrus y Katy Perry tocƔndose las tetas. https://t.co/0nW6JKXgaf
RT @ZIPERATIVO: #TopGostosas šŸ‘™ šŸ”„

#3 Katy Perry https://t.co/16FS8lox88
RT @musicnews_facts: Female artists with the most #1 singles in the USA this decade:
#1 Katy Perry/Rihanna (8)
#3 Adele /Taylor Swift (4) h…
quando eu ouƧo katy perry da vontade de sair danƧando pela casa, sƩrio
Filtering the public timeline for track="KATY PERRY"
---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
<ipython-input-13-c638e3d69248> in <module>()
     20 # and something is sure to turn up (at least, on Twitter)
     21 
---> 22 for tweet in stream:
     23     print tweet['text']
     24     # Save to a database in a particular collection

C:\Anaconda2\lib\site-packages\twitter\stream.pyc in __iter__(self)
    174         while True:
    175             # Decode all the things:
--> 176             data = sock_reader.read()
    177             dechunked_data, end_of_stream, decode_error = chunk_decoder.decode(data)
    178             unicode_data = utf8_decoder.decode(dechunked_data)

C:\Anaconda2\lib\site-packages\twitter\stream.pyc in read(self)
    131     def read(self):
    132         try:
--> 133             ready_to_read = select.select([self.sock], [], [], self.sock_timeout)[0]
    134             if ready_to_read:
    135                 return self.sock.read()

KeyboardInterrupt: 
In [8]:
import twitter
import sys
import json

def extract_tweet_entities(statuses):
    
    # See https://dev.twitter.com/docs/tweet-entities for more details on tweet entities
    # and additional values that could be extracted in this function
    
    # See also https://dev.twitter.com/blog/symbols-entities-tweets for details on a 
    # forthcoming tweet entity called "symbols" that is currently undocumented.

    if len(statuses) == 0:
        return [], [], [], []
    
    screen_names = [ user_mention['screen_name'] 
                         for status in statuses
                            for user_mention in status['entities']['user_mentions'] ]
    
    hashtags = [ hashtag['text'] 
                     for status in statuses 
                        for hashtag in status['entities']['hashtags'] ]

    urls = [ url['url'] 
                     for status in statuses 
                        for url in status['entities']['urls'] ]
    
    # In some circumstances (such as search results), the media entity
    # may not appear
    if status['entities'].has_key('media'): 
        media = [ media['url'] 
                         for status in statuses  
                            for media in status['entities']['media'] ]
    else:
        media = []

    
    return screen_names, hashtags, urls, media

# Sample usage

    statuses = twitter_search(twitter_api, "CrossFit")

    screen_names, hashtags, urls, media = extract_tweet_entities(statuses)
    
# Explore the first 5 items for each...

print json.dumps(screen_names[0:5], indent=1) 
print json.dumps(hashtags[0:5], indent=1)
print json.dumps(urls[0:5], indent=1)
print json.dumps(media[0:5], indent=1)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-8-4a07f29921ac> in <module>()
     46 # Explore the first 5 items for each...
     47 
---> 48 print json.dumps(screen_names[0:5], indent=1)
     49 print json.dumps(hashtags[0:5], indent=1)
     50 print json.dumps(urls[0:5], indent=1)

NameError: name 'screen_names' is not defined
In [14]:
import sys
import time
from urllib2 import URLError
import json
import twitter

def make_twitter_request(twitter_api_func, max_errors=3, *args, **kw): 
    
    # A nested helper function that handles common HTTPErrors. Return an updated value 
    # for wait_period if the problem is a 503 error. Block until the rate limit is reset if
    # a rate limiting issue
    def handle_twitter_http_error(e, wait_period=2, sleep_when_rate_limited=True):
    
        if wait_period > 3600: # Seconds
            print >> sys.stderr, 'Too many retries. Quitting.'
            raise e
    
        # See https://dev.twitter.com/docs/error-codes-responses for common codes
    
        if e.e.code == 401:
            print >> sys.stderr, 'Encountered 401 Error (Not Authorized)'
            return None
        elif e.e.code == 429: 
            print >> sys.stderr, 'Encountered 429 Error (Rate Limit Exceeded)'
            if sleep_when_rate_limited:
                print >> sys.stderr, "Sleeping for 15 minutes, and then I'll try again...ZzZ..."
                sys.stderr.flush()
                time.sleep(60*15 + 5)
                print >> sys.stderr, '...ZzZ...Awake now and trying again.'
                return 2
            else:
                raise e # Allow user to handle the rate limiting issue however they'd like 
        elif e.e.code in (502, 503):
            print >> sys.stderr, 'Encountered %i Error. Will retry in %i seconds' % (e.e.code,
                    wait_period)
            time.sleep(wait_period)
            wait_period *= 1.5
            return wait_period
        else:
            raise e

    # End of nested helper function
    
    
    wait_period = 2 
    error_count = 0 

    while True:
        try:
            return twitter_api_func(*args, **kw)
        except twitter.api.TwitterHTTPError, e:
            error_count = 0 
            wait_period = handle_twitter_http_error(e, wait_period)
            if wait_period is None:
                return
        except URLError, e:
            error_count += 1
            print >> sys.stderr, "URLError encountered. Continuing."
            if error_count > max_errors:
                print >> sys.stderr, "Too many consecutive errors...bailing out."
                raise

# Sample usage

twitter_api = oauth_login()

# See https://dev.twitter.com/docs/api/1.1/get/users/lookup for twitter_api.users.lookup

response = make_twitter_request(twitter_api.users.lookup, screen_name="katyperry")

print json.dumps(response, indent=1)




from functools import partial
from sys import maxint

def get_friends_followers_ids(twitter_api, screen_name=None, user_id=None,
                              friends_limit=maxint, followers_limit=maxint):
    
    # Must have either screen_name or user_id (logical xor)
    assert (screen_name != None) != (user_id != None), "Must have screen_name or user_id, but not both"
    
    # See https://dev.twitter.com/docs/api/1.1/get/friends/ids  and
    # See https://dev.twitter.com/docs/api/1.1/get/followers/ids for details on API parameters
    
    get_friends_ids = partial(make_twitter_request, twitter_api.friends.ids, count=5000)
    get_followers_ids = partial(make_twitter_request, twitter_api.followers.ids, count=5000)

    friends_ids, followers_ids = [], []
    
    for twitter_api_func, limit, ids, label in [
                                 [get_friends_ids, friends_limit, friends_ids, "friends"], 
                                 [get_followers_ids, followers_limit, followers_ids, "followers"]
                             ]:
        
        cursor = -1
        while cursor != 0:
        
            # Use make_twitter_request via the partially bound callable...
            if screen_name: 
                response = twitter_api_func(screen_name=screen_name, cursor=cursor)
            else: # user_id
                response = twitter_api_func(user_id=user_id, cursor=cursor)

            ids += response['ids']
            cursor = response['next_cursor']
        
            print >> sys.stderr, 'Fetched {0} total {1} ids for {2}'.format(len(ids), label, (user_id or screen_name))
        
            # Consider storing the ids to disk during each iteration to provide an 
            # an additional layer of protection from exceptional circumstances
        
            if len(ids) >= limit:
                break

    # Do something useful with the ids like store them to disk...
    return friends_ids[:friends_limit], followers_ids[:followers_limit]

# Sample usage

twitter_api = oauth_login()

friends_ids, followers_ids = get_friends_followers_ids(twitter_api, screen_name="katyperry", friends_limit=10, followers_limit=10)

print friends_ids
print followers_ids
Fetched 158 total friends ids for katyperry
Fetched 5000 total followers ids for katyperry
[
 {
  "follow_request_sent": false, 
  "has_extended_profile": false, 
  "profile_use_background_image": true, 
  "default_profile_image": false, 
  "id": 21447363, 
  "profile_background_image_url_https": "https://pbs.twimg.com/profile_background_images/378800000168797027/kSZ-ewZo.jpeg", 
  "verified": true, 
  "profile_text_color": "5E412F", 
  "profile_image_url_https": "https://pbs.twimg.com/profile_images/682895129724600321/8dfQK5e__normal.jpg", 
  "profile_sidebar_fill_color": "78C0A8", 
  "entities": {
   "url": {
    "urls": [
     {
      "url": "https://t.co/TUWZkUWnUW", 
      "indices": [
       0, 
       23
      ], 
      "expanded_url": "http://www.katyperry.com", 
      "display_url": "katyperry.com"
     }
    ]
   }, 
   "description": {
    "urls": []
   }
  }, 
  "followers_count": 80573768, 
  "profile_sidebar_border_color": "FFFFFF", 
  "id_str": "21447363", 
  "profile_background_color": "CECFBC", 
  "listed_count": 142726, 
  "status": {
   "contributors": null, 
   "truncated": false, 
   "text": "PUMP. UP. THE. JAM\u2757\ufe0fPump up dem eyes \ud83d\udc41\ud83d\udca5 Right, @COVERGIRL? #plumpify https://t.co/ti2IcwKwJY", 
   "in_reply_to_status_id": null, 
   "id": 684940135457263617, 
   "favorite_count": 12614, 
   "source": "<a href=\"http://instagram.com\" rel=\"nofollow\">Instagram</a>", 
   "retweeted": false, 
   "coordinates": null, 
   "entities": {
    "symbols": [], 
    "user_mentions": [
     {
      "id": 180418331, 
      "indices": [
       47, 
       57
      ], 
      "id_str": "180418331", 
      "screen_name": "COVERGIRL", 
      "name": "COVERGIRL"
     }
    ], 
    "hashtags": [
     {
      "indices": [
       59, 
       68
      ], 
      "text": "plumpify"
     }
    ], 
    "urls": [
     {
      "url": "https://t.co/ti2IcwKwJY", 
      "indices": [
       69, 
       92
      ], 
      "expanded_url": "https://www.instagram.com/p/BAOQkzJP-aD/", 
      "display_url": "instagram.com/p/BAOQkzJP-aD/"
     }
    ]
   }, 
   "in_reply_to_screen_name": null, 
   "id_str": "684940135457263617", 
   "retweet_count": 5037, 
   "in_reply_to_user_id": null, 
   "favorited": false, 
   "geo": null, 
   "in_reply_to_user_id_str": null, 
   "possibly_sensitive": false, 
   "lang": "en", 
   "created_at": "Thu Jan 07 03:30:28 +0000 2016", 
   "in_reply_to_status_id_str": null, 
   "place": null
  }, 
  "is_translation_enabled": true, 
  "utc_offset": -32400, 
  "statuses_count": 6813, 
  "description": "Growing...", 
  "friends_count": 158, 
  "location": "", 
  "profile_link_color": "D55732", 
  "profile_image_url": "http://pbs.twimg.com/profile_images/682895129724600321/8dfQK5e__normal.jpg", 
  "following": false, 
  "geo_enabled": false, 
  "profile_banner_url": "https://pbs.twimg.com/profile_banners/21447363/1451649861", 
  "profile_background_image_url": "http://pbs.twimg.com/profile_background_images/378800000168797027/kSZ-ewZo.jpeg", 
  "screen_name": "katyperry", 
  "lang": "en", 
  "profile_background_tile": false, 
  "favourites_count": 2022, 
  "name": "KATY PERRY", 
  "notifications": false, 
  "url": "https://t.co/TUWZkUWnUW", 
  "created_at": "Fri Feb 20 23:45:56 +0000 2009", 
  "contributors_enabled": false, 
  "time_zone": "Alaska", 
  "protected": false, 
  "default_profile": false, 
  "is_translator": false
 }
]
[19719380, 1159251, 100220864, 2896348639L, 238319766, 22107140, 142118056, 1339835893, 351303896, 495766246]
[4767815854L, 4767786508L, 4767704025L, 4740000758L, 4767736415L, 4767656115L, 4767694887L, 4767808108L, 4740025033L, 4767751889L]

In [ ]:
 

No comments:

Post a Comment