Code to crawl followers and friends of a list of users
-
Obtain API keys
- Register at (http://dev.twitter.com)
- Go to (http://dev.twitter.com/apps), click on create a new application
- Enter a unique name, description, website and click on create your Twitter Application
- You'll be redirected to the application page, else go to the page. Click on settings section
- In the Application Type, change the access for Read only to Read and Write, and click on "Update this twiter application's settings"
- Go to the details section. In Your Access Token, click on Create my Access Token. Might take a few minutes to generate an access token
- Copy the Consumer key and Consumer Key under the OAuth Settings and Access Token and Access Token Secret to the keys.ini file, to the C_KEY1, C_SECRET1, T_KEY1 and T_SECRET1 respectively
- Repeat the procedure for filling the details for the remaining variables in keys.ini
-
Go to the folder python-oauth2-master from terminal, run the command:
sudo python setup.py install -
(Only required if you don't have httplib module) Go to the folder httplib2-0.8 from terminal, run the command:
sudo python setup.py install -
For crawling through the proxy server, update the proxy settings in proxy.ini file
-
Run the command,
python crawl.pyfor non-proxy environment andpython crawl_through_proxy.pyfor proxy environment