Last active
October 2, 2018 13:52
-
-
Save rahulbot/e1e49a978f75f694b1c22130ac2c76c5 to your computer and use it in GitHub Desktop.
Querying Media Cloud for a list of all the matching stories
This file contains 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
all_stories = [] | |
florida_collection_id = 38379430 | |
stories_per_page = 50 | |
last_id = 0 | |
more_stories = True | |
while more_stories: | |
story_page = mc.storyList('(puppy OR puppies) AND tags_id_media:{}'.format(florida_collection_id), | |
'publish_date:[NOW-30DAY TO NOW]', last_processed_stories_id=last_id, | |
rows=stories_per_page) | |
if len(story_page ) is 0: | |
break | |
last_id = story_page[-1]['processed_stories_id'] | |
all_stories += story_page | |
print(len(all_stories)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment