Advanced Search on Twitter
These operators work on Web, Mobile, Tweetdeck.
||Containing both "nasa" and "esa". Spaces are implicit AND. Brackets can be used to group individual words if using other operators.|
||Either "nasa" or "esa". OR must be in uppercase.|
||The complete phrase "state of the art". Will also match "state-of-the-art"|
||A cashtag, like hashtags but for stock symbols|
||Question marks are matched|
||Some emoticons are matched, positive
|Emoji searches are also matched. Usually needs another operator to work.|
||urls are tokenized and matched, works very well for subdomains and domains, not so well for long urls, depends on url. Youtube ids work well. Works for both shortened and canonical urls, eg: gu.com shortener for theguardian.com|
||Search for tweets in specified language, see list below.|
||Sent by a particular
||Replying to a particular
||Mentioning a particular
||From members of this public List e.g. list:NASA/astronauts. Use the list slug (url part after
||From verified users|
||Geotagged in this place. Also supports Phrases, eg: "The Hague"|
||Near where twitter thinks you are|
||Within specific radius of the "near" operator, to apply a limit. Can use km or mi. e.g.
||E.g., to get tweets 10km around twitters hq, use
||Search tweets by Place Object ID eg: USA Place ID is
||On or after a specified date|
||On or before a specified date. Combine with the "since" operator for dates between.|
||Snowflake ID based for exact time search (see Note below)|
||Works together with
||Only retweets created using the retweet button. Works well combined with
||Native retweets are excluded by default. This shows them. In contrast to
||Old style retweets ("RT") + quoted tweets.|
||Tweet is a reply to another Tweet. good for finding conversations, or threads if you add or remove
||Contain Quote Tweets|
||Tweets containing polls. For polls containing 2, 3, 4 choices, or image Polls.|
||A minimum number of Retweets. Counts seem to be approximate for larger (1000+) values.|
||A minimum number of Likes|
||A minimum number of replies|
||A maximum number of Retweets|
||A maximum number of Likes|
||A maximum number of replies|
||All media types.|
||Native Twitter images (pic.twitter.com links)|
||All video types, including native Twitter video and external sources such as Youtube.|
||All Twitter-owned video types (native video, vine, periscope)|
||Twitter native video only|
||Twitter pro video (Amplify) only|
||Only from accounts you follow|
||Only containing some URL, includes media. use -filter:media for urls that aren't media|
||Containing any sort of
||Containing link to a news story. Combine with a list operator to narrow the user set down further.|
||Excluding NSFW content. Excludes content that users have marked as "Potentially Sensitive". Doesn't always guarantee SFW results.|
||Only Tweets with Hashtags.|
||Sent from a specified client e.g. source:tweetdeck (See Note for common ones) eg:
||Matches domain name in a Twitter Card. Mostly equivalent to
||Matches domain name in a Card, but with different results to
||Tweets with a Player Card (Links to Audio sources, Spotify, Soundcloud etc.)|
||Tweets With GIFs|
||Tweets with a Player Card|
||Tweets with links to an App Card.
||Only Small image summary cards|
||Only large image Cards|
||Finds Conversational Ads cards.|
||Finds Moments cards.
On web and mobile, keyword operators can match on: The user's name, the @ screen name, tweet text, and shortened, as well as expanded url text (eg,
url:trib.al finds accounts that use that shortener, even though the full url is displayed).
By default "Top" results are shown, where "Top" means tweets with some engagements (replies, RTs, likes). "Latest" has most recent tweets. People search will match on descriptions, but not all operators work. "Photos" and "Videos" are presumably equivalent to
Exact Tokenization is not known, but it's most likely a custom one to preserve entities. URLs are also tokenized. Spelling correction appears sometimes, and also plurals are also matched, eg:
bears will also match tweets with
- not preceeding an operator are removed, so "state-of-the-art" is the same as "state of the art".
Private accounts are not included in the search index, and their tweets do no appear in results. Locked and suspended accounts are also hidden from results. There are other situations where tweets may not appear: anti-spam measures, or tweets simply have not been indexed due to server issues.
filter:type" can also be negated using the "
exclude:links is the same as
Example: I want Tweets from @Nasa with all types of media except images
from:NASA filter:media -filter:images
Combine complex queries together with booleans and parentheses to refine your results.
Example 1: I want mentions of either "puppy" or "kitten", with mentions of either "sweet" or "cute", excluding Retweets, with at least 10 likes.
(puppy OR kitten) AND (sweet OR cute) -filter:nativeretweets min_faves:10
Example 2: I want mentions of "space" and either "big" or "large" by members of the NASA astronauts List, sent from an iPhone or twitter.com, with images, excluding mentions of #asteroid, since 2011.
space (big OR large) list:nasa/astronauts (source:twitter_for_iphone OR source:twitter_web_client) filter:images since:2011-01-01 -#asteroid
To find any quote tweets, search for the tweet permalink, or the tweet ID with
url:1138631847783608321, see note for more.
card_name: only works for the last 7-8 days.
The maximum number of operators seems to be about 22 or 23.
Tweetdeck options for columns have equivalents you can use on web search:
- Tweets with Images:
- Tweets with GIFs:
- "Tweets with broadcasts":
(card_domain:pscp.tv OR card_domain:periscope.tv OR "twitter.com/i/broadcasts/")
- "Any Media"
(filter:images OR filter:videos)
- "Any Links (includes media)":
Web, Mobile, Tweetdeck Search runs on one type of system (as far as i can tell), Standard API Search is a different index, Premium Search and Enterprise Search is another separate thing based on Gnip products. API docs already exist for the API and Premium but i might add guides for those separately.
All user, tweet, DM, and some other object IDs are snowflake IDs on twitter since
2013-01-22 for user IDs. In short, each ID embeds a timestamp in it.
To use these with
max_id as time delimiters, either pick a tweet ID that roughly has a
created_at time you need, remembering that all times on twitter are UTC, or use the following (This works for all tweets after Snowflake was implemented):
To convert a Twitter ID to microsecond epoch:
(tweet_id >> 22) + 1288834974657 -- This gives the millisecond epoch of when the tweet or user was created.
Convert from epoch back to a tweet id:
(millisecond_epoch - 1288834974657) << 22 = tweet id
Here's a use case:
You want to start gathering all tweets for specific search terms starting at a specific time. Let's say this time in
August 4, 2019 09:00:00 UTC. You can use the
max_id parameter by first converting the millisecond epoch time to a tweet id. You can use https://www.epochconverter.com.
August 4, 2019 09:00:00 UTC =
1564909200000 (epoch milliseconds)
(1564909200000 - 1288834974657) << 22 = 1157939227653046272 (tweet id)
So if you set max_id to
1157939227653046272, you will start collecting tweets earlier than that datetime. This can be extremely helpful when you need to get a very specific portion of the timeline.
Here's a quick Python function:
def convert_milliepoch_to_tweet_id(milliepoch): if milliepoch <= 1288834974657: raise ValueError("Date is too early (before snowflake implementation)") return (milliepoch - 1288834974657) << 22
More details on snowflake can be found in @pushshift document here.
From a technical perspective Quote-Tweets are Tweets with a URL of another Tweet. It's possible to find Tweets that quote a specific Tweet by searching for the URL of that Tweet. Any parameters need to be removed or only Tweets that contain the parameter as well are found. Twitter appends a Client-parameter when copying Tweet URLs through the sharing menu. Eg.
?s=20 for the Web App and
?s=09 for the Android app. Example:
To find all Tweets that quote a specific user, you search for the first part of the Tweet-URL and exclude Tweets from the user:
Very few tweets have exact geo coordinates. Exact Geo coordinates are phased out for normal tweets, but will remain for photos: https://twitter.com/TwitterSupport/status/1141039841993355264
Tweets instead can be tagged by Place
How did I find these in the first place?
Reading Twitter Documentation and help docs from as many sources as possible - eg: Developer Documentation, Help pages, Tool-specific help pages, eg: Tweetdeck help etc. Using Share feature on tweetdeck to copy the search string. Searching google and pastebin and github for rarely documented ones together to find other lists of operators others have compiled.
Known Unknowns and Assumptions:
I have no idea how Twitter decides what should match
filter:news, my guess is that it's based on a list of whitelisted domain names, as tweets from anyone can appear as long as they link to a news site, no idea if this list is public. No idea if or how this filter changed over time. But we can try to retrieve tweets and see.
lang:und will match most empty tweets or tweets with a single number or link.
filter:safe presumably uses the User setting "Contains Sensitive Content" - but may also apply to specific tweets somehow.
It would be great to be able to reliably find Promoted tweets - this may be possible with some of the card searches. Tweets composed in Twitter Ads are available with
source:twitter_ads but other promoted tweets may not have been created with that app.
I'd also like to search for Collections (Timelines) and Moments, but this seems to work ok with just
url: searches. eg:
url:twitter.com/i/moments (I think the difference is events are curated?) but
url:twitter.com url:timelines has many false positives.
In Search Settings, "Hide Sensitive Content" equivalent is
filter:safe - is there an equivalent to "Remove Blocked and Muted Accounts"?
From TweetDeck dropdown menu:
lang:am Amharic (አማርኛ)
lang:ar Arabic (العربية)
lang:bg Bulgarian (Български)
lang:bn Bengali (বাংলা)
lang:bo Tibetan (བོད་སྐད)
lang:ca Catalan (Català)
lang:chr Cherokee (ᏣᎳᎩ)
lang:cs Czech (čeština)
lang:da Danish (Dansk)
lang:de German (Deutsch)
lang:dv Maldivian (ދިވެހި)
lang:el Greek (Ελληνικά)
lang:en English (English)
lang:es Spanish (Español)
lang:et Estonian (eesti)
lang:fa Persian (فارسی)
lang:fi Finnish (Suomi)
lang:fr French (Français)
lang:gu Gujarati (ગુજરાતી)
lang:hi Hindi (हिंदी)
lang:ht Haitian Creole (Kreyòl ayisyen)
lang:hu Hungarian (Magyar)
lang:hy Armenian (Հայերեն)
lang:in Indonesian (Bahasa Indonesia)
lang:is Icelandic (Íslenska)
lang:it Italian (Italiano)
lang:iu Inuktitut (ᐃᓄᒃᑎᑐᑦ)
lang:iw Hebrew (עברית)
lang:ja Japanese (日本語)
lang:ka Georgian (ქართული)
lang:km Khmer (ខ្មែរ)
lang:kn Kannada (ಕನ್ನಡ)
lang:ko Korean (한국어)
lang:lo Lao (ລາວ)
lang:lt Lithuanian (Lietuvių)
lang:lv Latvian (latviešu valoda)
lang:ml Malayalam (മലയാളം)
lang:my Myanmar (မြန်မာဘာသာ)
lang:ne Nepali (नेपाली)
lang:nl Dutch (Nederlands)
lang:no Norwegian (Norsk)
lang:or Oriya (ଓଡ଼ିଆ)
lang:pa Panjabi (ਪੰਜਾਬੀ)
lang:pl Polish (Polski)
lang:pt Portuguese (Português)
lang:ro Romanian (limba română)
lang:ru Russian (Русский)
lang:si Sinhala (සිංහල)
lang:sk Slovak (slovenčina)
lang:sl Slovene (slovenski jezik)
lang:sv Swedish (Svenska)
lang:ta Tamil (தமிழ்)
lang:te Telugu (తెలుగు)
lang:th Thai (ไทย)
lang:tl Tagalog (Tagalog)
lang:tr Turkish (Türkçe)
lang:uk Ukrainian (українська мова)
lang:ur Urdu (ﺍﺭﺩﻭ)
lang:vi Vietnamese (Tiếng Việt)
lang:zh Chinese (中文)
lang:sk seems to fail, as tweets matching the keywords are returned instead of the language.
source: should work for any API client, try putting the client name in quotes or replace spaces with underscores. This is the App name field that you can alter in the developer app configuration page, so anyone can set anything here and appear to tweet from a made up client. You cannot copy an existing name. This operator needs to be combined with something else to work, eg:
lang:en These are some common ones:
cloudhopper (tweets via sms service),
These are some notable, weird and wonderful ones:
source:"LG Smart Refrigerator"