簡體   English   中英

Twitter Api:如何在用戶主頁時間線中進行搜索

[英]Twitter Api: How to search in User home timeline

我正在使用 Twitter REST Api 來獲取我的時間線推文 目前我正在使用以下功能來獲取推文,這些功能運行良好。

https://api.twitter.com/1.1/statuses/home_timeline.json

https://api.twitter.com/1.1/statuses/user_timeline.json

現在我想過濾Timeline Tweets 我在此鏈接中同時使用文本搜索和位置過濾器。

https://api.twitter.com/1.1/search/tweets.json?q=[text]&geocode=[lat/lon]

我想獲取我的時間線推文,但它返回全局推文。

如何在我的帳戶上實施過濾器?

我是否需要創建自定義函數來滿足我的要求?

使用標准的Twitter API不可能實現您的要求。

有兩種方法可以實現您的要求:

  1. 您可以從時間軸獲取tweet,然后在應用程序中從中過濾tweet。 這是唯一可行的選擇。
  2. 另一種選擇是使用Twitter API進行搜索,並過濾出您關注的人的推文。 但這不是可行的選擇。

我認為選項1是您實際上可以做的唯一事情。

你是對的,用戶和家庭時間線只有非常有限的過濾功能(最小時間戳和最大 ID 的時間限制)。 同時,通用搜索默認是通用的。

可以使用通用搜索 API 來搜索特定用戶的時間線from:操作員:您可以限制發件人設置的結果https://developer.twitter.com/en/docs/twitter-api/tweets/search/集成/構建查詢

V1.1 https://developer.twitter.com/en/docs/twitter-api/v1/tweets/search/api-reference/get-search-tweets

https://api.twitter.com/1.1/search/tweets.json?q=from%3A[userhandle]%20[keyword]&geocode=[lat/lon]

V2 https://developer.twitter.com/en/docs/twitter-api/tweets/search/api-reference/get-tweets-search-recent

https://api.twitter.com/2/tweets/search/recent?query=from%3A[userhandle]%20[keyword]&geocode=[lat/lon]

from 操作符可用於 Twitter 句柄或 Twitter 用戶 ID。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM