OSDN Git Service

下書きの実装完了
[futonwriter/old_trunk.git] / HatenaDiaryClient / Models / Hatena / BlogEntry.cs
index abfaf7f..19ce6a4 100644 (file)
@@ -1,7 +1,5 @@
 using System;
-using System.Collections.Generic;
 using System.Linq;
-using System.Text;
 using System.Text.RegularExpressions;
 using System.Xml.Linq;
 
@@ -29,7 +27,13 @@ namespace Azyobuzi.HatenaDiaryClient.Models.Hatena
             this.HatenaSyntax = xml.Elements(XmlNamespaces.HatenaNs + "syntax")
                 .Select(_ => _.Value)
                 .SingleOrDefault();
-            this.DateId = Regex.Match(this.BlogPage, @"\d+/\d+$").ToString();
+            this.DateId = Regex.Match(
+                xml.Elements(XmlNamespaces.Atom + "link")
+                    .Where(_ => _.Attribute("rel").Value == "edit")
+                    .Select(_ => _.Attribute("href").Value)
+                    .First(),
+                @"(\d+/\d+|\d+)$"
+            ).ToString();
         }
     }
 }