🔍 Advanced Search on Twitter

These operators work on Web, Mobile, Tweetdeck.

There is some overlap, but largely these will not work for v1.1 Search, Premium Search, or v2 Search APIs.

Adapted from TweetDeck Help, @lucahammer Guide, @eevee Twitter Manual, @pushshift and Twitter / Tweetdeck itself. Contributions / tests, examples welcome!

nasa esa(nasa esa)nasaesanasa OR esanasaesa"state of the art"state of the artstate-of-the-art"this is the * time this week"*+radiooooo-love-"live laugh love"-love#tgif$TWTRWhat ?:) OR :(:) :-) :P :D:-( :(url:google.comgu.comtheguardian.comurl:t_mobile.com_lang:enlangfrom:user@username"dogs from:NASA"to:user@username@user@username-from:usernamelist:715919216927322112list:esa/astronautstwitter.com/i/lists/715919216927322112twitter.com/esa/lists/astronautsfilter:verifiedfilter:blue_verifiedfilter:followsfilter:socialfilter:trustedTopLatestnear:citynear:"The Hague"near:mewithin:radiusfire near:san-francisco within:10kmgeocode:lat,long,radiusgeocode:37.7764685,-122.4172004,10kmplace:96683cc9126741d196683cc9126741d1since:2021-12-31-until:2021-12-31since:2021-12-31_23:59:59_UTC-_until:2021-12-31_23:59:59_UTCsince_time:1142974200since_iduntil_time:1142974215max_idsince_id:tweet_idmax_id:tweet_idwithin_time:2dwithin_time:3hwithin_time:5mwithin_time:30sfilter:nativeretweetsfrom:include:nativeretweetsfilter:filter:retweetsfilter:repliesto:userconversation_id:tweet_idfilter:quotequoted_tweet_id:tweet_idquoted_user_id:user_idcard_name:poll2choice_text_onlycard_name:poll3choice_text_onlycard_name:poll4choice_text_onlycard_name:poll2choice_imagecard_name:poll3choice_imagecard_name:poll4choice_imagefilter:has_engagementfilter:nativeretweetsinclude:nativeretweetsmin_retweets:5min_faves:10min_replies:100-min_retweets:500-min_faves:500-min_replies:100filter:mediafilter:twimgpic.twitter.comfilter:imagesfilter:videosfilter:periscopefilter:native_videofilter:vinefilter:consumer_videofilter:pro_videofilter:spacesfilter:links-filter:mediafilter:mentions@mentionsfilter:newsfilter:safefilter:hashtagssource:client_nametwitter_adscard_domain:pscp.tvurl:card_url:pscp.tvcard_domaincard_name:audiocard_name:animated_gifcard_name:playercard_name:appcard_name:promo_image_apppromo_apppromo_image_appcard_name:summarycard_name:summary_large_imagecard_name:promo_websitesummary_large_imagecard_name:promo_image_convocard_name:promo_video_convocard_name:3260518932:moment3260518932@TwitterMoments

Matching:

url:trib.al filter:imagesfilter:videos bearsbear-

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.

"photo"

Building Queries:

filter:type-filter:followsexclude:links-filter:links

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 urlhttps://twitter.com/NASA/status/1138631847783608321url:1138631847783608321 site:t-mobile.comapp:Twitter for iOSsite:t_mobile.comapp:Twitter_for_iOS

Limitations:

card_name:

The maximum number of operators seems to be about 22 or 23.

All the Time operators have to be used in conjunction with something else to work.

Tweetdeck Equivalents:

Tweetdeck options for columns have equivalents you can use on web search:

filter:imagesfilter:videoscard_name:animated_gif(card_domain:pscp.tv OR card_domain:periscope.tv OR "twitter.com/i/broadcasts/")(filter:images OR filter:videos)filter:links

Notes:

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.

Snowflake IDs:

2010-06-012013-01-22 since_idmax_idcreated_at

To convert a Twitter ID to millisecond epoch:

(tweet_id >> 22) + 1288834974657

Convert from epoch back to a tweet id:

(millisecond_epoch - 1288834974657) << 22 = tweet id

Here's a use case:

August 4, 2019 09:00:00 UTCmax_id August 4, 2019 09:00:00 UTC1564909200000 (1564909200000 - 1288834974657) << 22 = 1157939227653046272 1157939227653046272

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

Unfortunately, remember that JavaScript does not support 64bit integers, so these calculations and other operations on IDs often fail in unexpected ways.

More details on snowflake can be found in @pushshift document here.

Quote-Tweets

?s=20?s=09twitter.com/jack/status/20/ -from:jack twitter.com/jack/status/ -from:jack

Geo Searches

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:

filter:newslang:undfilter:safe source:twitter_ads url:url:twitter.com/i/eventsurl:twitter.com/i/momentsurl:twitter.com url:timelines filter:safe

Supported Languages:

Language is specified as 2 letter ISO codes. Language is tagged automatically from the tweet text, nad not always accurate, see here for notes on accuracy. The list from TweetDeck dropdown menu has all of them:

lang:am Amharic (አማርኛ)
lang:ar Arabic (العربية)
lang:bg Bulgarian (Български)
lang:bn Bengali (বাংলা)
lang:bo Tibetan (བོད་སྐད)
lang:ca Catalan (Català)
lang:ch` 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:chrlang:iulang:sk

There are also some special language codes that work. For example:

lang:undlang:qam2022-06-14lang:qct2022-06-14lang:qht2022-06-14lang:qme2022-06-14lang:qst2022-06-14lang:zxx2022-06-14

Common clients:

source: lang:en twitter_web_client twitter_web_app twitter_for_iphone twitter_for_ipad twitter_for_mac twitter_for_android twitter_ads tweetdeck tweetdeck_web_app twitter_for_advertisers twitter_media_studio cloudhopper (tweets via sms service) facebook instagram twitterfeed tweetbot.net IFTTT "LG Smart Refrigerator" "GUCCI SmartToilet™"