Skip to content

Instantly share code, notes, and snippets.

@rahulbot
Last active October 2, 2018 13:52
Show Gist options
  • Save rahulbot/e1e49a978f75f694b1c22130ac2c76c5 to your computer and use it in GitHub Desktop.
Save rahulbot/e1e49a978f75f694b1c22130ac2c76c5 to your computer and use it in GitHub Desktop.
Querying Media Cloud for a list of all the matching stories
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