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

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

问题描述

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



我可以从没有认证废话的任何帐户获取公共推文(因为公共数据无论如何都是垃圾)通过API v1。但是使用API​​ v1.1,它会返回身份验证错误。它希望我进行身份验证以获取公共数据。尝试浏览网址。它显示({errors:[{message:Bad Authentication data,code:215}]});



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






我认为,Zachary Kinebel对Norguard的答案的评论,作为对Norguard的评论可能对其他人有帮助,我应该把它放在这里:






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

解决方案

编辑



在糟糕的创意世界中,截至2013年5月,Twitter正在落后于这个答案,至少需要您使用其中一个小部件,并将其装入其中,或者您设置应用程序并执行应用程序级身份验证,即使对于公共时间线 GET b

如果他们改变主意,或延迟投掷开关,这至少会继续在这里。






使用搜索API:

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

你可以使用网址编码 @ 搜索条件。您还可以使用之类的关键字,并指定限制等等。


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.

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}]});.

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.


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 === 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

In the wonderful world of bad ideas, Twitter is sunsetting this answer, as of May 2013, and will require, at minimum, that you either use one of their widgets, and shoehorn it in, or that you set up an application and do application-level authentication, even for public-timeline GET requests.

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


Use the Search API:

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

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天全站免登陆