Created
August 31, 2015 01:30
-
-
Save nbortolotti/5fcd0ef557b92b8c08cb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| try: | |
| writer = csv.writer(myfile) | |
| writer.writerow(('id', 'content', 'test', 'replies', 'plusoners', 'resharers')) | |
| # Information from activities | |
| count = 0 | |
| while (count < postnumers): | |
| activities_document = request.execute() | |
| if 'items' in activities_document: | |
| for activity in activities_document['items']: | |
| id =activity['id'] | |
| content = activity['object']['content'].encode("utf-8") | |
| test = any(x in content.split() for x in tech) | |
| replies =activity['object']['replies']['totalItems'] | |
| plusoners =activity['object']['plusoners']['totalItems'] | |
| resharers = activity['object']['resharers']['totalItems'] | |
| writer.writerow((id, content, test ,replies, plusoners, resharers)) | |
| count = count + 1 | |
| request = service.activities().list_next(request, activities_document) | |
| finally: | |
| myfile.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment