Coder Social home page Coder Social logo

adaptive-panel-collection's Introduction

Twitter panel data collection

A tool for fetching twitter profile, follower and friend info for SoMA

currently requires a redis database to write it's intermediate results too

TODO: turn this into a process that requires less manual intervention so that panelist data can be continuously updated

Installation

virtualenv env
. env/bin/activate
pip install -r requirements.txt

# install redis
apt-get install redis-server
# or
brew install redis

Setup

It needs a config.ini file (look at config.ini.example) to give it a twitter api account and to tell it which redis server/database to connect to

[twitter]
consumer_key = client key value
consumer_secret = client secret value
access_token = token
access_token_secret = token secret

[redis]
host = localhost
port = 6379
db = 0

Running

collect.py will take a newline separated list of twitter names and collect profile, followers and friend ids, it will take a while unless you have a less rate limited twitter account

python collect.py list-of-twitter-names.txt

Outputing results

output.py will write out lines of json represening the panelist info for SoMA and also write out a list of twitter names where it couldn't collect some of the data it needs a mapping of twitter screen names to yougov panelist ids (a previous panel_default.json will suffice or a csv of [screen_name, id] rows)

python output.py panel.json mapping_for_yougov_id.[csv,json] missing-names.txt

This uses the panoptic proxy provided by beta.pulse.yougov.com, access to the us panoptic is trickier at the moment.

open an ssh connection to the alab-pulse1 machine and set up a socks proxy to port 8050

# connect to yougov vpn and then set up this proxy
ssh -ND 8050 username@alab-pulse1
# in another terminal
python us_output.py us_panel.json mapping_for_yougov_id.csv missing-us-names.txt

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.