public StringBuilder GetHTML(string feedUrl, string username, string password) { // Authenticate. string auth = ClientLogin.GetAuthToken("reader", username, password, "Sandworks.Google.App"); // Query. using (GoogleSession session = new GoogleSession(auth)) { DateTime d = new DateTime(2011, 12, 25); var feed = session.GetFeed("http://www.google.com/reader/atom/user/-/state/com.google/starred", new GoogleParameter("n", "200"), new GoogleParameter("ot", session.GetUnixTimeNow().ToString())); foreach (var item in feed.Items) { //Console.WriteLine("Author: " + item.Authors[0].Name); //Console.WriteLine("Link: " + item.Links[0].Uri); //Console.WriteLine("Title: " + item.Title.Text); //Console.WriteLine(); } } return new StringBuilder("suman"); }
private void button1_Click(object sender, EventArgs e) { // Authenticate. string auth = ClientLogin.GetAuthToken("reader", tbUserName.Text, tbPassword.Text, "Sandworks.Google.App"); // Query. using (GoogleSession session = new GoogleSession(auth)) { long unixTime = session.GetUnixTimeNow(); TimeSpan startTimeDiffenceFromNow = DateTime.UtcNow - dtStarredAfter.Value.ToUniversalTime(); long starredItemsSinceTime = unixTime - (long)startTimeDiffenceFromNow.TotalSeconds; var feed = session.GetFeed(tbFeedUrl.Text, new GoogleParameter("n", tbLinkCount.Text) ,new GoogleParameter("ot", starredItemsSinceTime.ToString()) ); knownCategories = tbKnownCategories.Text.Split(','); for (int i = 0; i < knownCategories.Length; i++) knownCategories[i] = knownCategories[i].Trim(); foreach (var item in feed.Items) { string matchedCategory = string.Empty; foreach (SyndicationCategory category in item.Categories) { matchedCategory = knownCategories.FirstOrDefault(cat => cat.Equals(category.Label, StringComparison.InvariantCultureIgnoreCase)); if (!string.IsNullOrEmpty(matchedCategory)) break; } bool isCategorized = !string.IsNullOrEmpty(matchedCategory); Links.Add(new Link { Title = item.Title.Text, AuthorName = item.Authors[0].Name, HyperLink = item.Links[0].Uri.ToString(), Category = matchedCategory?? string.Empty, IsCategorized = isCategorized }); } } BuildContent(); DialogResult = DialogResult.OK; Dispose(); }