I have a feed from my Twitter profile on the top of my site but I wondered if there is a way to filter out my @replies and only show my status updates?
Thanks
Filter through mobile: Swipe to reveal the menu panel on the left > Select “Settings and privacy” > Content preferences > Muted > Muted words > Select “Add” to add any words or phrases that you do not want to see on Twitter > Select a timeline for how long you want this content muted.
To set filters on twitter.com: Go to your Notifications timeline. To filter your notifications, click on Settings. Click on Advanced filters. Check the box of your preferred filter(s) to turn on.
Filter Notifications If you're receiving unwanted replies or mentions from accounts you do not follow, you can filter the types of notifications you receive. Read instructions for adjusting your Notifications timeline.
Maybe with Yahoo Pipes.
Tomalak has made a quick example for you.
If you're using the standard Twitter feed web code for Blogger and similar sites, this bit of Javascript does the trick. It sits between the Twitter feed and the callback and strips replies out of the server response.
For a blog badge, the standard Twitter web code ends with two <script>
tags. The first provides the function that displays your tweets. The second queries twitter for the tweets to display.
Add this script to your badge code before the twitter query. It provides a new function called filterCallback which strips @replies from the Twitter response.
<script type="text/javascript">
function filterCallback( twitter_json ) {
var result = [];
for(var index in twitter_json) {
if(twitter_json[index].in_reply_to_user_id == null) {
result[result.length] = twitter_json[index];
}
if( result.length==5 ) break; // Edit this to change the maximum tweets shown
}
twitterCallback2(result); // Pass tweets onto the original callback. Don't change it!
}
</script>
The twitter query itself has a parameter which specifies what function to call when the response comes back. In blogger's case, that function is called 'twitterCallback2' - you can search for it in the web code (look for callback=twitterCallback2
). To use the new filter you need to replace the text twittercallback2
with filterCallback
. The filter is hard coded to then call twitterCallback2
when it's done.
Note that as this will reduce the number of displayed tweets if some of the repsonses from Twitter are replies, so you have to increase the count parameter in the call to allow for that. The new function then limits the number of displayed replies to five - edit the code to change that.
Here's my blog post about it: Filter Replies out of Twitter Feed
If you want to use the new Twitter widgets, just add this piece of code within the features:
setting of the widget's source code:
filters: {
negatives: /\B@\w{1,20}(\s+|$)/
},
I took this one from Dustin Diaz's website at http://www.dustindiaz.com. Dustin Diaz is the creator of the Twitter widget.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With