【问题标题】:Search for tweets with t.co rewritten links搜索带有 t.co 重写链接的推文
【发布时间】:2011-11-25 12:53:09
【问题描述】:

刚刚注意到访问 t.co/LINKHERE 的访问者激增,该链接由 twitter 重写。如果您知道链接,有没有办法追溯包含该链接的 Twitter 消息?

【问题讨论】:

  • 您是要以编程方式执行此操作,还是只想在 search.twitter.com 上进行搜索?据我所知,不可能从 t.co 链接获取引用推文的 id(除非您是 Twitter)。您最好的选择是 1) 查看 dev.twitter.com/docs/tweet-entities 以进行 api 搜索或 2) 搜索未缩短的 URL,因为我不相信 t.co 链接“显示”在搜索中。
  • 不,他们没有。我认为如果一个字符串作为一个 URL 匹配,它会被一个缩短的 ID 替换,即使它出现在实际结果中,搜索也不会获取 ID。如果有任何意义。实际上,我在 Twitter 上发现了一些关于由于使用 URL 缩短器而导致的 API 问题的帖子。我只是希望找到包含我网站 URL 的推文。
  • 我对你的困境深有感触,Twitter 让你很难找到事情的根源。将来,与您自己的某种唯一标识符共享每个链接可能是最简单的。例如,www.domain.com/page-1?ref=XYZ
  • Twitter 自动将消息中的任何链接替换为短 URL,以 t.co/... 开头。
  • 我的意思是您指的特定 t.co LINK 是什么?

标签: twitter


【解决方案1】:

您可以使用 twitter API 1.1 执行此操作。使用 api 最简单的方法是通过 twitter API 控制台。步骤如下:

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

  2. Service 下拉菜单中选择https://api.twitter.com/1.1

  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. 现在要打开实际的推文,请使用此链接(当然要填充占位符):https://twitter.com/{user.screen_name}/status/{id_str}

【讨论】:

  • 看起来 REST 控制台不再可用。
【解决方案2】:

标准的 twitter 搜索将工作几天。

对于较旧的 t.co 链接,您可以尝试搜索 find-tco.appspot.com.

【讨论】:

    【解决方案3】:

    这里是快速简便的方法:

    1. 转至:http://dev.twitter.com/rest/tools/console
    2. 服务:“api.twitter.com/1.1”

    3. 身份验证:OAuth 1,如果需要,请登录

    4. 确保选择 GET 并将 https://api.twitter.com/1.1/search/tweets.json?q=http%3A%2F%2Ft.co%2F{**SUFFIX**} 粘贴到请求 URL 框中。

    5. **SUFFIX** 替换为 t.co URL 后缀。因此,如果您要搜索的 URL 是 t.co/**N2ul8FFCxu**,那么您粘贴的链接应如下所示:

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

    1. 点击发送

    2. 打开一个新标签并将twitter.com/**SCREEN_NAME**/status/**ID_STR**粘贴到地址栏中

    3. **SCREEN_NAME****ID_STR** 替换为来自响应的信息。像这样:

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

    【讨论】:

      【解决方案4】:

      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"
      }
      

      您会看到搜索也会返回转发。

      【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-02-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-01
      • 1970-01-01
      • 2020-04-30
      相关资源
      最近更新 更多