title: Groovy Project (html parsing, file downloading, file creating)
body: <p>I am considering starting a project so that I can learn more and keep the things I have learned thus far from getting rusty. </p>
  
  <p>A lot of the project will be new things so I thought I would come here and ask for advice on what to do and how to go about doing it. </p>
  
  <p>I enjoy photoshop and toying around with it, so I thought I would mix my project with something like that. So I decided my program will do something along the lines of grab new resources for photoshop put them in their own folder on my computer. (from deviantart for now)</p>
  
  <p>For now I want to focus on a page like this:</p>
  
  <pre><code>http://browse.deviantart.com/resources/applications/psbrushes/?order=9    
  </code></pre>
  
  <p>I'm not fluent with understanding exactly what is going on in the html source so it is a bit hard to see what is going on. </p>
  
  <p>But lets say I am on that page and I have the following options chosen:</p>
  
  <pre><code>Sorted by Popular
  Sorted by All Time 
  Sorted by 24 Items Per Page
  </code></pre>
  
  <p>My goal is to individually go to each thumbnail and grab the following:</p>
  
  <pre><code>The Author
  The Title
  The Description
  Download the File (create folder based on title name)
  Download the Image (place in folder with the file above)
  Create text file with the author, title, and description in it
  </code></pre>
  
  <p>I would like to do that for each of the 24 items on the page and then go to the next page and do the same. (I am thinking of just going through the first five pages as I don't have too much interest in trying out brushes that aren't too popular)</p>
  
  <p>So, I'm posting this for a sense of direction and perhaps some help on how to parse such a page to get what I'm looking for. I'm sure this project will keep me busy for awhile, but I'm hoping it will become useful in teaching me things.</p>
  
  <p>Any help and suggestions are always appreciated.</p>
  
  <p>. </p>
  
  <p>.</p>
  
  <p><strong>EDIT</strong> </p>
  
  <p>Each page is made up of 24 of these:</p>
  
  <pre><code>&lt;div class="tt-a" usericon="http://a.deviantart.net/avatars/s/h/shad0w-gfx.gif" collect_rid="1:19982524"&gt;
   &lt;span class="shad0w" style="background-image: url ("http://sh.deviantart.net/shad0w/x/107/150/logo3.png");"&gt;
    &lt;a class="t" title="Shad0ws Blood Brush Set by ~Shad0w-GFX, Jun 28, 2005" href="http://Shad0w-GFX.deviantart.com/art/Shad0ws-Blood-Brush-Set-19982524?q=boost%3Apopular+in%3Aresources%2Fapplications%2Fpsbrushes&amp;qo-0"&gt;Shad0ws Blood Brush Set&lt;/a&gt;
  </code></pre>
  
  <p>My assumption is, I want to grab all my information from the: </p>
  
  <pre><code>&lt;a class="t" ... &gt;
  </code></pre>
  
  <p>Since it contains the title, author, and link to where the download url and large image is located.</p>
  
  <p>If this sounds correct, how would one go about getting that info for each object on the page. (24 per page) I would assume by using CyberNeko. I'm just not exactly sure how to get to the proper level where  is located and for each of them on the page</p>
  
  <p>.</p>
  
  <p>.</p>
  
  <p><strong>EDIT #2</strong></p>
  
  <p>I have some test code that looks like this:</p>
  
  <pre><code>divs = []
  client = new WebClient(BrowserVersion.FIREFOX_3)
  client.javaScriptEnabled = false
  
  page = client.getPage("http://browse.deviantart.com/resources/applications/psbrushes/?order=9&amp;offset=0")
  
  divs = page.getByXPath("//html/body/div[2]/div/div/table/tbody/tr/td[2]/div/div[5]/div/div[2]/span/a[@class='t']")
  
  divs.each { println it }
  </code></pre>
  
  <p>The XPath is correct, but it prints out: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;a href="http://Shad0w-GFX.deviantart.com/
  </code></pre>
  
  <p>art/Shad0ws-Blood-Brush-Set-19982524?q=boost%3Apopular+in%3Aresources%2Fapplicat
  ions%2Fpsbrushes&amp;qo=0" class="t" title="Shad0ws Blood Brush Set by ~Shad0w-G
  FX, Jun 28, 2005">Shad0ws Blood Brush Set</p>
  
  <p>Can you explain what I need to do to just get the href out of there? Is there a simple way to do it with HtmlUnit?</p>