Last active
August 29, 2015 14:12
-
-
Save chrismrgn/e80b1be27ec466288c5e to your computer and use it in GitHub Desktop.
BoldItalicTweeter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
//Get Articles | |
string url = @"http://www.thebolditalic.com/articles.rss?page={0}"; | |
var credentials = TwitterCredentials.CreateCredentials("Access_Token", "Access_Token_Secret", "Consumer_Key", "Consumer_Secret"); | |
int count = 0; | |
int loop = 0; | |
for (int i = 1; i < 200; i++) | |
{ | |
XmlReader reader = XmlReader.Create(string.Format(url, i)); | |
SyndicationFeed feed = SyndicationFeed.Load(reader); | |
reader.Close(); | |
count = count + feed.Items.Count(x => x.PublishDate.Year == 2014); | |
foreach (SyndicationItem item in feed.Items.Where(x => x.PublishDate.Year == 2014)) | |
{ | |
Console.WriteLine(string.Format("{0} - {1} - {2}", item.Title.Text, item.PublishDate.ToString(), item.Id)); | |
if (loop == 0) | |
{ | |
TwitterCredentials.ExecuteOperationWithCredentials(credentials, () => | |
{ | |
Tweet.PublishTweet(string.Format("I really want to go to #Hawaii #SendMeToHawaiiTBI {0}", item.Id)); | |
}); | |
} | |
loop++; | |
} | |
} | |
Console.ReadKey(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment