Skip to content

Instantly share code, notes, and snippets.

@glortho
Created May 14, 2015 20:34
Show Gist options
  • Save glortho/717bc5b833395fc46fef to your computer and use it in GitHub Desktop.
Save glortho/717bc5b833395fc46fef to your computer and use it in GitHub Desktop.
Filter out retweets - because if it's not authentic, it's not for you
#!/bin/sh
"exec" "twxec" "-e" "filter_out_retweets" "$0" "$@"
{{docstring "Filter out retweets - because if it's not authentic, it's not for you"}}
def filter_out_retweets(msg):
# Look for both source style as well as transform style
# Timbr.io style:
if "is_retweet" in msg and msg["is_retweet"]:
return None
# Twitter style:
elif "retweeted_status" in msg:
return None
# Gnip style:
elif "retweetCount" in msg and msg["retweetCount"] > 0:
return None
else:
return msg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment