title: Get all images from a board from a Pinterest web address
body: <p>This question sounds easy, but it is not as simple as it sounds.</p>
  
  <p><strong>Brief summary of what's wrong</strong></p>
  
  <p>For an example, use this board; <a href="http://pinterest.com/dodo/web-designui-and-mobile/" rel="noreferrer">http://pinterest.com/dodo/web-designui-and-mobile/</a></p>
  
  <p>Examining the HTML for the board itself (inside the <code>div</code> with the class <code>GridItems</code>) at the top of the page yields:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;div class="variableHeightLayout padItems GridItems Module centeredWithinWrapper" style=".."&gt;
      &lt;!-- First div with a displayed board image --&gt;
      &lt;div class="item" style="top: 0px; left: 0px; visibility: visible;"&gt;..&lt;/div&gt;
      ...
      &lt;!-- Last div with a displayed board image --&gt;
      &lt;div class="item" style="top: 3343px; left: 1000px; visibility: visible;"&gt;..&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Yet at the bottom of the page, after activating the infinite scroll a couple of times, we get this as the HTML:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;div class="variableHeightLayout padItems GridItems Module centeredWithinWrapper" style=".."&gt;
      &lt;!-- First div with a displayed board image --&gt;
      &lt;div class="item" style="top: 12431px; left: 750px; visibility: visible;"&gt;..&lt;/div&gt;
      ...
      &lt;!-- Last div with a displayed board image --&gt;
      &lt;div class="item" style="top: 19944px; left: 750px; visibility: visible;"&gt;..&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>As you can see, some of the containers for the images higher up on the page have disappeared, and not all of the containers for the images load upon first loading the page.</p>
  
  <hr>
  
  <p><strong>What I want to do</strong></p>
  
  <p>I want to be able to create a C# script (or any server side language at the moment) that can download the page's full HTML (i.e., retrieve every image on the page), and the images will then be downloaded from their URLs. Downloading the webpage and using an appropriate XPath is easy, but the real challenge is downloading the full HTML for every image.</p>
  
  <p>Is there a way I can emulate scrolling to the bottom of the page, or is there an even easier way that I can retrieve every image? I imagine that Pinterest use AJAX to change the HTML, is there a way I can programmatically trigger the events to receive all the HTML? Thank you in advance for suggestions and solutions, and kudos for even reading this very long question if you do not have any!</p>
  
  <p><strong>Pseudo code</strong></p>
  
  <pre><code>using System;
  using System.Net;
  using HtmlAgilityPack;
  
  private void Main() {
      string pinterestURL = "http://www.pinterest.com/...";
      string XPath = ".../img";
  
      HtmlDocument doc = new HtmlDocument();
  
      // Currently only downloads the first 25 images.
      doc.Load(strPinterestUrl);
  
      foreach(HtmlNode link in doc.DocumentElement.SelectNodes(strXPath))
      {
           image_links[] = link["src"];
           // Use image links
      }
  }
  </code></pre>