api=newt.getTwitterAPI() tweeters={} tags={} print 'Looking for twitterers and tags within',distance,'km of',location tweeters,tags=newt.twSearchNear(tweeters,tags,num, location, term='', dist=float(distance)) for t in sorted(tags, key=tags.get, reverse=True): print t,tags[t] tw=[] tws={} for i in tweeters: tws[i]=tweeters[i]['count'] if tws[i]>=limit: tw.append(i) tw=newt.getTwitterUsersDetailsByScreenNames(api,tw) locfname=location.replace(',','_') if network: newt.gephiOutputFile(api,'local-'+locfname, tw) else: newt.outputHomepageURLs(api,'local-'+locfname,tw,locfname) newt.opmlFromCSV('local-'+locfname)
if typ=="followers": tw=newt.getTwitterFollowersDetailsByIDs(api,user,sampleSize) else: tw=newt.getTwitterFriendsDetailsByIDs(api,user,sampleSize) f=newt.openTimestampedFile(user+'/'+typ,'sample'+str(sampleSize)+'tweeps.txt') for tweep in tw: f.write(str(tweep)+'\n') f.close() report("List members:") for i in tw: report(tw[i].screen_name) ''' report("List members:") for i in tw: report(tw[i].screen_name) ''' #newt.gephiOutputFile(api,user+'/'+typ, tw,'outerfriends') newt.gephiOutputFile(api,user+'/'+typ, tw) if extra!=-1: newt.gephiOutputFile(api,user+'/'+typ, tw,'extrafriends') #newt.gephiOutputFile(api,user+'/'+typ, tw,'outerfollowers') ''' newt.gephiOutputFile(api,user, tw,'outerfriends') newt.gephiOutputFile(api,user, tw,'outerfollowers') newt.googleCSEDefinitionFile("XXX",user, tw) newt.googleCSEDefinitionFileWeighted("XXX",user, tw) '''
tags = {} print 'Looking for twitterers and tags within', distance, 'km of', location tweeters, tags = newt.twSearchNear(tweeters, tags, num, location, term='', dist=float(distance)) for t in sorted(tags, key=tags.get, reverse=True): print t, tags[t] tw = [] tws = {} for i in tweeters: tws[i] = tweeters[i]['count'] if tws[i] >= limit: tw.append(i) tw = newt.getTwitterUsersDetailsByScreenNames(api, tw) locfname = location.replace(',', '_') if network: newt.gephiOutputFile(api, 'local-' + locfname, tw) else: newt.outputHomepageURLs(api, 'local-' + locfname, tw, locfname) newt.opmlFromCSV('local-' + locfname)
limit = 1 tw = [] tws = {} for i in tweeters: tws[i] = tweeters[i]['count'] if tws[i] >= limit: tw.append(i) tw = newt.getTwitterUsersDetailsByScreenNames(api, tw) #newt.outputHomepageURLs(api,'hashtag-'+tag,tw,tag) #newt.opmlFromCSV('hashtag-'+tag) if network: newt.gephiOutputFile(api, 'hashtag-' + tag, tw) newt.gephiOutputFile(api, 'hashtag-' + tag, tw, 'outerfriends') newt.gephiOutputFile(api, 'hashtag-' + tag, tw, 'extrafriends') newt.gephiOutputFile(api, 'hashtag-' + tag, tw, 'outerfollowers') if followerView: typ = 'followers' sampleSize = 195 filterN = 3 twc = {} twDetails = {} for tweep in tw: user = tw[tweep].screen_name print "Getting followers of ", user if typ == "followers":
f=newt.openTimestampedFile(user+'/'+typ,'sample'+str(sampleSize)+'tweeps.txt') for tweep in tw: f.write(str(tweep)+'\n') f.close() report("List members:") for i in tw: report(tw[i].screen_name) ''' report("List members:") for i in tw: report(tw[i].screen_name) ''' #newt.gephiOutputFile(api,user+'/'+typ, tw,'outerfriends') newt.gephiOutputFile(api,user+'/'+typ, tw) if extra!=-1: newt.gephiOutputFile(api,user+'/'+typ, tw,'extrafriends') #newt.gephiOutputFile(api,user+'/'+typ, tw,'outerfollowers') ''' newt.gephiOutputFile(api,user, tw,'outerfriends') newt.gephiOutputFile(api,user, tw,'outerfollowers') newt.googleCSEDefinitionFile("XXX",user, tw) newt.googleCSEDefinitionFileWeighted("XXX",user, tw) ''' # upload_file(local_file,remote_dir,remote_file,email,password)