Created
June 27, 2016 10:34
-
-
Save falcon8823/837e418b9ce231e3d121a30fbcbd195c to your computer and use it in GitHub Desktop.
Instagramの画像IDから画像URLを取得する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri' | |
require 'open-uri' | |
require 'json' | |
id = ARGV.first | |
url = 'https://www.instagram.com/p/' + id | |
f = open(url) | |
doc = Nokogiri::HTML.parse(f.read) | |
doc.xpath('//meta[@property="og:image"]').each do |a| | |
puts a.attribute('content').value | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment