How would I pull ~20 latest statuses from user_timeline with API 1.1 without Oauth?

jeremykemper123
@jeremykemper123 jeremy kemper

So - I use to just do HTTP request and parse json:

https://api.twitter.com/1/statuses/user_timeline.json?screen_name=$name&count=$count&include_rts=1

Question

With API 1.1 - it looks like I'd have to register an APP and use Oauth authentication... - right? IS there a way to get last 20 statuses without using Oauth?

1 year 28 weeks ago

Replies

episod
@episod Taylor Singletary

You must use OAuth for all methods in API v1.1, including user timeline.

1 year 28 weeks ago
neilakapete
@neilakapete Neil Grimes

does this mean that I would have to create a fake APP just to be able to pull data from user timeline? And then if I wanted to roll out a website module for multiple sites where I would just be showing one or more tweets I could potentially run into a problem where my OAuth data is being used too many times?

Any good links to php curl implementation of the v1.1 user_timeline?

1 year 28 weeks ago
episod
@episod Taylor Singletary

The app would not be "fake" -- the app exists, the app is your website. The app record you create to get an API key with Twitter represents your application, your website.

https://github.com/themattharris/tmhOAuth works well with API v1 and v1.1 and OAuth.

1 year 27 weeks ago
neilakapete
@neilakapete Neil Grimes

But if I am generically making this a module available to many people who use my CMS then it would be from their website not mine?

1 year 27 weeks ago
episod
@episod Taylor Singletary

In that case, you would ask those users to register an application and enter their keys when configuring their module. Or accept the responsibility of distributing your API keys with the module, which is discouraged but not outright prohibited by our TOS.

1 year 27 weeks ago
xxorax
@xxorax xorax

It's just crazy to make it server-side with Oauth for PUBLIC timeline.

All sites on github with remove their twetter features, and probably many others not have the time to implement your changes.

So this will be the end of on-site implementation, until some services to do it instead of you.

1 year 25 weeks ago
mypoi
@mypoi MyPoi World

I have to agree with xorax. Totally useless to require authentication for a public time line.

I guess this makes the v1.1 api more a pain in the ass than an improvement.

45 weeks 1 day ago
testwitto
@testwitto testwitto

Agreed, seriously what is Twitter thinking about... Who the hell do they think they are?

44 weeks 6 days ago
WW_webdev
@WW_webdev Wall-to-Wall Devs

I mean it is still a free service & open for developers... just a few more hoops to jump through is all. I have a feeling this has a lot to do with found security flaws & possibly even twitter trying to lessen the capability of people viewing tweets without actually being on twitter.

44 weeks 2 days ago
myurr
@myurr Chris Mellish

@WW_webdev - more likely, in my view, it's just the first step in a long process towards charging for api access. By authenticating everyone they can track per user who is using the API. There are already call volume and concurrency limits on the API on a per account (and per IP address) basis with the option to pay to increase those limits. There are quite a few big data mining companies out there who pay Twitter a lot of money for all this information that they want to monetise in turn. Having free access to the API undermines that entire business model for both twitter and their partners.

In time expect those rate and concurrency limits to be reduced and cheaper access plans or official partnerships to be announced if you need entry level access to that data. It sucks but Twitter do need to monetise their service if they are to stay in business and this is one of the ways they'll use. I just wish they were more open about their long term plans for the API and app ecosystem. Fortunately in time a more open competitor will come along, but until then we're stuck with OAuth for all.

43 weeks 2 days ago
ClinicMattersTV
@ClinicMattersTV Clinic Matters

that is if they implemented the oAuth api correctly. it does not work like everyone else does

41 weeks 2 days ago
lurchpop
@lurchpop lurch pop

It really sucks you're doing this.

44 weeks 4 days ago
vrnarencse
@vrnarencse hAndsome

pls explain me how to get latest 100 tweets from twitter

33 weeks 3 days ago
jabranr
@jabranr Jabran Rafique

There you go. Small and easy to use PHP methods to fetch tweets. This code uses the application-only authorization model. http://jabran.me/fetch-tweets-with-twitter-api-v1-1/ Cheers

27 weeks 5 days ago
applecado
@applecado Alex Ball

What a pain - I am in the exact situation as Neilakapete - we used the XML pages within a CMS, where the site owner can enter their screen name and it would pull their tweets onto the homepage. Now that's not going to be so easy... without any benefit?

Ergh.

1 year 27 weeks ago
SBTDev
@SBTDev SBTDev

In the same boat here. I have an app that used the exact same command as the OP, albeit in XML instead of JSON, and parsed for the latest tweet with a regexp. No OAuth or anything else. App is written in PHP.

The docs aren't exactly clear (at least to me) on what I need either.

The docs say user_timeline now needs a "user context", which I take to mean "user needs to give permission, then my app works as if it were them" to make the fetch. The whole point of my app (a forum sigbar image generator) was to enter a feed name, including ones the users of my app don't own and have the latest tweet shown on your image.

Is there a way to do this now? Does a user context need to be the user whose timeline I want (i.e. do I need ABC's user context to read ABC's public timeline, or can I use DEF's context to read ABC's public timeline)? Could this account make the requests for all users on my system?

I know I need to add the authentication code, but exactly what do I need?

1 year 27 weeks ago
episod
@episod Taylor Singletary

We make single-user use cases easy around here. See Single-user OAuth with Examples for some overview information. When you create an application on dev.twitter.com/apps you can also generate an access token that represents your account's relationship with your application -- without having to go through the web-based OAuth flow to negotiate it.

You can then skip all those steps around acquiring request tokens and access tokens and jump right to the point where you use the combination of your API keys & secrets and the access token & secret to make signed requests to Twitter on your own behalf.

Once you have the four pieces of information you need, you can plug them easily into code such as this from tmhOAuth:

  1. require '../tmhOAuth.php';
  2. require '../tmhUtilities.php';
  3. $tmhOAuth = new tmhOAuth(array(
  4.   'consumer_key'    => 'YOUR_CONSUMER_KEY',
  5.   'consumer_secret' => 'YOUR_CONSUMER_SECRET',
  6.   'user_token'      => 'A_USER_TOKEN',
  7.   'user_secret'     => 'A_USER_SECRET',
  8. ));
  9.  
  10. $code = $tmhOAuth->request('GET', $tmhOAuth->url('1.1/statuses/user_timeline'), array(
  11.   'screen_name' => 'SBTDev'));
  12. $response = $tmhOAuth->response;
1 year 27 weeks ago
SBTDev
@SBTDev SBTDev

Thanks for that link to the single user oAuth page and the code. That's almost exactly what I was looking for.

I'll try it out later today when I get the chance to look at my program. :)

1 year 27 weeks ago
thelinden
@thelinden Barry Walsh

I'm trying to use this method but it seems to be really buggy with 1.1. Sometimes it works but more times than not it times out.

1 year 1 week ago
sourabh_bajaj
@sourabh_bajaj sourabh bajaj

Where can I get those included files?? tmhOAuth.php and tmhUtilities.php????

49 weeks 4 days ago
lampmichael
@lampmichael Michael Hodgins

https://github.com/themattharris/tmhOAuth

49 weeks 3 days ago
garethdweaver
@garethdweaver Gareth Weaver

Check out this example for streaming tweets:
https://github.com/themattharris/tmhOAuth-examples/blob/master/userstream.php

Also here is seaofclouds jquery twitter modded plugin using tmhOAuth:
https://github.com/StanScates/Tweet.js-Mod

45 weeks 1 hour ago
SherDot
@SherDot Miss Sher

do you have javscript examples?

43 weeks 6 days ago
greenmoon
@greenmoon Green Moon Solutions

twitterizer is no longer supported and uses API 1.0

43 weeks 1 day ago
n8ji
@n8ji Nate Ghostman

You're telling me if I want to retrieve the latest tweet for each of a handful of users, I need to a create a twitter application and hard code a single user account's token and secret to sign every request?

Why would you force authentication to retrieve publicly available data?

What about static sites without a backend? Are they now forced to use Twitter's embedded timeline? And the Twitter Search API will be behind authentication? And the 1.1 documentation isn't even complete yet? And the "userless" application-only authentication may or may not be available in a few weeks? What? Why?

1 year 27 weeks ago
SBTDev
@SBTDev SBTDev

I wondered the same thing. Public info shouldn't need authentication IMO.

Anyway, the code that @episod posted above works perfectly. After that, just modify line 10 to make the appropriate request.

It really only needs a single user token (your account's token from the bottom of the application page) to fetch all of your users' timelines.

1 year 27 weeks ago
ChoochFTW
@ChoochFTW Chooch FTW

I'm lost in translation a bit here.

The array that $response = $tmhOAuth->response; returns, what part of that is my actual status?

What do I need aside from those two PHP files, configured correctly, to echo or print the latest status from my timeline? Many thanks.

1 year 27 weeks ago
kappacreative
@kappacreative kappa creative

"We make single-user use cases easy around here...
...Once you have the four pieces of information you need..."

I'm a web designer and developer, and I'm not able to update the code on some of my previous web projects.

user_timeline.json is a very useful feature to generate very simple embedded timelines, able to be styled via CSS, but continued updates to the twitter API keep "breaking" it. Why is this not clearly explained in the Documentation? I had to do some creative google searching to even find out how to update it to work with the 1.0 API. What happened to "future-proof" coding practices?

I really don't want to be forced to register an App for each website I build, or distribute my personal authorization code to others. Please elaborate as to how this would be easily configured for multiple projects.

Apologies for hijacking this thread, but it is very relevant to my questions, and it seems as a few others here are asking the same thing.

"Why would you force authentication to retrieve publicly available data?"

1 year 22 weeks ago
Timesheep
@Timesheep Steen

I was thinking the exact same thing.
I don't know how many times I visited the page for the public timeline method and thought "Authentication to get a public timeline? This can't be right?"

If it's just for rate limiting, why not just use IPs?

1 year 16 weeks ago
CreativityKills
@CreativityKills CreativityKills

Its truly and honestly not right to have to authenticate to retrieve publicly available data.

1 year 11 weeks ago
anguslucas
@anguslucas Angus Lucas

edit:

1 year 8 weeks ago
MugenBatteries
@MugenBatteries Mugen Power

Guys, read this - great article on this subject and explains the way to Auth via Php while still being able to run jQuery
http://www.tom-elliott.net/php/authenticating-twitter-feed-timeline-oauth/

1 year 7 weeks ago
MitchellMorris
@MitchellMorris Mitchell Morris

THANK YOU THANK YOU THANK YOU!

31 weeks 18 hours ago
Pazuzu156
@Pazuzu156 Kaleb Klein

This is absolutely outrageous to use authentication to get tweets....with that said I used this with PHP and it worked. My question here is, how do I translate this into Java?

1 year 7 weeks ago
Multipool
@Multipool Multipool

This is ridiculous. Guess I'll start using G+ instead of twitter for my site news.

45 weeks 2 days ago
UKFB_Org
@UKFB_Org Builders Federation

So, at the min on our site we are using api v1.0 which has now ceased to work... we were using: http://api.twitter.com/1/statuses/user_timeline.json?screen_name=ukfb_Org&include_rts=true&count=3&callback=twitterCallback2

With a bit of Javascript:

just to retreive tweets and display them on the site, simple stuff.

Can anyone please explain to me how to get the same method to work, using apiv1.1 as I have tried the suggested methods on Twitter and I can't get them to work. :)

45 weeks 1 day ago
episod
@episod Taylor Singletary

This kind of simple stuff that didn't use to require authentication is now much more difficult in client-side Javascript. We offer Embedded Timelines as a means to put timelines on your website.

45 weeks 1 day ago
benpalmer
@benpalmer Ben Palmer

Embedded Timelines aren't very flexible when adding to a site, should i be creating apps through my developer account for all my clients' websites? Or should i be requested their twitter account logins and create the app through them?

45 weeks 1 day ago
lurchpop
@lurchpop lurch pop

exactly the situation i'm in. I have big movie studio clients that I don't feel comfortable creating apps that're tied to my twitter account where i occasionally rant & rave about politics. So now i have to create a new account, set up a server stack with caching to do oAuth -- THEN i can make my little customized twitter widget.

I notice now even with the embedded timeline, their out-of the box widget, I still have to attach something to my account. freakin lame!

44 weeks 4 days ago
rmgallery
@rmgallery Rich Media Gallery

I just want to pull in my latest tweet!

45 weeks 22 hours ago
niteshluharuka
@niteshluharuka Nitesh Luharuka

The problem with embedded timelines is that we will need to ask every user to go and create a widget from their account and then provide us with the code. We offer a system where the client enters the username and his timeline is shown (assuming it is a public timeline). Now, what options do we have apart from asking them to create a widget or create an app specific to each user?

Another question - Creating an app requires a website name, can i enter same website name for multiple apps?

45 weeks 1 day ago
benward
@benward Ben Ward

Embedded Timelines now has a feature to dynamically specify timeline sources, so you can register a single timeline for use in your system and then provider the username as required: https://dev.twitter.com/docs/embedded-timelines#timeline-selection

Ben

45 weeks 1 day ago
lurchpop
@lurchpop lurch pop

Why is it required to "register" a timeline in the first place? Were people abusing your widgets or something?

44 weeks 4 days ago
AZOMITE
@AZOMITE AZOMITE

@MugenBatteries Thank you I'm crying here. Our dev's twitter.php is not working with all the crazy customer and what not codes we generated for our fictitious twitter app. I oh-so hope the webdevdoor info works. I'm getting tired....

This really is super-stupid for publicly retrieved info. What does @Twitter get out of this enormous painful-to-user change?

45 weeks 1 day ago
US4Palin
@US4Palin US4Palin -Ron Devito

I just want to convert a timeline to an RSS without doing scripting and programming, etc. Whatever is done has to ultimately be in RSS. Does someone have information on how to do do this?

45 weeks 1 day ago
Modi341
@Modi341 Oleg Buylov

its so stupid...

45 weeks 1 day ago
glowong
@glowong ▬►Gillian Lo-Wong◄▬

I'm just as disappointed about this as everyone else. How can Twitter just 'retire' 1.0 API? What ever happened to backwards compatibility? All those applications and developers who are working with 1.0 API will now have to stress and refactor their code to make it work with the next level API.

Twitter should take an example of Google. They have 3 API versions and all of them are still working for backwards-compatability's sake.

Anyway, whoever can coop with the liability of Twitter's client-side widgets (bad liability is one of the reasons why I'm using API's) can create a widget here:

https://twitter.com/settings/widgets/new/user

45 weeks 1 day ago
sneakyfildy
@sneakyfildy sneakyfildy

pain in ass, really. Wierd! Shitty docs, no tutorials, examples. Just auth for public info. Again - WIERD and stupid! Spent 3 hours alrdy, no luck with this crap.

45 weeks 1 day ago
sneakyfildy
@sneakyfildy sneakyfildy

Can twitter please tell, how the f get tweets of another user.
All i get is {"errors":[{"message":"Could not authenticate you","code":32}]}
For my twits, it's okay. Do not point me for some crappy semi-working junk on github, show real working example with PHP.

I'm trying to use this http://stackoverflow.com/questions/12916539/simplest-php-example-retrieving-user-timeline-with-twitter-api-version-1-1

45 weeks 1 day ago
PawanMadhesiya
@PawanMadhesiya pawan madhesiya

How to implement twitter feed version 1.1 in asp.net???

45 weeks 1 day ago