0

So I was caught flat footed by the Twitter api Version1 retirement. And now I'm not sure how to move my apps from reading the old RSS/XML twitter feed to the new Json ( no experience with Json yet). Can someone help ? Here is the current code, that I need to change over to read the Twitter Json.

void TwitterStatusInformationCompleted(object sender, DownloadStringCompletedEventArgs e)
{
        LoadEventArgs loadedEventArgs = new LoadEventArgs();

        try
        {
            var doc = Newtonsoft.Json.(e.Result);


            foreach (var item in doc.Descendants("status"))
            {
                var model = new TwitterStatusModel()
                {
                    Date = item.Element("created_at").Value.Substring(0, item.Element("created_at").Value.IndexOf('+')),
                    Text = item.Element("text").Value,
                };
                TwitterFeed.Add(model);
            }

            loadedEventArgs.IsLoaded = true;
            loadedEventArgs.Message = "";
        }
        catch (Exception)
        {
            loadedEventArgs.IsLoaded = false;
            loadedEventArgs.Message = "unable to load twitter data";
        }
        finally
        {
            OnTwitterLoaded(loadedEventArgs);
        }

        TwitterFeed = null;
    }

Thanks for any help.

Denny Gay
  • 31
  • 5
  • what have you tried? What happens when you run this? What are the [view]model objects you're populating? – Matt Lacey Jun 12 '13 at 17:00
  • I just answered this along with providing links to sites that even provide you with the parsing code for the JSON: http://stackoverflow.com/questions/17049821/setting-up-twitter-api-getting-the-last-few-tweets/17057693#17057693 – Starboy Jun 12 '13 at 18:08
  • @MattLacey Twitter isn't accepting requests for XML or RSS feeds, which is what the code above does. This used to work before Twitter shut off XML and RSS feed last night 6-11-2013. Now I need to change this code over to parse the Json string that comes from Twitter. – Denny Gay Jun 12 '13 at 19:28
  • @Starboy does the link you provided to the other Stackoverflow question and the additional links, work with Windows Phone C#? I'm not familiar with the javascript and PHP stuff. – Denny Gay Jun 12 '13 at 19:38
  • for what its worth, I found this link that goes over a bunch of the Twitter api ver 1.1 explaations and examples. People are having issues with this. https://dev.twitter.com/docs/auth/oauth/single-user-with-examples – Denny Gay Jun 12 '13 at 19:54

0 Answers0