Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twitter Feed API stopped working

Here is the following code I am using

<script src="http://widgets.twimg.com/j/2/widget.js"></script> 
    <script>
new TWTR.Widget({
  version: 2,
  type: 'profile',
  rpp: 4,
  interval: 3000,
  width: 'auto',
  height: 281,
  theme: {
    shell: {
      background: '#fff',
      color: '#3a589c'
    },
    tweets: {
      background: '#ffffff',
      color: '#000000',
      links: '#3a589c'
    }
  },
  features: { 
    scrollbar: false,
    loop: true,
    live: true,
    hashtags: true,
    timestamp: true,
    avatars: false,
    behavior: 'default'
  }
}).render().setUser(klatianstayahed).start();
</script> 

Where I am getting code error on http://widgets.twimg.com/j/2/widget.js follows.

TWTR=window.TWTR||{};(function(){var A=0;var D;var B=["init","setDimensions","setRpp","setFeatures","setTweetInterval","setBase","setList","setProfileImage","setTitle","setCaption","setFooterText","setTheme","byClass","render","removeEvents","clear","start","stop","pause","resume","destroy"];function C(H){var E=0;var G;var 

F=["The Twitter API v1.0 is deprecated, and this widget has ceased functioning.","You can replace it with a new, upgraded widget from ","For more information on alternative Twitter tools, see https://dev.twitter.com/docs/twitter-for-websites"];

if(!window.console){return }for(;G=F[E];E++){if(console.warn){console.warn("TWITTER WIDGET: "+G);continue}console.log(G)}}TWTR.Widget=function(E){switch(E.type){case"search":C("search?query="+escape(E.search));break;case"profile":this._profile=true;break;case"list":case"lists":C("list");break;default:return }};TWTR.Widget.ify={autoLink:function(){return{match:function(){return false}}}};TWTR.Widget.randomNumber=function(){};TWTR.Widget.prototype.isRunning=function(){return false};TWTR.Widget.prototype.setProfile=function(E){C("user?screen_name="+escape(E));return this};TWTR.Widget.prototype.setUser=function(E){if(this._profile){return this.setProfile(E)}C("favorites?screen_name="+escape(E));return this};TWTR.Widget.prototype.setSearch=function(E){C("search?query="+escape(E));return this};for(;D=B[A];A++){TWTR.Widget.prototype[D]=function(){return this}}})();

And I followed instruction from the URL

https://twitter.com/settings/widgets And https://dev.twitter.com/docs/embedded-timelines

But I am not getting the old look and many options got turned off like Auto scroll, I cant move Tweet from Header of that widget and put the Pic of the a/c on the twitter(It was on the old script I posted above). And most embarrasing thing is on below it is written Tweet to @klatianstayahed which I dislike the most and want to remove that option. Can any body help me to modify it and modify my old script as that old script will work, not the new one which is not I want. My requirement is to get the updated script of http://widgets.twimg.com/j/2/widget.js as it is obsoulate.

like image 888
Soumya Avatar asked Nov 02 '22 20:11

Soumya


1 Answers

The new twitter API 1.1 uses a Oath plugin. So there is a PHP code which I got from Github and entered the keys i got by registering an application on twitter.

Then I used the JSON generated by the PHP and formatted it using jQuery using another javascript...

This is the solution I got from here

This is the way that you really want to go as this is the only way you can tweak the way the tweets are displayed on your websites. The widget that twitter provides is really basic and besides the basic color and size options, you cannot alter the tweets. Now the example I have provided is a PHP script which authorizes your website with twitter and gets the tweets for you. There are other libraries available for ASP.net,Java, Python which can be found HERE.

What you dont want to use is a client only side script like javascript as in the new API 1.1 we use the 4 authentication keys and if you use javascript as the Oath tool because you would be exposing these 4 keys

like image 104
AnaMaria Avatar answered Nov 12 '22 19:11

AnaMaria