Standard search API | Docs | Twitter Developer Platform

文章推薦指數: 80 %
投票人數:10人

Returns a collection of relevant Tweets matching a specified query. Please note that Twitter's search service and, by extension, the Search API is not meant to ... SearchTweets:Standardv1.1 Overview Guides APIreference APIreferencecontents StandardsearchAPI Pleasenote Werecentlyreleased recentsearch,a TwitterAPIv2 endpointthathassimilarfunctionalitytothisone.Thenewversioniscurrentlyindevelopmentandservesadequateaccessforthemajorityofdevelopersonourplatform. Whileelevatedlevelsofaccessarecomingtov2soon,developersinneedofhigherlevelsofaccesscan exploreour v1.1premium or enterprise APIs.Youcanseeanoverviewofoursearchofferingsonour searchoverview page,andseewhat'snewwithv2byvisitingthe searchcomparisonguide. StandardsearchAPI ReturnsacollectionofrelevantTweetsmatchingaspecifiedquery. PleasenotethatTwitter'ssearchserviceand,byextension,theSearchAPIisnotmeanttobeanexhaustivesourceofTweets.NotallTweetswillbeindexedormadeavailableviathesearchinterface. TolearnhowtouseTwitterSearcheffectively,pleaseseetheStandardsearchoperatorspageforalistofavailablefilteroperators.Also,seetheWorkingwithTimelinespagetolearnbestpracticesfornavigatingresultsbysince_idandmax_id. ResourceURL¶ https://api.twitter.com/1.1/search/tweets.json ResourceInformation¶ Responseformats JSON Requiresauthentication? Yes Ratelimited? Yes Requests/15-minwindow(userauth) 180 Requests/15-minwindow(appauth) 450 Parameters¶ q required AUTF-8,URL-encodedsearchqueryof500charactersmaximum,includingoperators.Queriesmayadditionallybelimitedbycomplexity. @noradio geocode optional Returnstweetsbyuserslocatedwithinagivenradiusofthegivenlatitude/longitude.ThelocationispreferentiallytakingfromtheGeotaggingAPI,butwillfallbacktotheirTwitterprofile.Theparametervalueisspecifiedby"latitude,longitude,radius",whereradiusunitsmustbespecifiedaseither"mi"(miles)or"km"(kilometers).NotethatyoucannotusethenearoperatorviatheAPItogeocodearbitrarylocations;howeveryoucanusethisgeocodeparametertosearchneargeocodesdirectly.Amaximumof1,000distinct"sub-regions"willbeconsideredwhenusingtheradiusmodifier. 37.781157-122.3987201mi lang optional Restrictstweetstothegivenlanguage,givenbyanISO639-1code.Languagedetectionisbest-effort. eu locale optional Specifythelanguageofthequeryyouaresending(onlyjaiscurrentlyeffective).Thisisintendedforlanguage-specificconsumersandthedefaultshouldworkinthemajorityofcases. ja result_type optional Optional.Specifieswhattypeofsearchresultsyouwouldprefertoreceive.Thecurrentdefaultis"mixed."Validvaluesinclude:*mixed:Includebothpopularandrealtimeresultsintheresponse.*recent:returnonlythemostrecentresultsintheresponse*popular:returnonlythemostpopularresultsintheresponse. mixedrecentpopular count optional Thenumberoftweetstoreturnperpage,uptoamaximumof100.Defaultsto15.Thiswasformerlythe"rpp"parameterintheoldSearchAPI. 100 until optional Returnstweetscreatedbeforethegivendate.DateshouldbeformattedasYYYY-MM-DD.Keepinmindthatthesearchindexhasa7-daylimit.Inotherwords,notweetswillbefoundforadateolderthanoneweek. 2015-07-19 since_id optional ReturnsresultswithanIDgreaterthan(thatis,morerecentthan)thespecifiedID.TherearelimitstothenumberofTweetswhichcanbeaccessedthroughtheAPI.IfthelimitofTweetshasoccuredsincethesince_id,thesince_idwillbeforcedtotheoldestIDavailable. 12345 max_id optional ReturnsresultswithanIDlessthan(thatis,olderthan)orequaltothespecifiedID. 54321 include_entities optional Theentitiesnodewillnotbeincludedwhensettofalse. false ExampleRequests¶ $curl--requestGET --url'https://api.twitter.com/1.1/search/tweets.json?q=nasa&result_type=popular' --header'authorization:OAuthoauth_consumer_key="consumer-key-for-app", oauth_nonce="generated-nonce",oauth_signature="generated-signature", oauth_signature_method="HMAC-SHA1",oauth_timestamp="generated-timestamp", oauth_token="access-token-for-authed-user",oauth_version="1.0"' $twurl/1.1/search/tweets.json?q=nasa&result_type=popular ExampleResponse¶ { "statuses":[ { "created_at":"SunFeb2518:11:01+00002018", "id":967824267948773377, "id_str":"967824267948773377", "text":"Frompilottoastronaut,RobertH.LawrencewasthefirstAfrican-Americantobeselectedasanastronautbyanyna…https://t.co/FjPEWnh804", "truncated":true, "entities":{ "hashtags":[], "symbols":[], "user_mentions":[], "urls":[ { "url":"https://t.co/FjPEWnh804", "expanded_url":"https://twitter.com/i/web/status/967824267948773377", "display_url":"twitter.com/i/web/status/9…", "indices":[ 117, 140 ] } ] }, "metadata":{ "result_type":"popular", "iso_language_code":"en" }, "source":"Sprinklr", "in_reply_to_status_id":null, "in_reply_to_status_id_str":null, "in_reply_to_user_id":null, "in_reply_to_user_id_str":null, "in_reply_to_screen_name":null, "user":{ "id":11348282, "id_str":"11348282", "name":"NASA", "screen_name":"NASA", "location":"", "description":"Exploretheuniverseanddiscoverourhomeplanetwith@NASA.WeusuallypostinEST(UTC-5)", "url":"https://t.co/TcEE6NS8nD", "entities":{ "url":{ "urls":[ { "url":"https://t.co/TcEE6NS8nD", "expanded_url":"http://www.nasa.gov", "display_url":"nasa.gov", "indices":[ 0, 23 ] } ] }, "description":{ "urls":[] } }, "protected":false, "followers_count":28605561, "friends_count":270, "listed_count":90405, "created_at":"WedDec1920:20:32+00002007", "favourites_count":2960, "utc_offset":-18000, "time_zone":"EasternTime(US&Canada)", "geo_enabled":false, "verified":true, "statuses_count":50713, "lang":"en", "contributors_enabled":false, "is_translator":false, "is_translation_enabled":false, "profile_background_color":"000000", "profile_background_image_url":"http://pbs.twimg.com/profile_background_images/590922434682880000/3byPYvqe.jpg", "profile_background_image_url_https":"https://pbs.twimg.com/profile_background_images/590922434682880000/3byPYvqe.jpg", "profile_background_tile":false, "profile_image_url":"http://pbs.twimg.com/profile_images/188302352/nasalogo_twitter_normal.jpg", "profile_image_url_https":"https://pbs.twimg.com/profile_images/188302352/nasalogo_twitter_normal.jpg", "profile_banner_url":"https://pbs.twimg.com/profile_banners/11348282/1518798395", "profile_link_color":"205BA7", "profile_sidebar_border_color":"000000", "profile_sidebar_fill_color":"F3F2F2", "profile_text_color":"000000", "profile_use_background_image":true, "has_extended_profile":true, "default_profile":false, "default_profile_image":false, "following":null, "follow_request_sent":null, "notifications":null, "translator_type":"regular" }, "geo":null, "coordinates":null, "place":null, "contributors":null, "is_quote_status":false, "retweet_count":988, "favorite_count":3875, "favorited":false, "retweeted":false, "possibly_sensitive":false, "lang":"en" }, { "created_at":"SunFeb2519:31:07+00002018", "id":967844427480911872, "id_str":"967844427480911872", "text":"Amagneticpowerstruggleofgalacticproportions-newresearchhighlightstheroleoftheSun'smagneticlandscap…https://t.co/29dZgga54m", "truncated":true, "entities":{ "hashtags":[], "symbols":[], "user_mentions":[], "urls":[ { "url":"https://t.co/29dZgga54m", "expanded_url":"https://twitter.com/i/web/status/967844427480911872", "display_url":"twitter.com/i/web/status/9…", "indices":[ 117, 140 ] } ] }, "metadata":{ "result_type":"popular", "iso_language_code":"en" }, "source":"Sprinklr", "in_reply_to_status_id":null, "in_reply_to_status_id_str":null, "in_reply_to_user_id":null, "in_reply_to_user_id_str":null, "in_reply_to_screen_name":null, "user":{ "id":11348282, "id_str":"11348282", "name":"NASA", "screen_name":"NASA", "location":"", "description":"Exploretheuniverseanddiscoverourhomeplanetwith@NASA.WeusuallypostinEST(UTC-5)", "url":"https://t.co/TcEE6NS8nD", "entities":{ "url":{ "urls":[ { "url":"https://t.co/TcEE6NS8nD", "expanded_url":"http://www.nasa.gov", "display_url":"nasa.gov", "indices":[ 0, 23 ] } ] }, "description":{ "urls":[] } }, "protected":false, "followers_count":28605561, "friends_count":270, "listed_count":90405, "created_at":"WedDec1920:20:32+00002007", "favourites_count":2960, "utc_offset":-18000, "time_zone":"EasternTime(US&Canada)", "geo_enabled":false, "verified":true, "statuses_count":50713, "lang":"en", "contributors_enabled":false, "is_translator":false, "is_translation_enabled":false, "profile_background_color":"000000", "profile_background_image_url":"http://pbs.twimg.com/profile_background_images/590922434682880000/3byPYvqe.jpg", "profile_background_image_url_https":"https://pbs.twimg.com/profile_background_images/590922434682880000/3byPYvqe.jpg", "profile_background_tile":false, "profile_image_url":"http://pbs.twimg.com/profile_images/188302352/nasalogo_twitter_normal.jpg", "profile_image_url_https":"https://pbs.twimg.com/profile_images/188302352/nasalogo_twitter_normal.jpg", "profile_banner_url":"https://pbs.twimg.com/profile_banners/11348282/1518798395", "profile_link_color":"205BA7", "profile_sidebar_border_color":"000000", "profile_sidebar_fill_color":"F3F2F2", "profile_text_color":"000000", "profile_use_background_image":true, "has_extended_profile":true, "default_profile":false, "default_profile_image":false, "following":null, "follow_request_sent":null, "notifications":null, "translator_type":"regular" }, "geo":null, "coordinates":null, "place":null, "contributors":null, "is_quote_status":false, "retweet_count":2654, "favorite_count":7962, "favorited":false, "retweeted":false, "possibly_sensitive":false, "lang":"en" }, { "created_at":"MonFeb2619:21:43+00002018", "id":968204446625869827, "id_str":"968204446625869827", "text":"Someone'sgottobefirst.Inspace,thefirstexplorersbeyondMarswerePioneers10and11,twinrobotswhochart…https://t.co/SUX30Y45mr", "truncated":true, "entities":{ "hashtags":[], "symbols":[], "user_mentions":[], "urls":[ { "url":"https://t.co/SUX30Y45mr", "expanded_url":"https://twitter.com/i/web/status/968204446625869827", "display_url":"twitter.com/i/web/status/9…", "indices":[ 117, 140 ] } ] }, "metadata":{ "result_type":"popular", "iso_language_code":"en" }, "source":"Sprinklr", "in_reply_to_status_id":null, "in_reply_to_status_id_str":null, "in_reply_to_user_id":null, "in_reply_to_user_id_str":null, "in_reply_to_screen_name":null, "user":{ "id":11348282, "id_str":"11348282", "name":"NASA", "screen_name":"NASA", "location":"", "description":"Exploretheuniverseanddiscoverourhomeplanetwith@NASA.WeusuallypostinEST(UTC-5)", "url":"https://t.co/TcEE6NS8nD", "entities":{ "url":{ "urls":[ { "url":"https://t.co/TcEE6NS8nD", "expanded_url":"http://www.nasa.gov", "display_url":"nasa.gov", "indices":[ 0, 23 ] } ] }, "description":{ "urls":[] } }, "protected":false, "followers_count":28605561, "friends_count":270, "listed_count":90405, "created_at":"WedDec1920:20:32+00002007", "favourites_count":2960, "utc_offset":-18000, "time_zone":"EasternTime(US&Canada)", "geo_enabled":false, "verified":true, "statuses_count":50713, "lang":"en", "contributors_enabled":false, "is_translator":false, "is_translation_enabled":false, "profile_background_color":"000000", "profile_background_image_url":"http://pbs.twimg.com/profile_background_images/590922434682880000/3byPYvqe.jpg", "profile_background_image_url_https":"https://pbs.twimg.com/profile_background_images/590922434682880000/3byPYvqe.jpg", "profile_background_tile":false, "profile_image_url":"http://pbs.twimg.com/profile_images/188302352/nasalogo_twitter_normal.jpg", "profile_image_url_https":"https://pbs.twimg.com/profile_images/188302352/nasalogo_twitter_normal.jpg", "profile_banner_url":"https://pbs.twimg.com/profile_banners/11348282/1518798395", "profile_link_color":"205BA7", "profile_sidebar_border_color":"000000", "profile_sidebar_fill_color":"F3F2F2", "profile_text_color":"000000", "profile_use_background_image":true, "has_extended_profile":true, "default_profile":false, "default_profile_image":false, "following":null, "follow_request_sent":null, "notifications":null, "translator_type":"regular" }, "geo":null, "coordinates":null, "place":null, "contributors":null, "is_quote_status":false, "retweet_count":729, "favorite_count":2777, "favorited":false, "retweeted":false, "possibly_sensitive":false, "lang":"en" }, { "created_at":"MonFeb2606:42:50+00002018", "id":968013469743288321, "id_str":"968013469743288321", "text":"宇宙ステーションでも、日本と9時間の時差で月曜日が始まりました。

n今週は6人から3人にクルーのサイズダウンがありますが、しっかりと任されているタスクをこなしたいと思います。

nn写真は、NASAの実験施設「ディスティニー」のグローブ…https://t.co/2CYoPV6Aqx", "truncated":true, "entities":{ "hashtags":[], "symbols":[], "user_mentions":[], "urls":[ { "url":"https://t.co/2CYoPV6Aqx", "expanded_url":"https://twitter.com/i/web/status/968013469743288321", "display_url":"twitter.com/i/web/status/9…", "indices":[ 117, 140 ] } ] }, "metadata":{ "result_type":"popular", "iso_language_code":"ja" }, "source":"TwitterWebClient", "in_reply_to_status_id":null, "in_reply_to_status_id_str":null, "in_reply_to_user_id":null, "in_reply_to_user_id_str":null, "in_reply_to_screen_name":null, "user":{ "id":842625693733203968, "id_str":"842625693733203968", "name":"金井宣茂", "screen_name":"Astro_Kanai", "location":"", "description":"宇宙飛行士。

2017年12月19日から国際宇宙ステーションに長期滞在中。

応援いただいているフォロワーのみなさまと一緒に、宇宙滞在を楽しみたいと思います!", "url":"https://t.co/rWU6cxY9iL", "entities":{ "url":{ "urls":[ { "url":"https://t.co/rWU6cxY9iL", "expanded_url":"https://ameblo.jp/astro-kanai/", "display_url":"ameblo.jp/astro-kanai/", "indices":[ 0, 23 ] } ] }, "description":{ "urls":[] } }, "protected":false, "followers_count":51512, "friends_count":59, "listed_count":655, "created_at":"FriMar1706:36:35+00002017", "favourites_count":7075, "utc_offset":32400, "time_zone":"Tokyo", "geo_enabled":false, "verified":true, "statuses_count":1035, "lang":"ja", "contributors_enabled":false, "is_translator":false, "is_translation_enabled":false, "profile_background_color":"000000", "profile_background_image_url":"http://abs.twimg.com/images/themes/theme1/bg.png", "profile_background_image_url_https":"https://abs.twimg.com/images/themes/theme1/bg.png", "profile_background_tile":false, "profile_image_url":"http://pbs.twimg.com/profile_images/879071738625232901/u0nlrr4Y_normal.jpg", "profile_image_url_https":"https://pbs.twimg.com/profile_images/879071738625232901/u0nlrr4Y_normal.jpg", "profile_banner_url":"https://pbs.twimg.com/profile_banners/842625693733203968/1492509582", "profile_link_color":"E81C4F", "profile_sidebar_border_color":"000000", "profile_sidebar_fill_color":"000000", "profile_text_color":"000000", "profile_use_background_image":false, "has_extended_profile":true, "default_profile":false, "default_profile_image":false, "following":null, "follow_request_sent":null, "notifications":null, "translator_type":"none" }, "geo":null, "coordinates":null, "place":null, "contributors":null, "is_quote_status":false, "retweet_count":226, "favorite_count":1356, "favorited":false, "retweeted":false, "possibly_sensitive":false, "lang":"ja" }, { "created_at":"MonFeb2601:07:05+00002018", "id":967928974960545793, "id_str":"967928974960545793", "text":"Congratulationsto#Olympicsathleteswhowongold!NeutronstarsliketheoneattheheartoftheCrabNebulamay…https://t.co/vz4SnPupe2", "truncated":true, "entities":{ "hashtags":[ { "text":"Olympics", "indices":[ 19, 28 ] } ], "symbols":[], "user_mentions":[], "urls":[ { "url":"https://t.co/vz4SnPupe2", "expanded_url":"https://twitter.com/i/web/status/967928974960545793", "display_url":"twitter.com/i/web/status/9…", "indices":[ 116, 139 ] } ] }, "metadata":{ "result_type":"popular", "iso_language_code":"en" }, "source":"MediaStudio", "in_reply_to_status_id":null, "in_reply_to_status_id_str":null, "in_reply_to_user_id":null, "in_reply_to_user_id_str":null, "in_reply_to_screen_name":null, "user":{ "id":19802879, "id_str":"19802879", "name":"NASAJPL", "screen_name":"NASAJPL", "location":"Pasadena,Calif.", "description":"NASAJetPropulsionLaboratorymanagesmanyofNASA'sroboticmissionsexploringEarth,thesolarsystemandouruniverse.TweetsfromJPL'sNewsOffice.", "url":"http://t.co/gcM9d1YLUB", "entities":{ "url":{ "urls":[ { "url":"http://t.co/gcM9d1YLUB", "expanded_url":"http://www.jpl.nasa.gov", "display_url":"jpl.nasa.gov", "indices":[ 0, 22 ] } ] }, "description":{ "urls":[] } }, "protected":false, "followers_count":2566921, "friends_count":379, "listed_count":15065, "created_at":"SatJan3103:19:43+00002009", "favourites_count":1281, "utc_offset":-32400, "time_zone":"Alaska", "geo_enabled":false, "verified":true, "statuses_count":6328, "lang":"en", "contributors_enabled":false, "is_translator":false, "is_translation_enabled":false, "profile_background_color":"0B090B", "profile_background_image_url":"http://pbs.twimg.com/profile_background_images/8479565/twitter_jpl_bkg.009.jpg", "profile_background_image_url_https":"https://pbs.twimg.com/profile_background_images/8479565/twitter_jpl_bkg.009.jpg", "profile_background_tile":false, "profile_image_url":"http://pbs.twimg.com/profile_images/2305452633/lg0hov3l8g4msxbdwv48_normal.jpeg", "profile_image_url_https":"https://pbs.twimg.com/profile_images/2305452633/lg0hov3l8g4msxbdwv48_normal.jpeg", "profile_banner_url":"https://pbs.twimg.com/profile_banners/19802879/1398298134", "profile_link_color":"0D1787", "profile_sidebar_border_color":"100F0E", "profile_sidebar_fill_color":"74A6CD", "profile_text_color":"0C0C0D", "profile_use_background_image":true, "has_extended_profile":false, "default_profile":false, "default_profile_image":false, "following":null, "follow_request_sent":null, "notifications":null, "translator_type":"none" }, "geo":null, "coordinates":null, "place":null, "contributors":null, "is_quote_status":false, "retweet_count":325, "favorite_count":1280, "favorited":false, "retweeted":false, "possibly_sensitive":false, "lang":"en" } ], "search_metadata":{ "completed_in":0.057, "max_id":0, "max_id_str":"0", "next_results":"?max_id=967574182522482687&q=nasa&include_entities=1&result_type=popular", "query":"nasa", "count":3, "since_id":0, "since_id_str":"0" } } Pleasenotethat"count"waspreviously"results_per_page". ByusingTwitter’sservicesyouagreetoourCookiesUse.Weusecookiesforpurposesincludinganalytics,personalisation,andads. OK ThispageandcertainotherTwittersitesplaceandreadthirdpartycookiesonyourbrowserthatareusedfornon-essentialpurposesincludingtargetingofads. Throughthesecookies,Google,LinkedInandDemandbasecollectpersonaldataaboutyoufortheirownpurposes. Learnmore. Accept Decline



請為這篇文章評分?