~blurtr/blurtr/trunk

« back to all changes in this revision

Viewing changes to go/blurtr.go

  • Committer: Martin Pool
  • Date: 2011-08-14 12:01:12 UTC
  • Revision ID: mbp@canonical.com-20110814120112-7ub7d2a57ptcpz0a
Parse out more posts from tumblr

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
import "bytes"
6
6
import "feed"
7
7
import "xml"
 
8
// import "os"
8
9
 
9
10
 
10
11
// Set of posts from a feed; not necessarily the whole thing.
43
44
 
44
45
func main() {
45
46
        body := getWholeBody("http://staff.tumblr.com/api/read")
46
 
        posts := new(feed.TumblrPosts)
47
 
 
48
 
        xml.Unmarshal(body, posts)
49
 
        fmt.Printf("got %d posts", posts.PostCount)
 
47
        tumblr := new(feed.Tumblr)
50
48
 
51
49
        // body.WriteTo(os.Stdout)
 
50
 
 
51
        xml.Unmarshal(body, tumblr)
 
52
        fmt.Printf("\n\n\nversion %#v\n", tumblr.Version)
 
53
        fmt.Printf("contains posts starting at %d of %d total\n", 
 
54
                   tumblr.Posts.Start, tumblr.Posts.Total)
 
55
        for _, p := range tumblr.Posts.Post {
 
56
                fmt.Printf("  post id %#v %dx%d\n", p.Id, p.Width,
 
57
                           p.Height)
 
58
        }
52
59
}