通过 twitter api 1.1,通过客户端代码 (js) 获取公共推文 [英] fetch public tweets via twitter api 1.1, via client side code (js)

查看:38
本文介绍了通过 twitter api 1.1,通过客户端代码 (js) 获取公共推文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个基本的个人主页,它由一个 html 文档、一个 .css 和 jquery*.js 文件组成.我想通过从推文中获取页面内容来创建博客风格的外观.标准小部件不适合页面的外观.

I'm working on a basic personal homepage, consists of a single html document, a .css and jquery*.js file. I want to create a blog-ish look via fetching page content from tweets. The standart widget doesn't fit to the look of the page.

我可以通过 API v1 从任何帐户获取公共推文,而无需验证废话(这是废话,因为它无论如何都是公开数据).但是对于 API v1.1,它返回身份验证错误.它要我进行身份验证以获取公共数据.尝试导航 this 网址.它显示 ({"errors":[{"message":"Bad Authentication data","code":215}]});.

I can fetch public tweets from any account with no authentication crap (it's crap because it public data anyway) via API v1. But with API v1.1, it returns authentication error. It wants me to authenticate to fetch public data. Try to navigate this url. it shows ({"errors":[{"message":"Bad Authentication data","code":215}]});.

我的问题是有没有办法通过客户端 js 获取公共推文?我不想创建一个应用程序来获取公共数据.我不想使用 identi.ca 或其他,但 Twitter 逼我这样做.

My question is is there a way to fetch public tweets via client side js? I don't want to create an app to just fetch public data. I don't wan't to use identi.ca or else, but Twitter pushes me to do.

根据 Zachary Kinebel 对 Norguard 的回答的评论,我想,因为 Norguard 的评论可能对其他人有帮助,所以我应该把它放在这里:

Upon the comment of Zachary Kinebel to Norguard's answer, I thought, as a comment of Norguard's might be helpful to others, I should put it here:

/search.json?q=from:nerdswguitars === NerdsWGuitars 最近的推文 /search.json?q=to:nerdswguitars === 最近推文到NerdsWGuitars /search.json?q=from:nerdswguitarsto:nerdswguitars === 两者./search.json?q=@nerdswguitars === 涉及 NerdsWGuitars 的帖子./search.json?q=#nerdswithguitars === 发布趋势nerdswithguitars".但是您必须确保您正确地对查询进行了 URL 编码.在此处阅读更多信息:https://dev.twitter.com/docs/using-search,如果可以的话没有找到你正在寻找的东西,除此之外,你需要更加具体

/search.json?q=from:nerdswguitars === recent tweets by NerdsWGuitars /search.json?q=to:nerdswguitars === recent tweets to NerdsWGuitars /search.json?q=from:nerdswguitars OR to:nerdswguitars === both. /search.json?q=@nerdswguitars === posts involving NerdsWGuitars. /search.json?q=#nerdswithguitars === posts trending "nerdswithguitars". But you MUST make sure that you're properly URL encoding the query. Read more here: https://dev.twitter.com/docs/using-search and if you can't find what it is that you're looking for, out of this, then you need to be a lot more specific

推荐答案

EDIT

在充满糟糕想法的美妙世界中,Twitter 将在 2013 年 5 月取消此答案,并且至少需要您使用他们的一个小部件并将其硬塞进去,或者您设置一个应用程序并进行应用程序级身份验证,即使对于公共时间线 GET 请求也是如此.

如果他们改变主意,或者推迟投掷开关,这至少会继续存在.

If they change their mind, or delay the throwing of the switch, this will at least continue to be here.

使用搜索 API:

"http://search.twitter.com/search.json?q=nerdswguitars"

您可以在搜索词前使用 URL 编码的 #@.您还可以使用诸如 fromto 之类的关键字,并指定限制等.

You can use the URL-encoded # or @ in front of search terms. You can also use keywords like from or to, and specify limits, et cetera.

这篇关于通过 twitter api 1.1,通过客户端代码 (js) 获取公共推文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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