Ejemplo n.º 1
0
        public List <RssWithUrl> PostsFromReadability(List <RssModel> feedPosts)
        {
            var postsWithReadability = new List <RssWithUrl>();

            foreach (var item in feedPosts)
            {
                var rssWithUrl = new RssWithUrl(item, readerService.GetParsingUrl(item.Link));
                rssWithUrl.ParsedJson = readerService.GetParsedJson(rssWithUrl.RequestUrl);
                if (rssWithUrl.ParsedJson == null)
                {
                    return(null);
                }
                postsWithReadability.Add(rssWithUrl);
            }
            return(postsWithReadability);
        }
Ejemplo n.º 2
0
        public void MakeNewPost(RssWithUrl postData)
        {
            var newPost = new Post
            {
                Title           = postData.ParsedJson.Title,
                PublishDateTime = DateTime.Parse(postData.RssModel.PubDate),
                Content         = postData.ParsedJson.Content + "<p>" + "<a href =\"" + postData.RssModel.Link + "\">" + "To original site.." + "</a></p>",
                Terms           = GetRssCategory(),
                PostType        = "post",
                Status          = "publish"
            };

            using (var client = new WordPressClient(config))
            {
                client.NewPost(newPost);
            }
        }