Code Monkey home page Code Monkey logo

followerfactory's Introduction

FollowerFactory

Create the scatterplots used in NYTimes' Follower Factory.

Getting Started

Install dependencies.

pip install TwitterAPI

Edit ff.py for your account. Go to https://apps.twitter.com/ to get your API keys. Don't forget to fill in your screen name (or someone else's).

CONSUMER_KEY = ''
CONSUMER_SECRET = ''
ACCESS_TOKEN = ''
ACCESS_TOKEN_SECRET = ''

SCREEN_NAME = 'eiaine'

Run!

python ff.py

This can take a long time due to Twitter's rate-limiting, so expect to wait about an hour for every 12,000 followers. When the script is complete, view the results by opening index.html in your web browser. Your plot will look something like this:

Troubleshooting

If the chart fails to load, you may be getting an error along the lines of Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. To fix this, either open index.html in firefox, or start chrome with --allow-file-access-from-files, or try some of the other suggestions listed here.

followerfactory's People

Contributors

dominikus avatar elaineo avatar lseemann avatar twirrim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

followerfactory's Issues

TwitterAPI timeout

I keep getting a β€œRead timed out,” always around the same spot (count 6400).

INFO:root:count: 6400
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): api.twitter.com
WARNING:root:<class 'requests.exceptions.ReadTimeout'> HTTPSConnectionPool(host='api.twitter.com', port=443): Read timed out. (read timeout=5)
Traceback (most recent call last):
  File "ff.py", line 43, in <module>
    main()
  File "ff.py", line 28, in main
    fans_raw = bot.request('followers/list', {'screen_name': SCREEN_NAME, 'count': 200, 'cursor':cursor, 'skip_status':True, 'include_user_entities': False})
  File "/Library/Python/2.7/site-packages/TwitterAPI/TwitterAPI.py", line 134, in request
    raise TwitterConnectionError(e)
TwitterAPI.TwitterError.TwitterConnectionError: HTTPSConnectionPool(host='api.twitter.com', port=443): Read timed out. (read timeout=5)

formatting of graph inaccurate

Thanks for this @elaineo but when I view the index.html, I only see the points in a straight line. I'm trying to learn but I hoped you could help me locate the bug. It is in index.html (data.csv is fine):

screen shot 2018-01-31 at 11 39 57 am

Increase speed

it's possible increase speed with more api's? pull api's?

Gracias.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.