In [ ]:
# just run all these cells,

In [2]:
print ("""
# first thing you need to do is get access tokens from twitter, 
# go to https://apps.twitter.com, create an app, create API access token,
# then fill out tokens.txt file in directory where .ipynb is sitting
# dont add tokens.txt file to git. leave it untracked. 
# (smart people in the internet say NEVER SHARE KEYS, never commit them to github and stuff)""")

with open('tokens.txt','w') as fout:
    fout.write('Consumer key\n')
    fout.write('Consumer secret\n')
    fout.write('token key\n')
    fout.write('token secret\n')


# first thing you need to do is get access tokens from twitter, 
# go to https://apps.twitter.com, create an app, create API access token,
# then fill out tokens.txt file in directory where .ipynb is sitting
# dont add tokens.txt file to git. leave it untracked. 
# (smart people in the internet say NEVER SHARE KEYS, never commit them to github and stuff)

In [3]:
import os
import hashlib

try: # i out my tokens into ENV variables, cuz that seems to be the practice,
     # if use stuff like that -- use it, if no, just use the tokens.txt file, ignore this code 
    consumer_key = os.environ['TWITTER_CONSUMER_KEY']
    consumer_secret = os.environ['TWITTER_CONSUMER_SECRET']
    token_key = os.environ['TWITTER_TOKENCS506_KEY']
    token_secret = os.environ['TWITTER_TOKENCS506_SECRET']
    print('Line1')
    
except:
    with open('tokens.txt','r') as fin:

        consumer_key = fin.readline()[:-1].encode('utf-8')
        consumer_secret = fin.readline().rstrip().encode('utf-8')
        token_key = fin.readline()[:-1].encode('utf-8')
        token_secret = fin.readline().rstrip().encode('utf-8')


Line1


In [4]:
# our first attept from GSU, get your home page 
# if you repeat this cell several times, it's easy to get banned
import oauth2
import json

def oauth_req(url, key, secret, http_method="GET", post_body="", http_headers=None):
    consumer = oauth2.Consumer(key=consumer_key, secret=consumer_secret)
    token = oauth2.Token(key=key, secret=secret)
    client = oauth2.Client(consumer, token)
    resp, content = client.request( url, method=http_method, body=post_body, headers=http_headers )
    return content

home_timeline = oauth_req( 'https://api.twitter.com/1.1/statuses/home_timeline.json', token_key, token_secret)

content = json.loads(home_timeline)
content[:10]

# for key in content[0]:
#     print key, content[key]
    
# print content[0].items()


# output = json.dumps(home_timeline)
# print output


Out[4]:
[{u'contributors': None,
  u'coordinates': None,
  u'created_at': u'Mon May 08 01:15:10 +0000 2017',
  u'entities': {u'hashtags': [],
   u'symbols': [],
   u'urls': [{u'display_url': u'buff.ly/2pQlx2d',
     u'expanded_url': u'http://buff.ly/2pQlx2d',
     u'indices': [41, 64],
     u'url': u'https://t.co/xVoCZI99EW'}],
   u'user_mentions': []},
  u'favorite_count': 5,
  u'favorited': False,
  u'geo': None,
  u'id': 861388978053931009,
  u'id_str': u'861388978053931009',
  u'in_reply_to_screen_name': None,
  u'in_reply_to_status_id': None,
  u'in_reply_to_status_id_str': None,
  u'in_reply_to_user_id': None,
  u'in_reply_to_user_id_str': None,
  u'is_quote_status': False,
  u'lang': u'en',
  u'place': None,
  u'possibly_sensitive': False,
  u'possibly_sensitive_appealable': False,
  u'retweet_count': 1,
  u'retweeted': False,
  u'source': u'<a href="http://bufferapp.com" rel="nofollow">Buffer</a>',
  u'text': u'"Why Are We so Distracted All the Time?" https://t.co/xVoCZI99EW',
  u'truncated': False,
  u'user': {u'contributors_enabled': False,
   u'created_at': u'Mon Nov 17 16:22:29 +0000 2008',
   u'default_profile': False,
   u'default_profile_image': False,
   u'description': u'Co-founder & CEO of @buffer: social media products with $14m revenue. Trying to create a workplace of the future. Our numbers: https://t.co/uRtotvKx4A',
   u'entities': {u'description': {u'urls': [{u'display_url': u'buffer.com/transparency',
       u'expanded_url': u'http://buffer.com/transparency',
       u'indices': [127, 150],
       u'url': u'https://t.co/uRtotvKx4A'}]},
    u'url': {u'urls': [{u'display_url': u'joel.is',
       u'expanded_url': u'http://joel.is',
       u'indices': [0, 23],
       u'url': u'https://t.co/YlhS0cvQNy'}]}},
   u'favourites_count': 13203,
   u'follow_request_sent': False,
   u'followers_count': 61337,
   u'following': True,
   u'friends_count': 5362,
   u'geo_enabled': True,
   u'has_extended_profile': True,
   u'id': 17444309,
   u'id_str': u'17444309',
   u'is_translation_enabled': False,
   u'is_translator': False,
   u'lang': u'en',
   u'listed_count': 3432,
   u'location': u'New York, NY',
   u'name': u'Joel Gascoigne',
   u'notifications': False,
   u'profile_background_color': u'C0DEED',
   u'profile_background_image_url': u'http://abs.twimg.com/images/themes/theme1/bg.png',
   u'profile_background_image_url_https': u'https://abs.twimg.com/images/themes/theme1/bg.png',
   u'profile_background_tile': False,
   u'profile_banner_url': u'https://pbs.twimg.com/profile_banners/17444309/1494179155',
   u'profile_image_url': u'http://pbs.twimg.com/profile_images/838047306343723008/kaSRjqZJ_normal.jpg',
   u'profile_image_url_https': u'https://pbs.twimg.com/profile_images/838047306343723008/kaSRjqZJ_normal.jpg',
   u'profile_link_color': u'168EEA',
   u'profile_sidebar_border_color': u'FFFFFF',
   u'profile_sidebar_fill_color': u'DDEEF6',
   u'profile_text_color': u'333333',
   u'profile_use_background_image': True,
   u'protected': False,
   u'screen_name': u'joelgascoigne',
   u'statuses_count': 41025,
   u'time_zone': u'Eastern Time (US & Canada)',
   u'translator_type': u'regular',
   u'url': u'https://t.co/YlhS0cvQNy',
   u'utc_offset': -14400,
   u'verified': True}},
 {u'contributors': None,
  u'coordinates': None,
  u'created_at': u'Mon May 08 00:53:04 +0000 2017',
  u'entities': {u'hashtags': [],
   u'media': [{u'display_url': u'pic.twitter.com/o726ZPu5FE',
     u'expanded_url': u'https://twitter.com/TechCrunch/status/861383413055541248/photo/1',
     u'id': 861383410450706432,
     u'id_str': u'861383410450706432',
     u'indices': [108, 131],
     u'media_url': u'http://pbs.twimg.com/media/C_Q_peNUMAAcOzu.jpg',
     u'media_url_https': u'https://pbs.twimg.com/media/C_Q_peNUMAAcOzu.jpg',
     u'sizes': {u'large': {u'h': 1191, u'resize': u'fit', u'w': 1861},
      u'medium': {u'h': 768, u'resize': u'fit', u'w': 1200},
      u'small': {u'h': 435, u'resize': u'fit', u'w': 680},
      u'thumb': {u'h': 150, u'resize': u'crop', u'w': 150}},
     u'type': u'photo',
     u'url': u'https://t.co/o726ZPu5FE'}],
   u'symbols': [],
   u'urls': [{u'display_url': u'tcrn.ch/2ppl58q',
     u'expanded_url': u'http://tcrn.ch/2ppl58q',
     u'indices': [67, 90],
     u'url': u'https://t.co/FkjDqDvM4H'}],
   u'user_mentions': [{u'id': 12373242,
     u'id_str': u'12373242',
     u'indices': [94, 107],
     u'name': u'Romain Dillet \U0001f643',
     u'screen_name': u'romaindillet'}]},
  u'extended_entities': {u'media': [{u'display_url': u'pic.twitter.com/o726ZPu5FE',
     u'expanded_url': u'https://twitter.com/TechCrunch/status/861383413055541248/photo/1',
     u'id': 861383410450706432,
     u'id_str': u'861383410450706432',
     u'indices': [108, 131],
     u'media_url': u'http://pbs.twimg.com/media/C_Q_peNUMAAcOzu.jpg',
     u'media_url_https': u'https://pbs.twimg.com/media/C_Q_peNUMAAcOzu.jpg',
     u'sizes': {u'large': {u'h': 1191, u'resize': u'fit', u'w': 1861},
      u'medium': {u'h': 768, u'resize': u'fit', u'w': 1200},
      u'small': {u'h': 435, u'resize': u'fit', u'w': 680},
      u'thumb': {u'h': 150, u'resize': u'crop', u'w': 150}},
     u'type': u'photo',
     u'url': u'https://t.co/o726ZPu5FE'}]},
  u'favorite_count': 45,
  u'favorited': False,
  u'geo': None,
  u'id': 861383413055541248,
  u'id_str': u'861383413055541248',
  u'in_reply_to_screen_name': None,
  u'in_reply_to_status_id': None,
  u'in_reply_to_status_id_str': None,
  u'in_reply_to_user_id': None,
  u'in_reply_to_user_id_str': None,
  u'is_quote_status': False,
  u'lang': u'en',
  u'place': None,
  u'possibly_sensitive': False,
  u'possibly_sensitive_appealable': False,
  u'retweet_count': 31,
  u'retweeted': False,
  u'source': u'<a href="http://10up.com" rel="nofollow">10up Publish Tweet</a>',
  u'text': u'Emmanuel Macron and how political campaigns will never be the same https://t.co/FkjDqDvM4H by @romaindillet https://t.co/o726ZPu5FE',
  u'truncated': False,
  u'user': {u'contributors_enabled': False,
   u'created_at': u'Wed Mar 07 01:27:09 +0000 2007',
   u'default_profile': False,
   u'default_profile_image': False,
   u'description': u'Breaking technology news, analysis, and opinions from TechCrunch. The number one guide for all things tech. Got a tip? Let us know tips@techcrunch.com',
   u'entities': {u'description': {u'urls': []},
    u'url': {u'urls': [{u'display_url': u'techcrunch.com',
       u'expanded_url': u'http://techcrunch.com',
       u'indices': [0, 23],
       u'url': u'https://t.co/b5Oyx12qGG'}]}},
   u'favourites_count': 1940,
   u'follow_request_sent': False,
   u'followers_count': 9049716,
   u'following': True,
   u'friends_count': 910,
   u'geo_enabled': True,
   u'has_extended_profile': False,
   u'id': 816653,
   u'id_str': u'816653',
   u'is_translation_enabled': True,
   u'is_translator': False,
   u'lang': u'en',
   u'listed_count': 109033,
   u'location': u'San Francisco, CA',
   u'name': u'TechCrunch',
   u'notifications': False,
   u'profile_background_color': u'149500',
   u'profile_background_image_url': u'http://pbs.twimg.com/profile_background_images/621096023751004161/BAKy7hCT.png',
   u'profile_background_image_url_https': u'https://pbs.twimg.com/profile_background_images/621096023751004161/BAKy7hCT.png',
   u'profile_background_tile': False,
   u'profile_banner_url': u'https://pbs.twimg.com/profile_banners/816653/1492704252',
   u'profile_image_url': u'http://pbs.twimg.com/profile_images/615392662233808896/EtxjSSKk_normal.jpg',
   u'profile_image_url_https': u'https://pbs.twimg.com/profile_images/615392662233808896/EtxjSSKk_normal.jpg',
   u'profile_link_color': u'097000',
   u'profile_sidebar_border_color': u'FFFFFF',
   u'profile_sidebar_fill_color': u'DDFFCC',
   u'profile_text_color': u'222222',
   u'profile_use_background_image': True,
   u'protected': False,
   u'screen_name': u'TechCrunch',
   u'statuses_count': 155606,
   u'time_zone': u'Pacific Time (US & Canada)',
   u'translator_type': u'none',
   u'url': u'https://t.co/b5Oyx12qGG',
   u'utc_offset': -25200,
   u'verified': True}},
 {u'contributors': None,
  u'coordinates': None,
  u'created_at': u'Mon May 08 00:15:18 +0000 2017',
  u'entities': {u'hashtags': [],
   u'symbols': [],
   u'urls': [],
   u'user_mentions': [{u'id': 13235832,
     u'id_str': u'13235832',
     u'indices': [3, 15],
     u'name': u'Nat Friedman',
     u'screen_name': u'natfriedman'}]},
  u'favorite_count': 0,
  u'favorited': False,
  u'geo': None,
  u'id': 861373911220461569,
  u'id_str': u'861373911220461569',
  u'in_reply_to_screen_name': None,
  u'in_reply_to_status_id': None,
  u'in_reply_to_status_id_str': None,
  u'in_reply_to_user_id': None,
  u'in_reply_to_user_id_str': None,
  u'is_quote_status': False,
  u'lang': u'en',
  u'place': None,
  u'retweet_count': 58,
  u'retweeted': False,
  u'retweeted_status': {u'contributors': None,
   u'coordinates': None,
   u'created_at': u'Sun May 07 17:03:07 +0000 2017',
   u'entities': {u'hashtags': [],
    u'symbols': [],
    u'urls': [{u'display_url': u'sfchronicle.com/aboutsfgate/ar\u2026',
      u'expanded_url': u'http://www.sfchronicle.com/aboutsfgate/article/Nonprofit-pledges-100-million-to-aid-SF-s-11126953.php',
      u'indices': [103, 126],
      u'url': u'https://t.co/oWCIXg4fji'}],
    u'user_mentions': []},
   u'favorite_count': 124,
   u'favorited': False,
   u'geo': None,
   u'id': 861265147481935872,
   u'id_str': u'861265147481935872',
   u'in_reply_to_screen_name': None,
   u'in_reply_to_status_id': None,
   u'in_reply_to_status_id_str': None,
   u'in_reply_to_user_id': None,
   u'in_reply_to_user_id_str': None,
   u'is_quote_status': False,
   u'lang': u'en',
   u'place': None,
   u'possibly_sensitive': False,
   u'possibly_sensitive_appealable': False,
   u'retweet_count': 58,
   u'retweeted': False,
   u'source': u'<a href="http://twitter.com/download/iphone" rel="nofollow">Twitter for iPhone</a>',
   u'text': u'An anonymous donor has enabled Tipping Point to give $100M to house the chronically homeless in SF.  \U0001f60d https://t.co/oWCIXg4fji',
   u'truncated': False,
   u'user': {u'contributors_enabled': False,
    u'created_at': u'Fri Feb 08 05:20:41 +0000 2008',
    u'default_profile': True,
    u'default_profile_image': False,
    u'description': u'Cofounder/CEO Xamarin. Now @microsoft. Views mine.',
    u'entities': {u'description': {u'urls': []},
     u'url': {u'urls': [{u'display_url': u'nat.org',
        u'expanded_url': u'http://nat.org',
        u'indices': [0, 23],
        u'url': u'https://t.co/d10brIeI1h'}]}},
    u'favourites_count': 9185,
    u'follow_request_sent': False,
    u'followers_count': 13761,
    u'following': False,
    u'friends_count': 1304,
    u'geo_enabled': False,
    u'has_extended_profile': True,
    u'id': 13235832,
    u'id_str': u'13235832',
    u'is_translation_enabled': False,
    u'is_translator': False,
    u'lang': u'en',
    u'listed_count': 583,
    u'location': u'San Francisco',
    u'name': u'Nat Friedman',
    u'notifications': False,
    u'profile_background_color': u'C0DEED',
    u'profile_background_image_url': u'http://abs.twimg.com/images/themes/theme1/bg.png',
    u'profile_background_image_url_https': u'https://abs.twimg.com/images/themes/theme1/bg.png',
    u'profile_background_tile': False,
    u'profile_banner_url': u'https://pbs.twimg.com/profile_banners/13235832/1438132115',
    u'profile_image_url': u'http://pbs.twimg.com/profile_images/1677873294/image_normal.jpg',
    u'profile_image_url_https': u'https://pbs.twimg.com/profile_images/1677873294/image_normal.jpg',
    u'profile_link_color': u'1DA1F2',
    u'profile_sidebar_border_color': u'C0DEED',
    u'profile_sidebar_fill_color': u'DDEEF6',
    u'profile_text_color': u'333333',
    u'profile_use_background_image': True,
    u'protected': False,
    u'screen_name': u'natfriedman',
    u'statuses_count': 12700,
    u'time_zone': u'Pacific Time (US & Canada)',
    u'translator_type': u'none',
    u'url': u'https://t.co/d10brIeI1h',
    u'utc_offset': -25200,
    u'verified': False}},
  u'source': u'<a href="http://twitter.com/download/iphone" rel="nofollow">Twitter for iPhone</a>',
  u'text': u'RT @natfriedman: An anonymous donor has enabled Tipping Point to give $100M to house the chronically homeless in SF.  \U0001f60d https://t.co/oWCIXg\u2026',
  u'truncated': False,
  u'user': {u'contributors_enabled': False,
   u'created_at': u'Thu Nov 09 19:33:52 +0000 2006',
   u'default_profile': False,
   u'default_profile_image': False,
   u'description': u'Devoted to making magical learning experiences for kids. See https://t.co/R6iaocCzz0 and https://t.co/zQYK2AM8Rm.',
   u'entities': {u'description': {u'urls': [{u'display_url': u'diy.org',
       u'expanded_url': u'http://diy.org',
       u'indices': [61, 84],
       u'url': u'https://t.co/R6iaocCzz0'},
      {u'display_url': u'jam.com',
       u'expanded_url': u'http://jam.com',
       u'indices': [89, 112],
       u'url': u'https://t.co/zQYK2AM8Rm'}]}},
   u'favourites_count': 7578,
   u'follow_request_sent': False,
   u'followers_count': 22441,
   u'following': True,
   u'friends_count': 31,
   u'geo_enabled': True,
   u'has_extended_profile': False,
   u'id': 11969,
   u'id_str': u'11969',
   u'is_translation_enabled': False,
   u'is_translator': False,
   u'lang': u'en',
   u'listed_count': 1285,
   u'location': u'SF',
   u'name': u'Zach Klein',
   u'notifications': False,
   u'profile_background_color': u'A3A3A3',
   u'profile_background_image_url': u'http://pbs.twimg.com/profile_background_images/382750995/4899419101_f69168a974_o.jpeg',
   u'profile_background_image_url_https': u'https://pbs.twimg.com/profile_background_images/382750995/4899419101_f69168a974_o.jpeg',
   u'profile_background_tile': True,
   u'profile_banner_url': u'https://pbs.twimg.com/profile_banners/11969/1423886041',
   u'profile_image_url': u'http://pbs.twimg.com/profile_images/850350156985671680/V0NzCRuK_normal.jpg',
   u'profile_image_url_https': u'https://pbs.twimg.com/profile_images/850350156985671680/V0NzCRuK_normal.jpg',
   u'profile_link_color': u'4A913C',
   u'profile_sidebar_border_color': u'FFFFFF',
   u'profile_sidebar_fill_color': u'C9FF26',
   u'profile_text_color': u'000000',
   u'profile_use_background_image': False,
   u'protected': False,
   u'screen_name': u'zachklein',
   u'statuses_count': 71,
   u'time_zone': u'Pacific Time (US & Canada)',
   u'translator_type': u'none',
   u'url': None,
   u'utc_offset': -25200,
   u'verified': True}},
 {u'contributors': None,
  u'coordinates': None,
  u'created_at': u'Sun May 07 23:00:35 +0000 2017',
  u'entities': {u'hashtags': [],
   u'symbols': [],
   u'urls': [],
   u'user_mentions': []},
  u'favorite_count': 0,
  u'favorited': False,
  u'geo': None,
  u'id': 861355106628927489,
  u'id_str': u'861355106628927489',
  u'in_reply_to_screen_name': u'steve_b_n_w',
  u'in_reply_to_status_id': 861354229692338181,
  u'in_reply_to_status_id_str': u'861354229692338181',
  u'in_reply_to_user_id': 262300371,
  u'in_reply_to_user_id_str': u'262300371',
  u'is_quote_status': False,
  u'lang': u'ru',
  u'place': None,
  u'retweet_count': 0,
  u'retweeted': False,
  u'source': u'<a href="http://twitter.com" rel="nofollow">Twitter Web Client</a>',
  u'text': u'\u042f \u0447\u0443\u0442\u044c \u043d\u0435 \u043a\u043e\u043d\u0447\u0438\u043b\u0441\u044f, \u043a\u043e\u0440\u043e\u0447\u0435. \u0411\u043b\u044f. \u0415\u0449\u0451 \u043a\u0430\u043f\u043b\u0438 \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0430\u0434\u0430\u044e\u0442 \u0432 \u043c\u0435\u0442\u0430\u043b\u043b\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043c\u0438\u0441\u043a\u0443 \u0438 \u043a\u0430\u043a \u0431\u0443\u0434\u0442\u043e \u043a\u043e\u0448\u043a\u0430 \u0433\u0434\u0435-\u0442\u043e \u0441\u043a\u0440\u0435\u0431\u0451\u0442\u0441\u044f.',
  u'truncated': False,
  u'user': {u'contributors_enabled': False,
   u'created_at': u'Mon Mar 07 19:50:11 +0000 2011',
   u'default_profile': True,
   u'default_profile_image': False,
   u'description': u"What's the matter? Never seen a black-and-white before?",
   u'entities': {u'description': {u'urls': []}},
   u'favourites_count': 45,
   u'follow_request_sent': False,
   u'followers_count': 40,
   u'following': True,
   u'friends_count': 43,
   u'geo_enabled': True,
   u'has_extended_profile': False,
   u'id': 262300371,
   u'id_str': u'262300371',
   u'is_translation_enabled': False,
   u'is_translator': False,
   u'lang': u'ru',
   u'listed_count': 0,
   u'location': u'Where the Wild Things Are',
   u'name': u'Steve B&W',
   u'notifications': False,
   u'profile_background_color': u'C0DEED',
   u'profile_background_image_url': u'http://abs.twimg.com/images/themes/theme1/bg.png',
   u'profile_background_image_url_https': u'https://abs.twimg.com/images/themes/theme1/bg.png',
   u'profile_background_tile': False,
   u'profile_image_url': u'http://pbs.twimg.com/profile_images/378800000753868290/749ede60fa5f5b8d79a1b09b8ac367bb_normal.jpeg',
   u'profile_image_url_https': u'https://pbs.twimg.com/profile_images/378800000753868290/749ede60fa5f5b8d79a1b09b8ac367bb_normal.jpeg',
   u'profile_link_color': u'1DA1F2',
   u'profile_sidebar_border_color': u'C0DEED',
   u'profile_sidebar_fill_color': u'DDEEF6',
   u'profile_text_color': u'333333',
   u'profile_use_background_image': True,
   u'protected': False,
   u'screen_name': u'steve_b_n_w',
   u'statuses_count': 1756,
   u'time_zone': u'Moscow',
   u'translator_type': u'none',
   u'url': None,
   u'utc_offset': 10800,
   u'verified': False}},
 {u'contributors': None,
  u'coordinates': None,
  u'created_at': u'Sun May 07 22:57:06 +0000 2017',
  u'entities': {u'hashtags': [],
   u'symbols': [],
   u'urls': [],
   u'user_mentions': []},
  u'favorite_count': 0,
  u'favorited': False,
  u'geo': None,
  u'id': 861354229692338181,
  u'id_str': u'861354229692338181',
  u'in_reply_to_screen_name': None,
  u'in_reply_to_status_id': None,
  u'in_reply_to_status_id_str': None,
  u'in_reply_to_user_id': None,
  u'in_reply_to_user_id_str': None,
  u'is_quote_status': False,
  u'lang': u'ru',
  u'place': None,
  u'retweet_count': 0,
  u'retweeted': False,
  u'source': u'<a href="http://twitter.com" rel="nofollow">Twitter Web Client</a>',
  u'text': u'\u0414\u0430\u0447\u0430 - \u0441\u0442\u0440\u0430\u0448\u043d\u043e\u0435 \u043c\u0435\u0441\u0442\u043e. \u0421\u0438\u0434\u0438\u0448\u044c \u043d\u0430 \u0443\u043b\u0438\u0446\u0435, \u0432\u0434\u0440\u0443\u0433 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0433\u0440\u043e\u043c\u043a\u0438\u0439 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0439 \u0437\u0432\u0443\u043a \u0438\u0437 \u043d\u043e\u0447\u043d\u043e\u0439 \u0442\u044c\u043c\u044b. \u0410 \u044d\u0442\u043e \u0440\u043e\u043b\u0438\u043a \u043d\u0430 YouTube \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0434\u0440\u0443\u0433\u0438\u0437\u0438\u0442\u044c\u0441\u044f.',
  u'truncated': False,
  u'user': {u'contributors_enabled': False,
   u'created_at': u'Mon Mar 07 19:50:11 +0000 2011',
   u'default_profile': True,
   u'default_profile_image': False,
   u'description': u"What's the matter? Never seen a black-and-white before?",
   u'entities': {u'description': {u'urls': []}},
   u'favourites_count': 45,
   u'follow_request_sent': False,
   u'followers_count': 40,
   u'following': True,
   u'friends_count': 43,
   u'geo_enabled': True,
   u'has_extended_profile': False,
   u'id': 262300371,
   u'id_str': u'262300371',
   u'is_translation_enabled': False,
   u'is_translator': False,
   u'lang': u'ru',
   u'listed_count': 0,
   u'location': u'Where the Wild Things Are',
   u'name': u'Steve B&W',
   u'notifications': False,
   u'profile_background_color': u'C0DEED',
   u'profile_background_image_url': u'http://abs.twimg.com/images/themes/theme1/bg.png',
   u'profile_background_image_url_https': u'https://abs.twimg.com/images/themes/theme1/bg.png',
   u'profile_background_tile': False,
   u'profile_image_url': u'http://pbs.twimg.com/profile_images/378800000753868290/749ede60fa5f5b8d79a1b09b8ac367bb_normal.jpeg',
   u'profile_image_url_https': u'https://pbs.twimg.com/profile_images/378800000753868290/749ede60fa5f5b8d79a1b09b8ac367bb_normal.jpeg',
   u'profile_link_color': u'1DA1F2',
   u'profile_sidebar_border_color': u'C0DEED',
   u'profile_sidebar_fill_color': u'DDEEF6',
   u'profile_text_color': u'333333',
   u'profile_use_background_image': True,
   u'protected': False,
   u'screen_name': u'steve_b_n_w',
   u'statuses_count': 1756,
   u'time_zone': u'Moscow',
   u'translator_type': u'none',
   u'url': None,
   u'utc_offset': 10800,
   u'verified': False}},
 {u'contributors': None,
  u'coordinates': None,
  u'created_at': u'Sun May 07 22:54:23 +0000 2017',
  u'entities': {u'hashtags': [],
   u'symbols': [],
   u'urls': [{u'display_url': u'tcrn.ch/2paJ2V4',
     u'expanded_url': u'http://tcrn.ch/2paJ2V4',
     u'indices': [97, 120],
     u'url': u'https://t.co/DzwQ70myMs'}],
   u'user_mentions': [{u'id': 7095,
     u'id_str': u'7095',
     u'indices': [124, 131],
     u'name': u'Connie Loizos',
     u'screen_name': u'Cookie'}]},
  u'favorite_count': 18,
  u'favorited': False,
  u'geo': None,
  u'id': 861353547765391360,
  u'id_str': u'861353547765391360',
  u'in_reply_to_screen_name': None,
  u'in_reply_to_status_id': None,
  u'in_reply_to_status_id_str': None,
  u'in_reply_to_user_id': None,
  u'in_reply_to_user_id_str': None,
  u'is_quote_status': False,
  u'lang': u'en',
  u'place': None,
  u'possibly_sensitive': False,
  u'possibly_sensitive_appealable': False,
  u'retweet_count': 17,
  u'retweeted': False,
  u'source': u'<a href="http://10up.com" rel="nofollow">10up Publish Tweet</a>',
  u'text': u"Confide CEO Jon Brod on the White House, bad press, and what's next for his secure messaging app https://t.co/DzwQ70myMs by @cookie",
  u'truncated': False,
  u'user': {u'contributors_enabled': False,
   u'created_at': u'Wed Mar 07 01:27:09 +0000 2007',
   u'default_profile': False,
   u'default_profile_image': False,
   u'description': u'Breaking technology news, analysis, and opinions from TechCrunch. The number one guide for all things tech. Got a tip? Let us know tips@techcrunch.com',
   u'entities': {u'description': {u'urls': []},
    u'url': {u'urls': [{u'display_url': u'techcrunch.com',
       u'expanded_url': u'http://techcrunch.com',
       u'indices': [0, 23],
       u'url': u'https://t.co/b5Oyx12qGG'}]}},
   u'favourites_count': 1940,
   u'follow_request_sent': False,
   u'followers_count': 9049716,
   u'following': True,
   u'friends_count': 910,
   u'geo_enabled': True,
   u'has_extended_profile': False,
   u'id': 816653,
   u'id_str': u'816653',
   u'is_translation_enabled': True,
   u'is_translator': False,
   u'lang': u'en',
   u'listed_count': 109033,
   u'location': u'San Francisco, CA',
   u'name': u'TechCrunch',
   u'notifications': False,
   u'profile_background_color': u'149500',
   u'profile_background_image_url': u'http://pbs.twimg.com/profile_background_images/621096023751004161/BAKy7hCT.png',
   u'profile_background_image_url_https': u'https://pbs.twimg.com/profile_background_images/621096023751004161/BAKy7hCT.png',
   u'profile_background_tile': False,
   u'profile_banner_url': u'https://pbs.twimg.com/profile_banners/816653/1492704252',
   u'profile_image_url': u'http://pbs.twimg.com/profile_images/615392662233808896/EtxjSSKk_normal.jpg',
   u'profile_image_url_https': u'https://pbs.twimg.com/profile_images/615392662233808896/EtxjSSKk_normal.jpg',
   u'profile_link_color': u'097000',
   u'profile_sidebar_border_color': u'FFFFFF',
   u'profile_sidebar_fill_color': u'DDFFCC',
   u'profile_text_color': u'222222',
   u'profile_use_background_image': True,
   u'protected': False,
   u'screen_name': u'TechCrunch',
   u'statuses_count': 155606,
   u'time_zone': u'Pacific Time (US & Canada)',
   u'translator_type': u'none',
   u'url': u'https://t.co/b5Oyx12qGG',
   u'utc_offset': -25200,
   u'verified': True}},
 {u'contributors': None,
  u'coordinates': None,
  u'created_at': u'Sun May 07 22:45:47 +0000 2017',
  u'entities': {u'hashtags': [],
   u'media': [{u'display_url': u'pic.twitter.com/mJqIExlb6D',
     u'expanded_url': u'https://twitter.com/TechCrunch/status/861351382527299585/video/1',
     u'id': 861351234824880128,
     u'id_str': u'861351234824880128',
     u'indices': [99, 122],
     u'media_url': u'http://pbs.twimg.com/media/C_QigyPUwAAaXFk.jpg',
     u'media_url_https': u'https://pbs.twimg.com/media/C_QigyPUwAAaXFk.jpg',
     u'sizes': {u'large': {u'h': 720, u'resize': u'fit', u'w': 1280},
      u'medium': {u'h': 675, u'resize': u'fit', u'w': 1200},
      u'small': {u'h': 383, u'resize': u'fit', u'w': 680},
      u'thumb': {u'h': 150, u'resize': u'crop', u'w': 150}},
     u'type': u'photo',
     u'url': u'https://t.co/mJqIExlb6D'}],
   u'symbols': [],
   u'urls': [{u'display_url': u'tcrn.ch/2pSgD5k',
     u'expanded_url': u'http://tcrn.ch/2pSgD5k',
     u'indices': [75, 98],
     u'url': u'https://t.co/n5DKC17zMi'}],
   u'user_mentions': []},
  u'extended_entities': {u'media': [{u'additional_media_info': {u'call_to_actions': {u'visit_site': {u'url': u'http://www.techcrunch.com/video'}},
      u'description': u'Follow @TechCrunch',
      u'embeddable': True,
      u'monetizable': True,
      u'title': u'Blindpad'},
     u'display_url': u'pic.twitter.com/mJqIExlb6D',
     u'expanded_url': u'https://twitter.com/TechCrunch/status/861351382527299585/video/1',
     u'id': 861351234824880128,
     u'id_str': u'861351234824880128',
     u'indices': [99, 122],
     u'media_url': u'http://pbs.twimg.com/media/C_QigyPUwAAaXFk.jpg',
     u'media_url_https': u'https://pbs.twimg.com/media/C_QigyPUwAAaXFk.jpg',
     u'sizes': {u'large': {u'h': 720, u'resize': u'fit', u'w': 1280},
      u'medium': {u'h': 675, u'resize': u'fit', u'w': 1200},
      u'small': {u'h': 383, u'resize': u'fit', u'w': 680},
      u'thumb': {u'h': 150, u'resize': u'crop', u'w': 150}},
     u'type': u'video',
     u'url': u'https://t.co/mJqIExlb6D',
     u'video_info': {u'aspect_ratio': [16, 9],
      u'duration_millis': 43277,
      u'variants': [{u'bitrate': 832000,
        u'content_type': u'video/mp4',
        u'url': u'https://video.twimg.com/amplify_video/861351234824880128/vid/640x360/WfKO9p6IuJAF-TVL.mp4'},
       {u'bitrate': 320000,
        u'content_type': u'video/mp4',
        u'url': u'https://video.twimg.com/amplify_video/861351234824880128/vid/320x180/1RZxb55uo021dKJK.mp4'},
       {u'bitrate': 2176000,
        u'content_type': u'video/mp4',
        u'url': u'https://video.twimg.com/amplify_video/861351234824880128/vid/1280x720/owh0YYqFf-Ut26XT.mp4'},
       {u'content_type': u'application/x-mpegURL',
        u'url': u'https://video.twimg.com/amplify_video/861351234824880128/pl/Dqhg5dZutsL-uNHg.m3u8'}]}}]},
  u'favorite_count': 90,
  u'favorited': False,
  u'geo': None,
  u'id': 861351382527299585,
  u'id_str': u'861351382527299585',
  u'in_reply_to_screen_name': None,
  u'in_reply_to_status_id': None,
  u'in_reply_to_status_id_str': None,
  u'in_reply_to_user_id': None,
  u'in_reply_to_user_id_str': None,
  u'is_quote_status': False,
  u'lang': u'en',
  u'place': None,
  u'possibly_sensitive': False,
  u'possibly_sensitive_appealable': False,
  u'retweet_count': 71,
  u'retweeted': False,
  u'source': u'<a href="http://snappytv.com" rel="nofollow">SnappyTV.com</a>',
  u'text': u'BlindPAD\u2019s tablet makes visual information tactile for the vision-impaired https://t.co/n5DKC17zMi https://t.co/mJqIExlb6D',
  u'truncated': False,
  u'user': {u'contributors_enabled': False,
   u'created_at': u'Wed Mar 07 01:27:09 +0000 2007',
   u'default_profile': False,
   u'default_profile_image': False,
   u'description': u'Breaking technology news, analysis, and opinions from TechCrunch. The number one guide for all things tech. Got a tip? Let us know tips@techcrunch.com',
   u'entities': {u'description': {u'urls': []},
    u'url': {u'urls': [{u'display_url': u'techcrunch.com',
       u'expanded_url': u'http://techcrunch.com',
       u'indices': [0, 23],
       u'url': u'https://t.co/b5Oyx12qGG'}]}},
   u'favourites_count': 1940,
   u'follow_request_sent': False,
   u'followers_count': 9049716,
   u'following': True,
   u'friends_count': 910,
   u'geo_enabled': True,
   u'has_extended_profile': False,
   u'id': 816653,
   u'id_str': u'816653',
   u'is_translation_enabled': True,
   u'is_translator': False,
   u'lang': u'en',
   u'listed_count': 109033,
   u'location': u'San Francisco, CA',
   u'name': u'TechCrunch',
   u'notifications': False,
   u'profile_background_color': u'149500',
   u'profile_background_image_url': u'http://pbs.twimg.com/profile_background_images/621096023751004161/BAKy7hCT.png',
   u'profile_background_image_url_https': u'https://pbs.twimg.com/profile_background_images/621096023751004161/BAKy7hCT.png',
   u'profile_background_tile': False,
   u'profile_banner_url': u'https://pbs.twimg.com/profile_banners/816653/1492704252',
   u'profile_image_url': u'http://pbs.twimg.com/profile_images/615392662233808896/EtxjSSKk_normal.jpg',
   u'profile_image_url_https': u'https://pbs.twimg.com/profile_images/615392662233808896/EtxjSSKk_normal.jpg',
   u'profile_link_color': u'097000',
   u'profile_sidebar_border_color': u'FFFFFF',
   u'profile_sidebar_fill_color': u'DDFFCC',
   u'profile_text_color': u'222222',
   u'profile_use_background_image': True,
   u'protected': False,
   u'screen_name': u'TechCrunch',
   u'statuses_count': 155606,
   u'time_zone': u'Pacific Time (US & Canada)',
   u'translator_type': u'none',
   u'url': u'https://t.co/b5Oyx12qGG',
   u'utc_offset': -25200,
   u'verified': True}},
 {u'contributors': None,
  u'coordinates': None,
  u'created_at': u'Sun May 07 22:28:03 +0000 2017',
  u'entities': {u'hashtags': [],
   u'symbols': [],
   u'urls': [],
   u'user_mentions': [{u'id': 32499999,
     u'id_str': u'32499999',
     u'indices': [3, 14],
     u'name': u'Cloudflare',
     u'screen_name': u'Cloudflare'}]},
  u'favorite_count': 0,
  u'favorited': False,
  u'geo': None,
  u'id': 861346918458249216,
  u'id_str': u'861346918458249216',
  u'in_reply_to_screen_name': None,
  u'in_reply_to_status_id': None,
  u'in_reply_to_status_id_str': None,
  u'in_reply_to_user_id': None,
  u'in_reply_to_user_id_str': None,
  u'is_quote_status': False,
  u'lang': u'en',
  u'place': None,
  u'retweet_count': 26,
  u'retweeted': False,
  u'retweeted_status': {u'contributors': None,
   u'coordinates': None,
   u'created_at': u'Sun May 07 19:40:31 +0000 2017',
   u'entities': {u'hashtags': [],
    u'symbols': [],
    u'urls': [{u'display_url': u'cfl.re/2pQDVba',
      u'expanded_url': u'http://cfl.re/2pQDVba',
      u'indices': [109, 132],
      u'url': u'https://t.co/BYjCElIABp'}],
    u'user_mentions': []},
   u'favorite_count': 36,
   u'favorited': False,
   u'geo': None,
   u'id': 861304757100654592,
   u'id_str': u'861304757100654592',
   u'in_reply_to_screen_name': None,
   u'in_reply_to_status_id': None,
   u'in_reply_to_status_id_str': None,
   u'in_reply_to_user_id': None,
   u'in_reply_to_user_id_str': None,
   u'is_quote_status': False,
   u'lang': u'en',
   u'place': None,
   u'possibly_sensitive': False,
   u'possibly_sensitive_appealable': False,
   u'retweet_count': 26,
   u'retweeted': False,
   u'source': u'<a href="http://bufferapp.com" rel="nofollow">Buffer</a>',
   u'text': u"We're making a change to how we handle certain types of abuse reports based on feedback. Read about it here: https://t.co/BYjCElIABp",
   u'truncated': False,
   u'user': {u'contributors_enabled': False,
    u'created_at': u'Fri Apr 17 17:58:28 +0000 2009',
    u'default_profile': False,
    u'default_profile_image': False,
    u'description': u'The Web Performance & Security Company.',
    u'entities': {u'description': {u'urls': []},
     u'url': {u'urls': [{u'display_url': u'cloudflare.com',
        u'expanded_url': u'http://www.cloudflare.com',
        u'indices': [0, 22],
        u'url': u'http://t.co/SiLvmue9fJ'}]}},
    u'favourites_count': 2062,
    u'follow_request_sent': False,
    u'followers_count': 59648,
    u'following': False,
    u'friends_count': 6449,
    u'geo_enabled': False,
    u'has_extended_profile': False,
    u'id': 32499999,
    u'id_str': u'32499999',
    u'is_translation_enabled': False,
    u'is_translator': False,
    u'lang': u'en',
    u'listed_count': 1436,
    u'location': u'San Francisco, CA',
    u'name': u'Cloudflare',
    u'notifications': False,
    u'profile_background_color': u'FFFFFF',
    u'profile_background_image_url': u'http://pbs.twimg.com/profile_background_images/443625341668429824/bD2X48op.jpeg',
    u'profile_background_image_url_https': u'https://pbs.twimg.com/profile_background_images/443625341668429824/bD2X48op.jpeg',
    u'profile_background_tile': False,
    u'profile_banner_url': u'https://pbs.twimg.com/profile_banners/32499999/1488999489',
    u'profile_image_url': u'http://pbs.twimg.com/profile_images/780833623343628289/zVBTmpVO_normal.jpg',
    u'profile_image_url_https': u'https://pbs.twimg.com/profile_images/780833623343628289/zVBTmpVO_normal.jpg',
    u'profile_link_color': u'007FD9',
    u'profile_sidebar_border_color': u'FFFFFF',
    u'profile_sidebar_fill_color': u'CFE5EE',
    u'profile_text_color': u'333333',
    u'profile_use_background_image': False,
    u'protected': False,
    u'screen_name': u'Cloudflare',
    u'statuses_count': 35473,
    u'time_zone': u'Pacific Time (US & Canada)',
    u'translator_type': u'none',
    u'url': u'http://t.co/SiLvmue9fJ',
    u'utc_offset': -25200,
    u'verified': True}},
  u'source': u'<a href="http://twitter.com" rel="nofollow">Twitter Web Client</a>',
  u'text': u"RT @Cloudflare: We're making a change to how we handle certain types of abuse reports based on feedback. Read about it here: https://t.co/B\u2026",
  u'truncated': False,
  u'user': {u'contributors_enabled': False,
   u'created_at': u'Sun Apr 29 20:50:37 +0000 2007',
   u'default_profile': False,
   u'default_profile_image': False,
   u'description': u"Indoor enthusiast. Co-founder of https://t.co/P7MEYP7MjF and https://t.co/rlk2RG61MA. Disclaimer: I have no idea what I'm talking about.",
   u'entities': {u'description': {u'urls': [{u'display_url': u'stackoverflow.com',
       u'expanded_url': u'http://stackoverflow.com',
       u'indices': [33, 56],
       u'url': u'https://t.co/P7MEYP7MjF'},
      {u'display_url': u'discourse.org',
       u'expanded_url': u'http://discourse.org',
       u'indices': [61, 84],
       u'url': u'https://t.co/rlk2RG61MA'}]},
    u'url': {u'urls': [{u'display_url': u'blog.codinghorror.com',
       u'expanded_url': u'http://blog.codinghorror.com',
       u'indices': [0, 22],
       u'url': u'http://t.co/rM9N1bQpLr'}]}},
   u'favourites_count': 13532,
   u'follow_request_sent': False,
   u'followers_count': 222299,
   u'following': True,
   u'friends_count': 183,
   u'geo_enabled': False,
   u'has_extended_profile': False,
   u'id': 5637652,
   u'id_str': u'5637652',
   u'is_translation_enabled': False,
   u'is_translator': False,
   u'lang': u'en',
   u'listed_count': 9411,
   u'location': u'Bay Area, CA',
   u'name': u'Jeff Atwood',
   u'notifications': False,
   u'profile_background_color': u'FFFFFF',
   u'profile_background_image_url': u'http://pbs.twimg.com/profile_background_images/623412/hunt-wumpus-bg.png',
   u'profile_background_image_url_https': u'https://pbs.twimg.com/profile_background_images/623412/hunt-wumpus-bg.png',
   u'profile_background_tile': True,
   u'profile_banner_url': u'https://pbs.twimg.com/profile_banners/5637652/1398207303',
   u'profile_image_url': u'http://pbs.twimg.com/profile_images/632821853627678720/zPKK7jql_normal.png',
   u'profile_image_url_https': u'https://pbs.twimg.com/profile_images/632821853627678720/zPKK7jql_normal.png',
   u'profile_link_color': u'282D58',
   u'profile_sidebar_border_color': u'E0E1F5',
   u'profile_sidebar_fill_color': u'E0E1F5',
   u'profile_text_color': u'383A48',
   u'profile_use_background_image': True,
   u'protected': False,
   u'screen_name': u'codinghorror',
   u'statuses_count': 55222,
   u'time_zone': u'Arizona',
   u'translator_type': u'none',
   u'url': u'http://t.co/rM9N1bQpLr',
   u'utc_offset': -25200,
   u'verified': True}},
 {u'contributors': None,
  u'coordinates': None,
  u'created_at': u'Sun May 07 22:27:02 +0000 2017',
  u'entities': {u'hashtags': [],
   u'symbols': [],
   u'urls': [],
   u'user_mentions': [{u'id': 23618940,
     u'id_str': u'23618940',
     u'indices': [3, 8],
     u'name': u'Jameson Lopp',
     u'screen_name': u'lopp'}]},
  u'favorite_count': 0,
  u'favorited': False,
  u'geo': None,
  u'id': 861346664052871168,
  u'id_str': u'861346664052871168',
  u'in_reply_to_screen_name': None,
  u'in_reply_to_status_id': None,
  u'in_reply_to_status_id_str': None,
  u'in_reply_to_user_id': None,
  u'in_reply_to_user_id_str': None,
  u'is_quote_status': False,
  u'lang': u'en',
  u'place': None,
  u'retweet_count': 28,
  u'retweeted': False,
  u'retweeted_status': {u'contributors': None,
   u'coordinates': None,
   u'created_at': u'Sun May 07 22:20:33 +0000 2017',
   u'entities': {u'hashtags': [],
    u'symbols': [],
    u'urls': [],
    u'user_mentions': []},
   u'favorite_count': 115,
   u'favorited': False,
   u'geo': None,
   u'id': 861345033949249536,
   u'id_str': u'861345033949249536',
   u'in_reply_to_screen_name': None,
   u'in_reply_to_status_id': None,
   u'in_reply_to_status_id_str': None,
   u'in_reply_to_user_id': None,
   u'in_reply_to_user_id_str': None,
   u'is_quote_status': False,
   u'lang': u'en',
   u'place': None,
   u'retweet_count': 28,
   u'retweeted': False,
   u'source': u'<a href="http://twitter.com" rel="nofollow">Twitter Web Client</a>',
   u'text': u'Folks who use Bitcoin to protect their financial sovereignty will probably fight harder for that use case than those using it for retail txs',
   u'truncated': False,
   u'user': {u'contributors_enabled': False,
    u'created_at': u'Tue Mar 10 17:22:20 +0000 2009',
    u'default_profile': False,
    u'default_profile_image': False,
    u'description': u'@BitGo engineer \xb7 creator of https://t.co/kNWkH1owwD \xb7 CoinDesk contributor https://t.co/G2bmA40KCE \xb7 find me at https://t.co/aG7hagxjwA',
    u'entities': {u'description': {u'urls': [{u'display_url': u'statoshi.info',
        u'expanded_url': u'https://statoshi.info',
        u'indices': [29, 52],
        u'url': u'https://t.co/kNWkH1owwD'},
       {u'display_url': u'coindesk.com/author/jameson\u2026',
        u'expanded_url': u'http://www.coindesk.com/author/jameson-lopp/',
        u'indices': [76, 99],
        u'url': u'https://t.co/G2bmA40KCE'},
       {u'display_url': u'onename.com/lopp',
        u'expanded_url': u'https://onename.com/lopp',
        u'indices': [113, 136],
        u'url': u'https://t.co/aG7hagxjwA'}]},
     u'url': {u'urls': [{u'display_url': u'lopp.net',
        u'expanded_url': u'http://lopp.net',
        u'indices': [0, 22],
        u'url': u'http://t.co/2r9R7bZEEb'}]}},
    u'favourites_count': 5368,
    u'follow_request_sent': False,
    u'followers_count': 8428,
    u'following': False,
    u'friends_count': 213,
    u'geo_enabled': True,
    u'has_extended_profile': True,
    u'id': 23618940,
    u'id_str': u'23618940',
    u'is_translation_enabled': False,
    u'is_translator': False,
    u'lang': u'en',
    u'listed_count': 391,
    u'location': u'Durham, NC',
    u'name': u'Jameson Lopp',
    u'notifications': False,
    u'profile_background_color': u'022330',
    u'profile_background_image_url': u'http://pbs.twimg.com/profile_background_images/446076629144453121/db1MrvR4.jpeg',
    u'profile_background_image_url_https': u'https://pbs.twimg.com/profile_background_images/446076629144453121/db1MrvR4.jpeg',
    u'profile_background_tile': False,
    u'profile_banner_url': u'https://pbs.twimg.com/profile_banners/23618940/1433197606',
    u'profile_image_url': u'http://pbs.twimg.com/profile_images/815585528108163073/6zf5bzAJ_normal.jpg',
    u'profile_image_url_https': u'https://pbs.twimg.com/profile_images/815585528108163073/6zf5bzAJ_normal.jpg',
    u'profile_link_color': u'0084B4',
    u'profile_sidebar_border_color': u'FFFFFF',
    u'profile_sidebar_fill_color': u'C0DFEC',
    u'profile_text_color': u'333333',
    u'profile_use_background_image': True,
    u'protected': False,
    u'screen_name': u'lopp',
    u'statuses_count': 15729,
    u'time_zone': u'Eastern Time (US & Canada)',
    u'translator_type': u'none',
    u'url': u'http://t.co/2r9R7bZEEb',
    u'utc_offset': -14400,
    u'verified': False}},
  u'source': u'<a href="http://twitter.com/#!/download/ipad" rel="nofollow">Twitter for iPad</a>',
  u'text': u'RT @lopp: Folks who use Bitcoin to protect their financial sovereignty will probably fight harder for that use case than those using it for\u2026',
  u'truncated': False,
  u'user': {u'contributors_enabled': False,
   u'created_at': u'Thu Feb 01 23:05:04 +0000 2007',
   u'default_profile': False,
   u'default_profile_image': False,
   u'description': u'Present',
   u'entities': {u'description': {u'urls': []},
    u'url': {u'urls': [{u'display_url': u'farnamstreetblog.com/2017/02/naval-\u2026',
       u'expanded_url': u'https://www.farnamstreetblog.com/2017/02/naval-ravikant-reading-decision-making/',
       u'indices': [0, 23],
       u'url': u'https://t.co/VPBBapmlY4'}]}},
   u'favourites_count': 34976,
   u'follow_request_sent': False,
   u'followers_count': 214919,
   u'following': True,
   u'friends_count': 431,
   u'geo_enabled': True,
   u'has_extended_profile': False,
   u'id': 745273,
   u'id_str': u'745273',
   u'is_translation_enabled': False,
   u'is_translator': False,
   u'lang': u'en',
   u'listed_count': 4825,
   u'location': u'San Francisco, CA',
   u'name': u'Naval Ravikant',
   u'notifications': False,
   u'profile_background_color': u'352726',
   u'profile_background_image_url': u'http://abs.twimg.com/images/themes/theme5/bg.gif',
   u'profile_background_image_url_https': u'https://abs.twimg.com/images/themes/theme5/bg.gif',
   u'profile_background_tile': False,
   u'profile_banner_url': u'https://pbs.twimg.com/profile_banners/745273/1355705777',
   u'profile_image_url': u'http://pbs.twimg.com/profile_images/749155852683055104/0StT9uYS_normal.jpg',
   u'profile_image_url_https': u'https://pbs.twimg.com/profile_images/749155852683055104/0StT9uYS_normal.jpg',
   u'profile_link_color': u'D02B55',
   u'profile_sidebar_border_color': u'829D5E',
   u'profile_sidebar_fill_color': u'99CC33',
   u'profile_text_color': u'3E4415',
   u'profile_use_background_image': True,
   u'protected': False,
   u'screen_name': u'naval',
   u'statuses_count': 14218,
   u'time_zone': u'Pacific Time (US & Canada)',
   u'translator_type': u'none',
   u'url': u'https://t.co/VPBBapmlY4',
   u'utc_offset': -25200,
   u'verified': False}},
 {u'contributors': None,
  u'coordinates': None,
  u'created_at': u'Sun May 07 22:26:11 +0000 2017',
  u'entities': {u'hashtags': [],
   u'symbols': [],
   u'urls': [],
   u'user_mentions': [{u'id': 3372383674,
     u'id_str': u'3372383674',
     u'indices': [3, 14],
     u'name': u'illacertus',
     u'screen_name': u'illacertus'}]},
  u'favorite_count': 0,
  u'favorited': False,
  u'geo': None,
  u'id': 861346449157754880,
  u'id_str': u'861346449157754880',
  u'in_reply_to_screen_name': None,
  u'in_reply_to_status_id': None,
  u'in_reply_to_status_id_str': None,
  u'in_reply_to_user_id': None,
  u'in_reply_to_user_id_str': None,
  u'is_quote_status': False,
  u'lang': u'en',
  u'place': None,
  u'retweet_count': 17,
  u'retweeted': False,
  u'retweeted_status': {u'contributors': None,
   u'coordinates': None,
   u'created_at': u'Sun May 07 21:30:31 +0000 2017',
   u'entities': {u'hashtags': [],
    u'symbols': [],
    u'urls': [],
    u'user_mentions': []},
   u'favorite_count': 21,
   u'favorited': False,
   u'geo': None,
   u'id': 861332441503498240,
   u'id_str': u'861332441503498240',
   u'in_reply_to_screen_name': None,
   u'in_reply_to_status_id': None,
   u'in_reply_to_status_id_str': None,
   u'in_reply_to_user_id': None,
   u'in_reply_to_user_id_str': None,
   u'is_quote_status': False,
   u'lang': u'en',
   u'place': None,
   u'retweet_count': 17,
   u'retweeted': False,
   u'source': u'<a href="http://twitter.com" rel="nofollow">Twitter Web Client</a>',
   u'text': u'The necktie \u2015 not only am I a slave, I also willingly choke myself for my masters tightening it whenever it loosens up a bit.',
   u'truncated': False,
   u'user': {u'contributors_enabled': False,
    u'created_at': u'Sun Jul 12 14:08:09 +0000 2015',
    u'default_profile': False,
    u'default_profile_image': False,
    u'description': u'Power & History at https://t.co/LVTG9PIjVu',
    u'entities': {u'description': {u'urls': [{u'display_url': u'bit.ly/illacertus',
        u'expanded_url': u'http://bit.ly/illacertus',
        u'indices': [19, 42],
        u'url': u'https://t.co/LVTG9PIjVu'}]},
     u'url': {u'urls': [{u'display_url': u'youtube.com/c/Illacertus',
        u'expanded_url': u'http://www.youtube.com/c/Illacertus',
        u'indices': [0, 23],
        u'url': u'https://t.co/K6qdJslQie'}]}},
    u'favourites_count': 2999,
    u'follow_request_sent': False,
    u'followers_count': 4575,
    u'following': False,
    u'friends_count': 50,
    u'geo_enabled': False,
    u'has_extended_profile': True,
    u'id': 3372383674,
    u'id_str': u'3372383674',
    u'is_translation_enabled': False,
    u'is_translator': False,
    u'lang': u'en',
    u'listed_count': 65,
    u'location': u'',
    u'name': u'illacertus',
    u'notifications': False,
    u'profile_background_color': u'000000',
    u'profile_background_image_url': u'http://abs.twimg.com/images/themes/theme1/bg.png',
    u'profile_background_image_url_https': u'https://abs.twimg.com/images/themes/theme1/bg.png',
    u'profile_background_tile': False,
    u'profile_banner_url': u'https://pbs.twimg.com/profile_banners/3372383674/1492745020',
    u'profile_image_url': u'http://pbs.twimg.com/profile_images/855260868782809089/vHX3qvBU_normal.jpg',
    u'profile_image_url_https': u'https://pbs.twimg.com/profile_images/855260868782809089/vHX3qvBU_normal.jpg',
    u'profile_link_color': u'000055',
    u'profile_sidebar_border_color': u'000000',
    u'profile_sidebar_fill_color': u'000000',
    u'profile_text_color': u'000000',
    u'profile_use_background_image': False,
    u'protected': False,
    u'screen_name': u'illacertus',
    u'statuses_count': 1840,
    u'time_zone': u'Pacific Time (US & Canada)',
    u'translator_type': u'regular',
    u'url': u'https://t.co/K6qdJslQie',
    u'utc_offset': -25200,
    u'verified': False}},
  u'source': u'<a href="http://twitter.com/#!/download/ipad" rel="nofollow">Twitter for iPad</a>',
  u'text': u'RT @illacertus: The necktie \u2015 not only am I a slave, I also willingly choke myself for my masters tightening it whenever it loosens up a bi\u2026',
  u'truncated': False,
  u'user': {u'contributors_enabled': False,
   u'created_at': u'Thu Feb 01 23:05:04 +0000 2007',
   u'default_profile': False,
   u'default_profile_image': False,
   u'description': u'Present',
   u'entities': {u'description': {u'urls': []},
    u'url': {u'urls': [{u'display_url': u'farnamstreetblog.com/2017/02/naval-\u2026',
       u'expanded_url': u'https://www.farnamstreetblog.com/2017/02/naval-ravikant-reading-decision-making/',
       u'indices': [0, 23],
       u'url': u'https://t.co/VPBBapmlY4'}]}},
   u'favourites_count': 34976,
   u'follow_request_sent': False,
   u'followers_count': 214919,
   u'following': True,
   u'friends_count': 431,
   u'geo_enabled': True,
   u'has_extended_profile': False,
   u'id': 745273,
   u'id_str': u'745273',
   u'is_translation_enabled': False,
   u'is_translator': False,
   u'lang': u'en',
   u'listed_count': 4825,
   u'location': u'San Francisco, CA',
   u'name': u'Naval Ravikant',
   u'notifications': False,
   u'profile_background_color': u'352726',
   u'profile_background_image_url': u'http://abs.twimg.com/images/themes/theme5/bg.gif',
   u'profile_background_image_url_https': u'https://abs.twimg.com/images/themes/theme5/bg.gif',
   u'profile_background_tile': False,
   u'profile_banner_url': u'https://pbs.twimg.com/profile_banners/745273/1355705777',
   u'profile_image_url': u'http://pbs.twimg.com/profile_images/749155852683055104/0StT9uYS_normal.jpg',
   u'profile_image_url_https': u'https://pbs.twimg.com/profile_images/749155852683055104/0StT9uYS_normal.jpg',
   u'profile_link_color': u'D02B55',
   u'profile_sidebar_border_color': u'829D5E',
   u'profile_sidebar_fill_color': u'99CC33',
   u'profile_text_color': u'3E4415',
   u'profile_use_background_image': True,
   u'protected': False,
   u'screen_name': u'naval',
   u'statuses_count': 14218,
   u'time_zone': u'Pacific Time (US & Canada)',
   u'translator_type': u'none',
   u'url': u'https://t.co/VPBBapmlY4',
   u'utc_offset': -25200,
   u'verified': False}}]

In [8]:
print type(content)
print type(content[1])


<type 'list'>
<type 'dict'>

In [7]:
import json
with open('datadump_alex_home.txt', 'a') as fout:
    for tweet in content:
        fout.write(json.dumps(tweet))

In [9]:
from twitter import Twitter, OAuth, TwitterHTTPError, TwitterStream
# del twitter
import time
import json

In [32]:
# def rate_lim():
oauth = OAuth(token_key, token_secret, consumer_key, consumer_secret)
twitter = Twitter(auth=oauth)
iterator = twitter.search.tweets(q=':)', result_type='recent', lang='en', count=100)
#     with open("out.txt", "w"):
#         fo.write(json.dumps(iterator))
# print(iterator)

In [27]:
print iterator['statuses'][1]
print type(iterator)


{u'contributors': None, u'truncated': False, u'text': u'@AmandasInk Thank you! :)', u'is_quote_status': False, u'in_reply_to_status_id': 861392525017456641, u'id': 861392601752186884, u'favorite_count': 0, u'entities': {u'symbols': [], u'user_mentions': [{u'id': 59335459, u'indices': [0, 11], u'id_str': u'59335459', u'screen_name': u'AmandasInk', u'name': u'Amanda Wagoner'}], u'hashtags': [], u'urls': []}, u'retweeted': False, u'coordinates': None, u'source': u'<a href="http://twitter.com/#!/download/ipad" rel="nofollow">Twitter for iPad</a>', u'in_reply_to_screen_name': u'AmandasInk', u'in_reply_to_user_id': 59335459, u'retweet_count': 0, u'id_str': u'861392601752186884', u'favorited': False, u'user': {u'follow_request_sent': False, u'has_extended_profile': False, u'profile_use_background_image': True, u'default_profile_image': False, u'id': 715001611, u'profile_background_image_url_https': u'https://abs.twimg.com/images/themes/theme1/bg.png', u'verified': False, u'translator_type': u'none', u'profile_text_color': u'333333', u'profile_image_url_https': u'https://pbs.twimg.com/profile_images/763825710234468352/3eKhtXZB_normal.jpg', u'profile_sidebar_fill_color': u'DDEEF6', u'entities': {u'url': {u'urls': [{u'url': u'https://t.co/rpvIeygM1q', u'indices': [0, 23], u'expanded_url': u'https://www.linkedin.com/in/steffaniemelindabrown', u'display_url': u'linkedin.com/in/steffanieme\u2026'}]}, u'description': {u'urls': []}}, u'followers_count': 1488, u'profile_sidebar_border_color': u'C0DEED', u'id_str': u'715001611', u'profile_background_color': u'C0DEED', u'listed_count': 101, u'is_translation_enabled': False, u'utc_offset': -10800, u'statuses_count': 22957, u'description': u'Fundraising research & consulting. Advisory bd, @ProRInstitute. Slow runner, ocean girl, loving life...', u'friends_count': 1384, u'location': u'Merritt Island, Florida, USA', u'profile_link_color': u'1DA1F2', u'profile_image_url': u'http://pbs.twimg.com/profile_images/763825710234468352/3eKhtXZB_normal.jpg', u'following': False, u'geo_enabled': False, u'profile_background_image_url': u'http://abs.twimg.com/images/themes/theme1/bg.png', u'screen_name': u'SteffanieMBrown', u'lang': u'en', u'profile_background_tile': False, u'favourites_count': 43320, u'name': u'Steffanie M. Brown', u'notifications': False, u'url': u'https://t.co/rpvIeygM1q', u'created_at': u'Tue Jul 24 22:03:51 +0000 2012', u'contributors_enabled': False, u'time_zone': u'Atlantic Time (Canada)', u'protected': False, u'default_profile': True, u'is_translator': False}, u'geo': None, u'in_reply_to_user_id_str': u'59335459', u'lang': u'en', u'created_at': u'Mon May 08 01:29:34 +0000 2017', u'in_reply_to_status_id_str': u'861392525017456641', u'place': None, u'metadata': {u'iso_language_code': u'en', u'result_type': u'recent'}}
<class 'twitter.api.TwitterDictResponse'>

In [33]:
with open('datadump_oauth:).txt', 'a') as fout:
    for tweet in iterator['statuses']:
        fout.write(json.dumps(tweet))

In [ ]:
# import datetime
import time
# import sys
# import traceback
# from random import random

# def wait_secs(n_seconds):
#     print datetime.datetime.now(), 'sleeping'
#     time.sleep(n_seconds)
#     print datetime.datetime.now(), 'awake'

    


while 1:
    iterator = twitter.search.tweets(q=':)', result_type='recent', lang='en', count=100)
    with open('datadump_oauth:).txt', 'a') as fout:
        for tweet in iterator['statuses']:
            fout.write(json.dumps(tweet))
    time.sleep(120)

    iterator = twitter.search.tweets(q=':(', result_type='recent', lang='en', count=100)
    with open('datadump_oauth:(.txt', 'a') as fout:
        for tweet in iterator['statuses']:
            fout.write(json.dumps(tweet))
    time.sleep(120)

In [44]:
with open('datadump_oauth:(.txt', 'a') as fout:
    for tweet in iterator['statuses']:
        fout.write(json.dumps(tweet))

In [43]:
len(iterator['statuses'])


Out[43]:
100

In [37]:
# import requests

# response = requests.get("https://api.twitter.com/1.1/application/rate_limit_status.json?resources=help,users,search,statuses")
# response

In [31]:
# twitter_stream = TwitterStream(auth=oauth)
# iterator = twitter_stream.statuses.filter(track="#bostonmarathon,#bostonmarathon2017,",language="en")
# tweet_count = 5
# for tweet in iterator:
#     tweet_count -= 1
#     # Twitter Python Tool wraps the data returned by Twitter 
#     # as a TwitterDictResponse object.
#     # We convert it back to the JSON format to print/score
#     print(tweet_count)
#     print("\n\n\n")
#     print(json.dumps(tweet))
#     # The command below will do pretty printing for JSON data, try it out
#     # print json.dumps(tweet, indent=4) 
#     if tweet_count <= 0:
#         break

In [29]:
def streamer():
    
    
    
    twitter_stream = TwitterStream(auth=oauth)
    
    iterator = twitter_stream.statuses.filter(track=":)",language="en")

    fo = open("my.txt", "ab")
  
    tweet_count = 100
    
    for tweet in iterator:
        tweet_count -= 1
        # Twitter Python Tool wraps the data returned by Twitter 
        # as a TwitterDictResponse object.
        # We convert it back to the JSON format to print/score
        fo.write(json.dumps(tweet)) 
        fo.write(",")
        print tweet_count
        # The command below will do pretty printing for JSON data, try it out
        # print json.dumps(tweet, indent=4) 
        if tweet_count <= 0:
            break     
        
    # Close opend file
    fo.close()

In [30]:
streamer()


99
98
97
96
95
94
93
92
91
90
89
88
87
86
85
84
83
82
81
80
79
78
77
76
75
74
73
72
71
70
69
68
67
66
65
64
63
62
61
60
59
58
57
56
55
54
53
52
51
50
49
48
47
46
45
44
43
42
41
40
39
38
37
36
35
34
33
32
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0

In [ ]:


In [ ]: