DEV Community

Cover image for Como listar los posts de un blog de Blogger en mi web
Carlos Alberto
Carlos Alberto

Posted on

2

Como listar los posts de un blog de Blogger en mi web

Para listar los posts de un blog de blogger usando un criterio de búsqueda se debe usar las API de JSON de blogger, aquí hay un código que me encontré que puede ser muy útil para todos los que lo necesiten

<html>
<body>
<div><ul id="postList12"></ul></div>
<script type="text/javascript">
    var startIndex = 1;
    var maxResults = 50;

    function sendQuery12()
    {
       var scpt = document.createElement("script");
       quer="Arboleda";
       quer=quer.toLowerCase();
       scpt.src = "http://elblogdenimu.blogspot.com/feeds/posts/default?q=label:"+quer+"&alt=json&callback=processPostList12&start-index=" + startIndex + "&max-results=" + maxResults;     
       document.body.appendChild(scpt);
    }

    function processPostList12(root)
    {
       var elmt = document.getElementById("postList12");
       if (!elmt)
          return;

       var feed = root.feed;

       if (feed.entry.length > 0)
       {
          for (var i = 0; i < feed.entry.length; i++)
          {
             var entry = feed.entry[i];
             var title = entry.title.$t;


             for (var j = 0; j < entry.link.length; j++)
             {
                if (entry.link[j].rel == "alternate")
                {
                   var url = entry.link[j].href;

                   if (url && url.length > 0 && title && title.length > 0)
                   {
                      var liE = document.createElement("li");

                      var a1E = document.createElement("a");
                      a1E.href = url;
                      //a1E.textContent = title+"  "+feed.entry.length;
                      a1E.textContent = title;

                      liE.appendChild(a1E);
                      elmt.appendChild(liE);
                   }

                   break;
                }
             }
          }

          if (feed.entry.length >= maxResults)
          {
             startIndex += maxResults;
             //sendQuery12();
          }
       }
    }

    sendQuery12();
</script>
</body>
</html>
Enter fullscreen mode Exit fullscreen mode

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more