Skip to content

Instantly share code, notes, and snippets.

@falcon8823
Created June 27, 2016 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save falcon8823/837e418b9ce231e3d121a30fbcbd195c to your computer and use it in GitHub Desktop.
Save falcon8823/837e418b9ce231e3d121a30fbcbd195c to your computer and use it in GitHub Desktop.
Instagramの画像IDから画像URLを取得する
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