private void CompositionOriginal()
TotalPost = PostCollection.Count.ToString();
//var original = PostCollection.Where(temp => temp.Original == "ico ico_type_Original");
var original = PostCollection.Where(temp => temp.Original == "原");
Original = original.Count().ToString();
//var reprint = PostCollection.Where(temp => temp.Original == "ico ico_type_Translated");
var reprint = PostCollection.Where(temp => temp.Original == "转");
Reprint = reprint.Count().ToString();
//var translation = PostCollection.Where(temp => temp.Original == "ico ico_type_Repost");
var translation = PostCollection.Where(temp => temp.Original == "翻");
Translation = translation.Count().ToString();
private void ResponseCallBack(IAsyncResult result)
HttpWebRequest http = (HttpWebRequest) result.AsyncState;
WebResponse webResponse = http.EndGetResponse(result);
using (Stream stream = webResponse.GetResponseStream())
using (StreamReader read = new StreamReader(stream))
string content = read.ReadToEnd();
private async void UnEncoding(string content)
//<div id="article_list" class="contents">
//<div id="article_list" class="contents">[^[</div>\s+<!--显示分页-->]]+
new Regex("<div id=\"papelist\" class=\"pagelist\">\\s{0,}<span>\\s{0,}\\d+条\\s{0,}共(\\d+)页</span>");
//<div id="papelist" class="pagelist">
//<div id="papelist" class="pagelist">\s{0,}<span>\s{0,}\d+条\s{0,}共(\d+)页</span>
foreach (Match temp in regex.Matches(content))
_maxPage = int.Parse(temp.Groups[1].Value);
//<li>访问:<span>81372次</span></li>
//<li>积分:<span>2098</span> </li>
//<ul id="blog_rank">\s{0,}<li>\s{0,}访问:\s{0,}<span>(\d+)次</span>\s{0,}</li>
//\s{0,}<li>\s{0,}积分:\s{0,}<span>(\d+)</span>\s{0,}</li>
regex = new Regex("<ul id=\"blog_rank\">\\s{0,}<li>\\s{0,}访问:\\s{0,}<span>(\\d+)次</span>\\s{0,}</li>" +
"\\s{0,}<li>\\s{0,}积分:\\s{0,}<span>(\\d+)</span>\\s{0,}</li>");
foreach (Match temp in regex.Matches(content))
//_maxPage = int.Parse(temp.Groups[1].Value);
int total = int.Parse(temp.Groups[1].Value);
int integral = int.Parse(temp.Groups[2].Value);
Integral = integral.ToString();
if (!string.IsNullOrEmpty(TotalView) && TotalView != "0")
AddView = (total - int.Parse(TotalView)).ToString();
TotalView = total.ToString();
regex = new Regex(@"<div id=""article_list"" class=""contents"">([\w|\W]+)</div>\s+<!--显示分页-->");
//<div id="article_list" class="contents">([\w|\W]+)</div>\s+<!--显示分页-->
var match = regex.Matches(content);
foreach (Match temp in match)
content = temp.Groups[1].Value;
//<div class="list_item list_view">
//<div class="article_title">
//<span class="ico ico_type_Original"></span>
// <span class="link_title"><a href="/lindexi_gd/article/details/51344676">
//<div class="article_manage">
//<span class="link_postdate">2016-05-29 08:56</span>
//<span class="link_view" title="阅读次数"><a href="/lindexi_gd/article/details/51344676" title="阅读次数">阅读</a>(25)</span>
//<div class="list_item list_view">\s{0,}<div class="article_title">\s{0,}
//<span class="ico\s{0,}([\w|_]+)"></span>\s{0,}
//<h1>\s{0,}<span class="link_title"><a href="/([\w|_]+)/article/details/(\d+)">\s{0,}
//</div>\s{0,}<div class="article_manage">\s{0,}<span class="link_postdate">(\d+-\d+-\d+ \d+:\d+)</span>\s{0,}
//<span class="link_view" title="阅读次数"><a href="/[\w|_]+/article/details/\d+" title="阅读次数">阅读</a>\((\d+)\)</span>
"<div class=\"list_item list_view\">\\s{0,}<div class=\"article_title\">\\s{0,}<span class=\"ico\\s{0,}([\\w|_]+)\"></span>\\s{0,}" +
"<h1>\\s{0,}<span class=\"link_title\"><a href=\"/([\\w|_]+)/article/details/(\\d+)\">\\s{0,}" +
"(.+)\\s{0,}</a></span>" +
"</div>\\s{0,}<div class=\"article_manage\">\\s{0,}<span class=\"link_postdate\">(\\d+-\\d+-\\d+ \\d+:\\d+)</span>\\s{0,}" +
"<span class=\"link_view\" title=\"阅读次数\"><a href=\"/[\\w|_]+/article/details/\\d+\" title=\"阅读次数\">阅读</a>\\((\\d+)\\)</span>");
match = regex.Matches(content);
DateTime time = DateTime.Now;
//List<Post> post = match.Cast<Match>().Select(temp => new Post()
// Original = temp.Groups[1].Value,
// Url = "/" + temp.Groups[2].Value + "/article/details/" + temp.Groups[3].Value,
// Title = temp.Groups[4].Value.Replace("\r","").Replace("\n","").Trim(),
// Time = temp.Groups[5].Value,
// LinkView = temp.Groups[6].Value,
List<Post> post = new List<Post>();
foreach (Match temp in match)
var original = temp.Groups[1].Value;
var url = "/" + temp.Groups[2].Value + "/article/details/" + temp.Groups[3].Value;
var title = temp.Groups[4].Value.Replace("\r", "").Replace("\n", "").Trim();
var timePost = temp.Groups[5].Value;
var linkView = temp.Groups[6].Value;
if (original == "ico_type_Original")
else if (original == "ico_type_Translated")
await DispatcherPost(post);
//HttpClient client = new HttpClient()
// Timeout = new TimeSpan(1000)
private async Task DispatcherPost(IEnumerable<Post> post)
//var postTitle=PostCollection.Where(temp=>temp.Title==post.Title)
foreach (var temp in post)
await DispatcherPost(temp);
//await Window.Current.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
// foreach (var temp in post)
// PostCollection.Add(temp);
private async Task DispatcherPost(Post post)
var postTitle = PostCollection.Where(temp => temp.Title == post.Title);
var temp = postTitle.First();
//await Window.Current.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
// PostCollection.Add(post);
await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
PostCollection.Add(post);