Last active
January 31, 2021 02:49
-
-
Save edsu/b597eef80dabe1c6ee911c5d621f06c6 to your computer and use it in GitHub Desktop.
use twitter's search client to retrieve all possible data for a tweet from the v2 api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
search_tweets.py \ | |
--query obama \ | |
--results-per-call 100 \ | |
--tweet-fields id,text,attachments,author_id,context_annotations,conversation_id,created_at,entities,geo,in_reply_to_user_id,lang,possibly_sensitive,public_metrics,referenced_tweets,reply_settings,source,withheld \ | |
--user-fields id,name,username,created_at,description,entities,location,pinned_tweet_id,profile_image_url,protected,public_metrics,url,verified,withheld \ | |
--media-fields media_key,type,duration_ms,height,preview_image_url,public_metrics,width \ | |
--poll-fields id,options,duration_minutes,end_datetime,voting_status \ | |
--place-fields full_name,id,contained_within,country,country_code,geo,name,place_type \ | |
--expansions author_id,referenced_tweets.id,in_reply_to_user_id,attachments.media_keys,attachments.poll_ids,geo.place_id,entities.mentions.username,referenced_tweets.id.author_id \ | |
--filename-prefix obama \ | |
--debug | |
# I removed these fields so it wouldn't silently error out | |
# --tweet-fields non_public_metrics,organic_metrics,promoted_metrics | |
# --media-fields non_public_metrics,organic_metrics, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment