Sha256: bbf8d66fe91a62a2a637d54760e0243d27cb089211e4684a7f072c2666923995
Contents?: true
Size: 1.17 KB
Versions: 1
Compression:
Stored size: 1.17 KB
Contents
require 'json' class IdsPlease module Grabbers class Instagram < IdsPlease::Grabbers::Base def grab_link @network_id = page_source.scan(/"user":{.+"id":"(\d+)"/).flatten.first @avatar = page_source.scan(/"user":{.+"profile_pic_url":"([^"]+)"/).flatten.first.gsub('\\', '') @display_name = page_source.scan(/"user":{.+"full_name":"([^"]+)"/).flatten.first @username = page_source.scan(/"user":{"username":"([^"]+)"/).flatten.first.gsub('\\', '') @data = { bio: page_source.scan(/"biography":"([^"]+)"/).flatten.first, website: page_source.scan(/"user":{.+"external_url":"([^"]+)"/).flatten.first.gsub('\\', ''), } @counts = { media: page_source.scan(/"media":{"count":(\d+)/).flatten.first.to_i, followed_by: page_source.scan(/"followed_by":{"count":(\d+)/).flatten.first.to_i, follows: page_source.scan(/"follows":{"count":(\d+)/).flatten.first.to_i, } @display_name = @display_name.gsub(/\\u([\da-fA-F]{4})/) {|m| [$1].pack("H*").unpack("n*").pack("U*")} self rescue => e p e return self end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ids_please-2.2.0 | lib/ids_please/grabbers/instagram.rb |