Skip to content

Instantly share code, notes, and snippets.

@wybiral
Created February 23, 2019 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wybiral/456a15e0fa731273707d7d7f23dd7bac to your computer and use it in GitHub Desktop.
Save wybiral/456a15e0fa731273707d7d7f23dd7bac to your computer and use it in GitHub Desktop.
import json
import sys
for line in sys.stdin:
# remove newline
line = line.rstrip()
# parse JSON
item = json.loads(line)
# get title
title = item.get('title', '')
# get body
body = item.get('body', '')
# filter for russia
if 'russia' in (title + body).lower():
print(line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment