Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 17 lines (13 sloc) 347 Bytes
#!/usr/bin/env python
"""
Given a JSON file, remove any retweets.
Example usage:
utils/noretweets.py tweets.jsonl > tweets_noretweets.jsonl
"""
from __future__ import print_function
import json
import fileinput
for line in fileinput.input():
tweet = json.loads(line)
if not 'retweeted_status' in tweet:
print(json.dumps(tweet))