Skip to content

Instantly share code, notes, and snippets.

@naoyashiga naoyashiga/catApi.rb
Created Mar 18, 2015

What would you like to do?
Seeing a cat image or GIF by using the Cat API
# -*- encoding: UTF-8 -*-
require 'nokogiri'
require 'open-uri'
API_URL = ""
doc = Nokogiri::XML(open(API_URL).read)
url_nodes = doc.xpath("//url").text
puts url_nodes
# open browser
system "open " + url_nodes
<?xml version="1.0"?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.