12

While searching twitter for rather generic terms, returned search results include bio-names and handles of users. How to filter those fields from search results?

For example: Searching latest tweets containing word 'Squawk' mostly returns usernames+handles containing the word 'Squawk' or mentioning/replying to such usernames+handles.

https://twitter.com/search?f=tweets&vertical=default&q=squawk&src=typd

3 Answers 3

7

Try this:

Squawk OR @8373736

“@8373736” is just a random user account that actually doesn’t exist. @i32w4iewrewi, @ffASD53245f, whatever.

I don’t know why, but so far, this somehow works.

I think this is a glitch so please note that this can be unavailable in the future.

2

Edit: The accepted answer seems to work, albeit for unclear reasons, and should be tried first. The workarounds below may be useful if the above solution stops working, as it seems to rely on undocumented features/bugs in Twitter's search engine.

I’m hitting this same problem and I don’t believe there’s a complete solution using Twitter search features. There are several incomplete workarounds you can try, though.

First, you can add negative search terms for any usernames that appear in the results, e.g. Squawk -LiveSquawk -IGSquawk etc. to ignore specific users containing Squawk in their handle. Note that you have to use the bare username without including the @ symbol to handle the most common issues. This means the method only works if you’re willing to exclude any results containing superstrings of the excluded users. For example, if there’s prolific/popular user @squawking that you wish to filter out, searching for squawk -squawking will exclude tweets containing squawking in normal English usage as well.

This first method obviously doesn’t work if the problem user’s name is exactly your query. In this case you can get a more complete solution by listing out the different contingencies you want to ignore. For example, the following query will find instances of the string kimkardashian that are not written by @KimKardashian, not replies to or mentions of @KimKardashian, and do not use the hashtag #KimKardashian: “kimkardashian” -from:kimkardashian -to:kimkardashian -@KimKardashian -#KimKardashian. (Of course, this causes your query to explode in length if multiple popular users are causing problems.)

In the worst case, if your search query is a very common substring of many usernames, I don’t believe there’s any solution. For example, searching for tweets whose tweet body contains the string Mike, but without including all tweets from the many, many users with “Mike” in their usernames, seems to be impossible without applying the filtering yourself externally.

-1

You need to add

exclude:mentions exclude:replies

keywords on your search string.

3
  • 1
    That doesn't do what was requested. Commented Jul 1, 2022 at 12:15
  • It does. It's the "official way" to do such thing. Commented Jul 24, 2022 at 2:38
  • What was requested was to exclude usernames and handles from being matched by keyword search, not to exclude mentions and replies from the search.
    – W Biggs
    Commented Mar 8, 2023 at 23:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.