小丁的屋舍
技巧 | 绝对干货的Twitter搜索技巧
2022-08-05
查看标签
1010次浏览

在小学计算机课中,我们学过如何高效的使用搜索引擎,由于百度等内地网站学术资料不足,必然就需要访问国外网站获取资料,而Twitter作为传播研究中重要的数据来源,很多之后我们需要获取指定的推文信息,例如所有@某账号的推文、所有包含Twitter话题(HashTag)的推文或某个账号在某段时间内包含的推文。通过Twitter搜索的高级技巧,我们可以准确地搜索以上内容。

搜索词

搜索词,即我们想要获得什么样的推文。这个搜索词可以是一个词语,也可以是一个条件。Twitter搜索中支持的搜索词类型如下:

搜索词搜索结果
watching now同时包含”watching” 和”now” 的推文 ( 默认搜索模式 )
“happy hour”包含完整的短语”happy hour”的推文
love OR hate包含”love”或”hate”,或同时包含两个词的推文
beer -root包含”beer”,但不包含”root”的推文
#haiku包含Twitter话题”haiku”的推文
from:interior Twitter 账户” interior” 发布的推文 ( 用于抓取指定用户的推文 )
list:NASA/astronauts-in-space-now由NASA列表astronauts-in-space-now中的Twitter账户发布的推文
to:NASA回复Twitter账户”NASA”的推文
@NASA提到Twitter账户”NASA”的推文(即@指定Twitter账户的推文)

内容筛选

内容筛选是指在搜索词的基础上,我们可以依据Twitter推文的内容进行筛选。常用的筛选条件如下:

内容条件搜索结果
politics filter:safe包含”puppy”,且过滤被可能包含潜在敏感信息的推文
puppy filter:media包含”puppy”,且包含图片或视频
puppy -filter:retweets包含” puppy” ,且不包含转推 ( 用于过滤转推推文 )
puppy filter:native\_video包含”puppy”,且包含一个上传的视频
puppy filter:periscope包含”puppy”,且包含一个可展示为视频的链接
puppy filter:images包含”puppy”,且包含一个图片
puppy filter:links包含”puppy”,且包含一个链接
puppy url:amazon包含”puppy”,且包含一个内容包括”amazon”的Url链接

时间筛选

除了依据推文内容进行筛选外,我们也可以依据推文的发布时间进行筛选。依据时间筛选的标准如下:

OperatorFinds Tweets…
puppy since:2020-6-4包含”puppy”且发布时间晚于2020.06.04(包含2020.06.04)
puppy until:2020-6-4包含”puppy”且发布时间早于2020.06.04(不包含2020.06.04)

内容筛选的条件和时间筛选的条件可以任意叠加,例如我们如果想要获取Twitter账户”NASA”在2020年5月所有发布的不是转推的推文,用如下搜索语句即可:

from:NASA -filter:retweets since:2020-5-1 until:2020-6-1

附 Twitter 开发者文档中的列表

OperatorFinds Tweets…
watching nowcontaining both “watching” and “now”. This is the default operator.
“happy hour”containing the exact phrase “happy hour”.
love OR hatecontaining either “love” or “hate” (or both).
beer -rootcontaining “beer” but not “root”.
#haikucontaining the hashtag “haiku”.
from:interiorsent from Twitter account “interior”.
list:NASA/astronauts-in-space-nowsent from a Twitter account in the NASA list astronauts-in-space-now
to:NASAa Tweet authored in reply to Twitter account “NASA”.
@NASAmentioning Twitter account “NASA”.
politics filter:safecontaining “politics” with Tweets marked as potentially sensitive removed.
puppy filter:mediacontaining “puppy” and an image or video.
puppy -filter:retweetscontaining “puppy”, filtering out retweets
puppy filter:native\_videocontaining “puppy” and an uploaded video, Amplify video, Periscope, or Vine.
puppy filter:periscopecontaining “puppy” and a Periscope video URL.
puppy filter:vinecontaining “puppy” and a Vine.
puppy filter:imagescontaining “puppy” and links identified as photos, including third parties such as Instagram.
puppy filter:twimgcontaining “puppy” and a pic.twitter.com link representing one or more photos.
hilarious filter:linkscontaining “hilarious” and linking to URL.
puppy url:amazoncontaining “puppy” and a URL with the word “amazon” anywhere within it.
superhero since:2015-12-21containing “superhero” and sent since date “2015-12-21” (year-month-day).
puppy until:2015-12-21containing “puppy” and sent before the date “2015-12-21”.
movie -scary ?containing “movie”, but not “scary”, and with a positive attitude.
flight ?containing “flight” and with a negative attitude.
traffic ?containing “traffic” and asking a question.

开发者文档地址:https://developer.twitter.com/en/docs/twitter-api/v1/tweets/search/overview
原文链接:https://blog.csdn.net/Changxing_J/article/details/106611387