' Google Blog Article List 0.6 ' Copyright © 2014-2025 Nonki Takahashi. The MIT License. ' Last update 2025-06-21 ' Program ID PLT187-2 ' TextWindow.Title = "Google Blog Article List 0.6" Not = "False=True;True=False;" LT = "<" site = "https://nonkit.blogspot.jp/" eob = "False" ' end of blog first = "True" classH3 = "tag=h3;class=post-title;" nextH3 = "tag=h3;class=post-title entry-title;" nArticle = 0 stdout = Program.Directory + "/list.html" File.WriteContents(stdout, LT + "!DOCTYPE html>") File.AppendContents(stdout, LT + "html lang='en'>") File.AppendContents(stdout, LT + "head>") File.AppendContents(stdout, LT + "meta charset='UTF-8'>") File.AppendContents(stdout, LT + "title>Nonkit Blog - Table of Contents" + LT + "/title>") File.AppendContents(stdout, LT + "/head>") File.AppendContents(stdout, LT + "body>") dateLast = "" While Not[eob] TextWindow.WriteLine(site) buf = Network.GetWebPageContents(site) pNotFound = Text.GetLength(buf) + 1 p = 1 eod = "False" While Not[eod] param = "tag=time;class=published;" FindTag() pTime = pNotFound If tag <> "" Then pTime = p GetAttrAndText() date = txt If date <> dateLast Then If dateLast <> "" Then File.AppendContents(stdout, LT + "/ul>") EndIf File.AppendContents(stdout, LT + "p>" + date + LT + "/p>") File.AppendContents(stdout, LT + "ul>") dateLast = date EndIf EndIf param = classH3 FindTag() If first Then first = "False" classH3 = nextH3 EndIf pH3 = pNotFound If tag <> "" Then pH3 = p bufSave = buf p = 1 buf = tag param = "tag=a;" FindTag() GetAttrAndText() href = attr["href"] title = txt buf = bufSave p = pH3 param = "tag=time;" FindTag() GetAttrAndText() File.AppendContents(stdout, LT + "li>" + LT + "a href='" + href + "'>" + title + LT + "/a>" + LT + "/li>") nArticle = nArticle + 1 EndIf If pTime = pNotFound And pH3 = pNotFound Then eod = "True" EndIf EndWhile param = "tag=a;class=blog-pager-older-link;" FindTag() If tag = "" Then eob = "True" Else GetAttrAndText() site = attr["href"] EndIf EndWhile File.AppendContents(stdout, LT + "/ul>") File.AppendContents(stdout, LT + "p>Total " + nArticle + " articles." + LT + "/p>") File.AppendContents(stdout, LT + "/body>") File.AppendContents(stdout, LT + "/html>") Sub FindTag ' find tag from html buffer ' param["tag"] - tag name ' param["class"] - class name ' param p - pointer for buffer ' param buf - html buffer ' return tag - found tag pSave = p tag = "" findNext = "True" While findNext findNext = "False" ' tag may be not found pTag = Text.GetIndexOf(Text.GetSubTextToEnd(buf, p), LT + param["tag"]) If 0 < pTag Then lTag = Text.GetLength(param["tag"]) + 1 pTag = p + pTag - 1 len = Text.GetIndexOf(Text.GetSubTextToEnd(buf, pTag), "/" + param["tag"] + ">") If param["class"] = "" Then len = len + lTag tag = Text.GetSubText(buf, pTag, len) findNext = "False" ' found the tag ElseIf 0 < len Then findNext = "True" ' tag may have different class len = len + lTag attr = "class=" + "'" + param["class"] + "'" pAttr = pTag + lTag + 1 lAttr = Text.GetLength(attr) If Text.GetSubText(buf, pAttr, lAttr) = attr Then tag = Text.GetSubText(buf, pTag, len) findNext = "False" ' found the tag EndIf p = pTag + len EndIf EndIf EndWhile If tag = "" Then p = pSave EndIf EndSub Sub GetAttrAndText ' get attributes and text from given tag ' param tag - given tag ' return attr[] - array of attributes in the tag ' return txt - text in the tag pTag = Text.GetIndexOf(tag, " ") + 1 pEnd = Text.GetIndexOf(tag, ">") attr = "" While pTag <= pEnd pEq = Text.GetIndexOf(Text.GetSubTextToEnd(tag, pTag), "=") If 0 < pEq Then pEq = pTag + pEq - 1 If Text.GetSubText(tag, pEq + 1, 1) = "'" Then pQ = Text.GetIndexOf(Text.GetSubTextToEnd(tag, pEq + 2), "'") If 0 < pQ Then pQ = pEq + 2 + pQ - 1 attr[Text.GetSubText(tag, pTag, pEq - pTag)] = Text.GetSubText(tag, pEq + 2, pQ - pEq - 2) pTag = pQ + 2 EndIf EndIf Else pTag = pEnd + 1 EndIf EndWhile If pEnd + 1 < pTag Then pTag = pEnd + 1 EndIf len = Text.GetLength(tag) txt = "" While pTag <= len pL = Text.GetIndexOf(Text.GetSubTextToEnd(tag, pTag), LT) If pL = 0 Then txt = Text.Append(txt, Text.GetSubTextToEnd(tag, pTag)) pTag = len + 1 Else pL = pTag + pL - 1 txt = Text.Append(txt, Text.GetSubText(tag, pTag, pL - pTag)) pR = Text.GetIndexOf(Text.GetSubTextToEnd(tag, pTag), ">") If 0 < pR Then pTag = pTag + pR Else pTag = len + 1 EndIf EndIf EndWhile EndSub