<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,11 +1,17 @@
 #!/usr/bin/env ruby
 #
 # tumblr dashboard =&gt; RSS generator
+# fingers crossed they'll add their own soon &lt;3
+# 
+# code: http://github.com/jamiew/tumblr-dashboard-rss
 #
 # @author	Jamie Wilkinson 
 # @email 	jamie@internetfamo.us
 # @website 	http://jamiedubs.com
+#
+
 require 'rubygems'
+gem 'mechanize', '&gt;=0.9.0' # new version w/ nokogiri pls!
 require 'mechanize'
 require 'rss/maker'
 
@@ -14,6 +20,8 @@ email = &quot;you@example.com&quot;
 password = &quot;secret&quot;
 pages = 3
 
+
+
 ## mixins
 class String
   def strip_html(allowed = ['a','img','p','br','i','b','u','ul','li'])
@@ -23,10 +31,17 @@ class String
 end
 
 ## start
-# TODO save &amp; load cookies
+
+# freak out if you haven't set this up yet
+raise &quot;You need to set your email &amp; password! Edit this file&quot; if email == 'you@example.com' and password == 'secret'
+
+# login to tumblr
+# TODO: load &amp; save cookies
 agent = WWW::Mechanize.new
-agent.get(&quot;http://www.tumblr.com/login&quot;)
-form = agent.page.forms[0]
+agent.user_agent = &quot;#{email} :: Tumblr Dashboard RSS &lt;http://github.com/jamiew/tumblr-dashboard-rss&gt;&quot;
+
+page = agent.get(&quot;http://www.tumblr.com/login&quot;)
+form = page.form_with(:action =&gt; '/login')
 form.email = email
 form.password = password
 agent.submit(form)
@@ -34,11 +49,14 @@ agent.submit(form)
 ## go back to dashboard
 posts = []
 (1..pages).each { |i|
-  i = '' if i == 1
-  print &quot;getting page #{i}...&quot;
-  agent.get(&quot;http://www.tumblr.com/dashboard/#{i}&quot;)
+  i = '' if i == 1 # what we'll grab in the URL (/dashboard/2)
+  STDERR.puts &quot;getting page #{i}...&quot;
+  page = agent.get(&quot;http://www.tumblr.com/dashboard/#{i}&quot;)
   start = (i == '' ? 1 : 0)  # 1st post on 1st page isn't a real post
-  posts += agent.page.search('#posts li.post')[start..-1]
+
+  # hmm. Nokogiri doesn't seem to be having a good time with li.post (just returns the first)
+  # fortunately we have li.not_mine; FIXME TODO
+  posts += (page/'#posts li.not_mine')
   sleep 2
 }
 
@@ -46,17 +64,35 @@ posts = []
 content = RSS::Maker.make(&quot;2.0&quot;) { |m|
   m.channel.title = &quot;tumblr dashboard for #{email}&quot;
   m.channel.link = &quot;http://www.tumblr.com/dashboard&quot;
-  m.channel.description = &quot;Latest from yr tumblr feed&quot;
+  m.channel.description = &quot;Latest from yr Tumblr Dashboard&quot;
   # m.items.do_sort = true # sort items by date
   
+  author = &quot;WHO DAT NINJA&quot; #temp
   posts.each { |post|
-    i = m.items.new_item
-    title = post.search('.username').innerHTML.strip_html([]).gsub(/:$/,'')
-    puts &quot;post by #{title}&quot;
-    i.title = title
-    i.link = post.search('a')[0].attributes['href'] # just use whatever link is first
-    i.description = post.search('.post_container') # ghetto, should strip some stuff
-    # i.date = Time.now # they don't give us a time, bastards
+
+    # basic post info
+    kind = post['class'].gsub('post','').gsub('is_mine','').split(' ').first
+    title = (post/'.post_title a').first.content.strip_html([]) rescue kind
+    author = (post/'.post_info a').first.content unless (post/'.post_info a').first.nil? # carry over previous author
+    link = (post/'a').last.attributes['href']
+    
+    # delete things we don't want and extract the remaining stuff as 'content'
+    (post/'.post_title').remove
+    (post/'.post_info').remove
+    (post/'.post_controls').remove
+    (post/'table').remove
+    (post/'.so_ie_doesnt_treat_this_as_inline').remove
+    content = post.to_s.strip
+    
+    # STDERR.puts &quot;#{kind} post by #{author}, #{title} =&gt; #{link}&quot;
+    # STDERR.puts &quot;#{content.inspect}&quot;
+    # STDERR.puts &quot;---&quot;
+
+    item = m.items.new_item    
+    item.title = title
+    item.link = link # just use whatever link is first
+    item.description = content # ghetto, should strip some stuff
+    # i.date = Time.now # they don't give us a time
   }
 }
 </diff>
      <filename>tumblr-dashboard-rss.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>98069dbeeaf0ad5040918067e17b3f5022fec7b1</id>
    </parent>
  </parents>
  <author>
    <name>Jamie Wilkinson</name>
    <email>jamie@tramchase.com</email>
  </author>
  <url>http://github.com/jamiew/tumblr-dashboard-rss/commit/f0d25b4791be53e5332c15592001b54a8b604079</url>
  <id>f0d25b4791be53e5332c15592001b54a8b604079</id>
  <committed-date>2009-03-07T15:44:23-08:00</committed-date>
  <authored-date>2009-03-07T15:44:23-08:00</authored-date>
  <message>updated to work with tumblr v5</message>
  <tree>c0e0e63a06d36e96b9592db3776c87cbe002793c</tree>
  <committer>
    <name>Jamie Wilkinson</name>
    <email>jamie@tramchase.com</email>
  </committer>
</commit>
