CODE:
#!/usr/bin/python #-*-Coding:utf-8-*-' Created on 2014-7-30 @author: guaguastd @name: Friends_fol
lowers_analyzer.py ' ' if __name__ = = ' __main__ ': # import JSON #import JSON # import Search from search import search_for_tweet # import Get_friends_followers_ids fro M user Import Get_friends_followers_ids, setwise_friends_followers_analysis # import login, HTTP://BL og.csdn.net/guaguastd/article/details/31706155 from login Import Twitter_login # get the Twitter access
API Twitter_api = Twitter_login () # import Twitter_text Import Twitter_text
While 1:query = Raw_input ("\ninput" query (eg. #MentionSomeoneImportantForYou, exit to quit): ')
if query = = ' exit ': print ' successfully exit! ' Break statuses = Search_for_tweet (tWITTER_API, query) ex = Twitter_text.
Extractor (statuses) Screen_names = Ex.extract_mentioned_screen_names_with_indices ()
Screen_names = [screen_name[' Screen_name '] for screen_name in Screen_names] For Screen_name in Screen_names: #print json.dumps (Screen_names, Indent=1) fr
Iends_ids, Followers_ids = Get_friends_followers_ids (Twitter_api, Screen_name=screen_name, Friends_limit=1 0, followers_limit=10) setwise_friends_ Followers_analysis (Screen_name, Friends_ids, Followers_ids)
Back to the column page: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/extra/
Result:
Input the query (eg. #MentionSomeoneImportantForYou, exit to quit): #MentionSomeoneImportantForYou Length of statuses 3 0 encountered 401 error (not Authorized) fetched 0 total friends IDs for Mcnasty_super encountered error (not Au thorized) fetched 0 total followers IDs for Mcnasty_super Mcnasty_super are following 0 Mcnasty_super is being follow Ed by 0 0 of 0 are not following Mcnasty_super back 0 of 0 are not being followed back by Mcnasty_super Mcnasty_supe R has 0 mutual friends fetched 5000 total friends IDs for Justina25ita fetched 5000 total followers IDs for justina25i Ta Justina25ita is following a justina25ita is being followed from 6 are not following Justina25ita back 6 are not being followed back by Justina25ita Justina25ita has 4 mutual friends Badstatusline encountered.
Continuing. Fetched 5000 total friends IDs for Carolribtorres fetched 5000 total followers IDs for Carolribtorres carolribtorres I S following 10
Carolribtorres is being followed a 1 are not following carolribtorres back 1 to are not being followed B Ack by Carolribtorres Carolribtorres has 9 mutual friends fetched 5000 total friends IDs for Carolribtorres fetched 5000 total followers IDs to Carolribtorres Carolribtorres is following ten carolribtorres is being followed by 10 1 Following carolribtorres back 1 of are not being followed are by Carolribtorres Carolribtorres has 9 Mutual friends fetched 5000 total friends IDs to Justinbieber Justinbieber is following a justinbieber is being F Ollowed by the are not following justinbieber the back of the are not being followed the back by Justinbieber Just Inbieber has 0 mutual friends fetched 5000 total followers IDs for Justinbieber fetched 2818 total friends IDs for Oskians fetched 5000 total followers IDs to Janoskians Janoskians is following Janoskians are being followed by 1 0 are not folLowing Janoskians are not being followed back by Janoskians Janoskians has 0 mutual friends fetched 50 Total friends IDs for 5SOS fetched 5000 total followers IDs to 5SOS 5SOS is following a 5SOS is being followed
Not following 5SOS (are) are being followed back by 5SOS 5SOS has 0 mutual friends Fetched friends IDs for shots fetched 5000 total followers IDs to shots shots is following a shots is Bei are followed by the following shots back to are not being followed back by shots shots has 0 mu Tual Friends fetched 5000 total friends IDs for Carolribtorres fetched 5000 total followers IDs for Carolribtorres C Arolribtorres is following carolribtorres is being followed from 1 are not following carolribtorres back 1 are not being followed back by Carolribtorres Carolribtorres has 9 mutual friends fetched 5000 total friends ID S for Justinbieber FetChed 5000 total followers IDs to Justinbieber Justinbieber is following ten justinbieber is being followed by 10 10 are not following justinbieber "are not being followed back by Justinbieber Justinbieber has 0 Mutu Al Friends fetched 2818 total friends IDs for Janoskians fetched 5000 total followers IDs for Janoskians Janoskians Is following a Janoskians is being followed a are not following Janoskians back to are not being Followed back by Janoskians Janoskians has 0 mutual