0

I'm trying to get the Twitter Tweets inside of a page using jQuery. I have registered a widget for the timeline. If you type in https://cdn.syndication.twimg.com/widgets/timelines/ with the widget-id than you get an json file. How can I cache it and display it with jquery on my website?

Thanx in Advance Dietmar

Dietmar
  • 21
  • 2

1 Answers1

0

Assuming you are referring to a client side cache, you can use something like AmplifyJS (http://amplifyjs.com/api/store/). If you want to cache it on the server side, it depends on what server side technology you are using.

If you want more info on how to parse the twitter JSON, then it has been answered on other questions on SO (eg: Parsing Twitter Json text using Javascript).

Community
  • 1
  • 1
Madhan Dennis
  • 400
  • 1
  • 4
  • Hi,thanx for the quick reply. But unfortunally if you calling the url mentioned above you get something in return like this: {"body":"\u003Cdiv class=\"root timeline ltr customisable-border... I guess this is the content of the iframe created by Twitter. I just dont know how to get this into proper html back again on my html-site... – Dietmar Nov 11 '13 at 09:23
  • Is it mandatory for you to use that URL? Do you have access to the original feed URL? Maybe if you can explain your scenario a bit more, I can help think of an workable solution for you. Cheers – Madhan Dennis Nov 11 '13 at 09:28
  • I am guessing you want to be able to pull feeds without authentication and since twitter 1.1 no longer allows that you are trying to use the widget and pull out the data it sends back. This will be quite painful and if you do not want to setup a twitter app to do this authentication for you, I would recommend using a proxy such as http://www.supertweet.net/. However do keep in mind that such proxies are run by volunteers, etc and are not endorsed by Twitter. So do keep that in mind. – Madhan Dennis Nov 11 '13 at 09:35
  • I want to display a certain Twitter timeline inside a Facebook app. And that's the problem: because the new Twitter - API only delivers the timeline as an iframe. And a Facebook app resides inside an iframe: So an iframe inside an iframe is a very bad idea. Also I need this URL because this URL has no refresh limits (I think). Any other URL you can call for Twitter timelines have a maximum of 15 calls within 15 minutes. – Dietmar Nov 11 '13 at 09:40
  • It isn't quite painful. I have managed to get the json output on my site if I copy the content of the url into my jquery script. It only doesn't work if I try to get the json content from the remote url. – Dietmar Nov 11 '13 at 09:48
  • Will it be possible to put up a test code @ jsfiddle? That might be easier for me to see where the issue is. – Madhan Dennis Nov 11 '13 at 10:20
  • This is the output URL from Twitter: https://cdn.syndication.twimg.com/widgets/timelines/362461688643084288 I tried to get it on an average html page with no success... – Dietmar Nov 11 '13 at 10:51
  • I think you are having JSONP issues. Can you check if the solution in this SO thread works for you? http://stackoverflow.com/questions/12390398/getting-latest-tweets-with-api-1-1 – Madhan Dennis Nov 11 '13 at 11:50