Skip to content

Instantly share code, notes, and snippets.

@onedesign
Created May 13, 2009 01:43
Show Gist options
  • Save onedesign/110822 to your computer and use it in GitHub Desktop.
Save onedesign/110822 to your computer and use it in GitHub Desktop.
v = Vimeo::Advanced::Video.new("api_key", "secret_key")
response = v.get_list_by_tag("dog")
# returns:
# {
# "rsp"=> {
# "videos" => {
# "perpage"=>"25", "on_this_page"=>"25", "page"=>"1",
# "video"=>
# [{"title"=>"Arduino Web Controlled Dog Waterer", "id"=>"4620716", "owner"=>"76289", "privacy"=>"anybody", "is_hd"=>"1"},
# {"title"=>"Eve, our foster pug Christmas blooper", "id"=>"4618955", "owner"=>"1746218", "privacy"=>"anybody", "is_hd"=>"0"},
# {"title"=>"Ellie, my precious pug running and barking for her dinner", "id"=>"4618886", "owner"=>"1746218", "privacy"=>"anybody", "is_hd"=>"0"},
# {"title"=>"Ellie, my precious pug goes camping!", "id"=>"4618841", "owner"=>"1746218", "privacy"=>"anybody", "is_hd"=>"0"},
# {"title"=>"Cooper, our 12 week old foster pug puppy playing in the backyard", "id"=>"4618763", "owner"=>"1746218", "privacy"=>"anybody", "is_hd"=>"0"},
# {"title"=>"Sweetdogs", "id"=>"4618232", "owner"=>"1482903", "privacy"=>"anybody", "is_hd"=>"0"},
# {"title"=>"Shelter Dogs", "id"=>"4617342", "owner"=>"962803", "privacy"=>"anybody", "is_hd"=>"1"},
# {"title"=>"CoYoTe SMoOTH CoLLIE", "id"=>"4615941", "owner"=>"1699810", "privacy"=>"anybody", "is_hd"=>"1"},
# {"title"=>"PUDDING and her Beach Volleyball on 5-12-09", "id"=>"4614543", "owner"=>"1225615", "privacy"=>"anybody", "is_hd"=>"1"},
# {"title"=>"Bella Yard Play at 5 months", "id"=>"4613532", "owner"=>"1268909", "privacy"=>"anybody", "is_hd"=>"1"},
# {"title"=>"Reversals", "id"=>"4613206", "owner"=>"1051087", "privacy"=>"anybody", "is_hd"=>"0"},
# {"title"=>"Nonsensical", "id"=>"4608799", "owner"=>"848233", "privacy"=>"anybody", "is_hd"=>"1"},
# {"title"=>"Emma Rotoscoped", "id"=>"4606126", "owner"=>"1496752", "privacy"=>"anybody", "is_hd"=>"0"},
# {"title"=>"Tripod", "id"=>"4606000", "owner"=>"1501732", "privacy"=>"anybody", "is_hd"=>"0"},
# {"title"=>"DON`T STAY AT HOME DURING THINGYAN :D", "id"=>"4604739", "owner"=>"1519584", "privacy"=>"anybody", "is_hd"=>"0"},
# {"title"=>"tripod", "id"=>"4603694", "owner"=>"1501732", "privacy"=>"anybody", "is_hd"=>"0"},
# {"title"=>"Trixie & Water, Backwards", "id"=>"4600711", "owner"=>"1051087", "privacy"=>"anybody", "is_hd"=>"0"},
# {"title"=>"NYU", "id"=>"4599099", "owner"=>"1089812", "privacy"=>"anybody", "is_hd"=>"0"},
# {"title"=>"Barking Pig", "id"=>"4597097", "owner"=>"1739239", "privacy"=>"anybody", "is_hd"=>"0"},
# {"title"=>"Agility - Marina & Roxie - S\303\251lectif GPF 2009 aux Sorini\303\250res", "id"=>"4595161", "owner"=>"1722716", "privacy"=>"anybody", "is_hd"=>"0"},
# {"title"=>"Bubbles, Backwards", "id"=>"4594935", "owner"=>"1051087", "privacy"=>"anybody", "is_hd"=>"0"},
# {"title"=>"Trine og Maiko trener handling", "id"=>"4594902", "owner"=>"693760", "privacy"=>"anybody", "is_hd"=>"1"},
# {"title"=>"Handling med Tyra", "id"=>"4594882", "owner"=>"1683766", "privacy"=>"anybody", "is_hd"=>"1"},
# {"title"=>"Handling med Zorro", "id"=>"4594679", "owner"=>"794096", "privacy"=>"anybody", "is_hd"=>"1"},
# {"title"=>"Waterdog", "id"=>"4590011", "owner"=>"1696358", "privacy"=>"anybody", "is_hd"=>"0"}]
# }, "stat"=>"ok", "generated_in"=>"2.0168"
# }
# }
# You're dealing with a nested hash. Really what you want is the "video" array inside of the "videos" hash.
# It's all right to be confused by this -- the "video" array is, IMO, inappropriately named by the Vimeo API.
videos = response["rsp"]["videos"]["video"] # <-- pull out the array
videos.each do |video|
puts video["title"] # <-- now you can get the data
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment