2011-09-26 63 views
18

剛剛注意到t.co/LINKHERE鏈接被twitter重新編寫的一個訪客大量涌現。如果您知道鏈接,是否有方法追蹤包含鏈接的Twitter消息?使用t.co重寫鏈接搜索推文

+1

你的意思是以編程方式做到這一點,或者你只是想搜索search.twitter.com?據我所知,從t.co鏈接獲取推介推特的ID是不可能的(除非你是Twitter)。您最好的選擇是1)查看https://dev.twitter.com/docs/tweet-entities進行api搜索或2)搜索未縮短的網址,因爲我不相信t.co鏈接「在搜索中顯示「。 –

+0

不,他們沒有。我認爲,如果一個字符串被匹配爲一個URL,它會被一個更簡潔的ID所取代,即使它出現在實際結果中,搜索也不會收到該ID。如果它有任何意義。實際上,由於URL縮短使用情況,我發現Twitter發佈了一些關於API的問題。我只是希望找到包含我網站URL的推文。 – santa

+0

我覺得你的困境,Twitter很難找到事情的根源。將來,用您自己的某種獨特標識符分享每個鏈接可能是最容易的。例如,www.domain.com/page-1?ref=XYZ –

回答

11

你可以使用twitter API 1.1來做到這一點。最簡單的方法是使用API​​是通過twitter API控制檯。以下是具體步驟:

  1. 轉到https://dev.twitter.com/rest/tools/console

  2. 選擇https://api.twitter.com/1.1Service下拉菜單。

  3. Authentication下拉菜單中選擇OAuth 1並使用您的Twitter帳戶進行授權。

  4. 選擇GET/search/tweets.json api。

  5. 鍵入q查詢參數的t.co鏈接(例如https://t.co/w6iqrcuZMA)(嘗試HTTP和HTTPS鏈接。在我的情況下http鏈接返回任何記錄,而HTTPS鏈接返回一些記錄)。所有的搜索結果將以json格式返回。

  6. 我們打開實際的tweet使用這個鏈接(補當然佔位符):https://twitter.com/{user.screen_name}/status/{id_str}

+1

看起來REST控制檯不再可用。 – Bonnici

1

t.co鏈接顯示在搜索中,所以如果您好奇,在搜索索引中刪除它們之前,您大概有一週時間才能找到它們。

例如: http://search.twitter.com/search.json?q=https:%2F%2Ft.co%2FGJMsIcM6

返回:

{ 
    "completed_in": 0.019, 
    "max_id": 178215431251828740, 
    "max_id_str": "178215431251828736", 
    "page": 1, 
    "query": "https%3A%2F%2Ft.co%2FGJMsIcM6", 
    "refresh_url": "?since_id=178215431251828736&q=https%3A%2F%2Ft.co%2FGJMsIcM6", 
    "results": [ 
    { 
     "created_at": "Fri, 09 Mar 2012 20:27:24 +0000", 
     "from_user": "kurrik", 
     "from_user_id": 7588892, 
     "from_user_id_str": "7588892", 
     "from_user_name": "Arne Roomann-Kurrik", 
     "geo": null, 
     "id": 178215431251828740, 
     "id_str": "178215431251828736", 
     "iso_language_code": "en", 
     "metadata": { 
     "result_type": "recent" 
     }, 
     "profile_image_url": "http://a0.twimg.com/profile_images/24229162/arne001_normal.jpg", 
     "profile_image_url_https": "https://si0.twimg.com/profile_images/24229162/arne001_normal.jpg", 
     "source": "<a href="http://twitter.com/tweetbutton" rel="nofollow">Tweet Button</a>", 
     "text": "RT @raffi: 「Twitter Catches the 'SPDY' Train」 from @wired → http://t.co/suCbWWEl (& they reference my tweet! → https://t.co/GJMsIcM6)", 
     "to_user": null, 
     "to_user_id": null, 
     "to_user_id_str": null, 
     "to_user_name": null 
    }, 
    { 
     "created_at": "Fri, 09 Mar 2012 20:26:26 +0000", 
     "from_user": "raffi", 
     "from_user_id": 8285392, 
     "from_user_id_str": "8285392", 
     "from_user_name": "Raffi Krikorian", 
     "geo": null, 
     "id": 178215186921033730, 
     "id_str": "178215186921033730", 
     "iso_language_code": "en", 
     "metadata": { 
     "result_type": "recent" 
     }, 
     "profile_image_url": "http://a0.twimg.com/profile_images/1270234259/raffi-headshot-casual_normal.png", 
     "profile_image_url_https": "https://si0.twimg.com/profile_images/1270234259/raffi-headshot-casual_normal.png", 
     "source": "<a href="http://twitter.com/tweetbutton" rel="nofollow">Tweet Button</a>", 
     "text": "「Twitter Catches the 'SPDY' Train」 from @wired → http://t.co/suCbWWEl (& they reference my tweet! → https://t.co/GJMsIcM6)", 
     "to_user": null, 
     "to_user_id": null, 
     "to_user_id_str": null, 
     "to_user_name": null 
    } 
    ], 
    "results_per_page": 15, 
    "since_id": 0, 
    "since_id_str": "0" 
} 

你會看到搜索返回銳推爲好。

+3

{ 錯誤:[ { }消息:「Twitter REST API v1不再有效,請遷移到API v1.1。https://dev.twitter.com/docs/api/1.1/overview。」, code:68 } ] } – Ultrasaurus

+1

是的,提到的API端點現在已經過期。您需要使用http://api.twitter.com/1.1/search/tweets.json?q=https:%2F%2Ft.co%2FGJMsIcM6,而不幸的是這種方式在瀏覽器中無法使用。嘗試使用https://dev.twitter.com/docs/api/1.1/get/search/tweets右側的OAuth工具生成有效的請求。 –

+0

現在工作了! – skywinder

2

這裏的快速簡便的方法:

  1. 轉到:http://dev.twitter.com/rest/tools/console
  2. 服務:「api.twitter.com/1.1」

  3. 正宗ation:OAuth 1,然後登錄,如果您需要

  4. 確保選擇GET並將https://api.twitter.com/1.1/search/tweets.json?q=http%3A%2F%2Ft.co%2F{**SUFFIX**}粘貼到請求URL框中。

  5. 用t.co URL後綴替換**SUFFIX**。所以,如果你要搜索的網址是t.co/**N2ul8FFCxu**,您粘貼鏈接應該是這樣的:

https://api.twitter.com/1.1/search/tweets.json?q=http%3A%2F%2Ft.co%2F{**N2ul8FFCxu**}

  • 單擊發送

  • 打開新選項卡並將twitter.com/**SCREEN_NAME**/status/**ID_STR**粘貼到地址欄中

  • **SCREEN_NAME****ID_STR**替換爲來自響應。就像這樣:

  • twitter.com/**twitter**/status/**526534593826938881**

    2

    標準的Twitter搜索將幾天的工作。

    對於較舊的t.co鏈接,您可以嘗試使用 find-tco.appspot.com進行搜索。