Created
May 14, 2015 20:34
-
-
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
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
#!/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