Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Chris Brown 6 posts 26 karma points
    Jul 01, 2013 @ 11:51
    Chris Brown
    0

    Twitter API deprication breaking latest posts list

    Hi everyone,

    I am new to the Umbraco forum and was wondering if anybody could help me. Since Twitter depricated the 'API v1.0. Retirement of Basic Auth support' a number of our websites have stopped displaying the latest Twitter posts. I get the message 'Problem connecting to Twitter for data'. We have used uTwit for our newer websites but we still have a number of websites using Umbraco versions not compatible with uTwit namely <4.5

    Can anybody suggest an XSLT solution to display the lastest Twitter posts using the new API?

    Thanks for your help!

    Chris

  • Dan Patching 31 posts 158 karma points c-trib
    Jul 01, 2013 @ 13:23
    Dan Patching
    0

    Hi Chris,

    I made a class to handle OAuth authentication and grabbing Twitter timelines with the 1.1 API.

    Maybe it is useful to you. There is an example project to demonstrate how to use it in code.

    https://github.com/OptimisticCoder/TwitterAPI

    I hope that helps.

    Dan

  • Chris Brown 6 posts 26 karma points
    Jul 01, 2013 @ 15:33
    Chris Brown
    0

    Hi Dan,

    Thanks for getting back to me. I will take a look and see if we can use your code to fix the oAuth authentication issue.  My colleague Ismail Mayat is also looking into maybe using the uTwit source code and modifiying it to work with .net 2.0 so I will keep you posted on this!

    Chris

  • Dan Patching 31 posts 158 karma points c-trib
    Jul 01, 2013 @ 16:48
    Dan Patching
    0

    Awesome! Good luck!

    Something else to bear in mind with Twitter, is it's down or slow a lot. So loading timelines server side can slow things down on the site.

    The simplest way to get around that is call the Twitter timeline code from a web service or WCF service (web service is easier) and consume that from client side javascript. This way, hits on Twitter are done after the rest of the page has loaded so there's no performance hit.

    I haven't used uTwit, but if it handles that issue it's probably a better option for you.

    Dan

  • Comment author was deleted

    Jul 01, 2013 @ 16:55

    @dan The profile manager (use Twitter image) is broke too.  I tried to fix on GitHub but found they don't do anon request anymore.  I'm gonna use your oAuth code one day.

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Jul 04, 2013 @ 18:15
    Ismail Mayat
    0

    Dan,

    Im using your oauth code keep getting 401 un authorised. The oauth header looks fine have definately checked correct values are being passed through. One thing to note I have made a few modifictions to the code so its compiling out as .net2 dll and for the moment im returning in get time line a string eventually will load into XmlDocument then return back xpath iterator. I am basically creating dll that i can use with xslt extensions of older umbraco versions that we cannot upgrade.

    Any ideas?

    Many thanks

    Ismail

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Jul 04, 2013 @ 19:08
    Ismail Mayat
    0

    Dan,

    Found another article on code project using code from that and that works. Also i had to go back to json as xml is no longer supported.

  • Dan Patching 31 posts 158 karma points c-trib
    Jul 04, 2013 @ 19:15
    Dan Patching
    0

    Hi Ismail,

    I've just used the class for a client, and I found the constructor arguments are the wrong way round in the example.

    If you use what intellisense tells you it should work fine.

    I'll get the repo updated now oops.

    The class is dependent on Newtonsoft.Json to deserialize into objects.

    Give me a shout if you are still using it and having problems.

     

    Dan

  • Dan Patching 31 posts 158 karma points c-trib
    Jul 04, 2013 @ 20:24
    Dan Patching
    0

    The repo is updated and tested in GitHub now.

    You just need to change line 24

                var twitter = new TwitterAPI.Tweet("[YourConsumerKey]",
                                                   "[YourConsumerSecret]",
                                                   "[YourAccessToken]",
                                                   "[YourAccessTokenSecret]");

    and line 36

                var tweets = twitter.GetTimeline("[YourAPICallUrl]");

    of the example, and the console will give you a bunch of tweets.

    https://github.com/OptimisticCoder/TwitterAPI

  • Dan Patching 31 posts 158 karma points c-trib
    Jul 05, 2013 @ 00:53
    Dan Patching
    0

    I got a bit carried away and added a web service and made it into a package.

    https://github.com/OptimisticCoder/TwitterAPI/tree/master/Umbraco%20Package

    Hopefully that makes things easier :D

  • Chris Brown 6 posts 26 karma points
    Jul 05, 2013 @ 08:58
    Chris Brown
    0

    Thanks for all of your help Dan! We will give your package a try!

    Chris

Please Sign in or register to post replies

Write your reply to:

Draft