无需身份验证即可以 JSON 格式获取 Twitter 提要 [英] Get Twitter Feed as JSON without authentication

查看:26
本文介绍了无需身份验证即可以 JSON 格式获取 Twitter 提要的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几年前我写了一个小的 JavaScript,它抓取了用户(我的)最近的推文,然后将其解析出来以显示,包括链接、日期等.

I wrote a small JavaScript a couple of years ago that grabbed a users (mine) most recent tweet and then parsed it out for display including links, date etc.

它使用这个 json 调用来检索推文,但它不再有效.

It used this json call to retrieve the tweets and it no longer works.

http://twitter.com/statuses/user_timeline/radfan.json

现在返回错误:

{"errors":[{"message":"Sorry, that page does not exist","code":34}]}

我已经考虑过使用 api 版本(下面的代码),但这需要身份验证,我宁愿避免这样做,因为它只是在我的网站上显示我的最新推文,无论如何在我的个人资料页面上都是公开的:

I have looked at using the api version (code below) but this requires authentication which I would rather avoid having to do as it is just to display my latest tweet on my website which is public anyway on my profile page:

http://api.twitter.com/1/statuses/radfan.json

我没有跟上 Twitter 的 API 变化,因为我不再真正使用它,有没有办法解决这个问题,或者不再可能?

I haven't kept up with Twitter's API changes as I no longer really work with it, is there a way round this problem or is it no longer possible?

推荐答案

正如您在 文档中所见,使用 REST API,您将需要 OAuth 令牌为了做到这一点.幸运的是,我们可以使用 搜索(不使用 OAuth)并使用 <代码>来自:[用户名] 操作员

As you can see in the documentation, using the REST API you'll need OAuth Tokens in order to do this. Luckily, we can use the Search (which doesn't use OAuth) and use the from:[USERNAME] operator

示例:http://search.twitter.com/search.json?q=from:marcofolio
会给你一个带有来自该用户的推文的 JSON 对象,其中

object.results[0]

会给你最后一条推文.

这篇关于无需身份验证即可以 JSON 格式获取 Twitter 提要的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆