Module: InstagramProfile

Included in:
BrilliantWebScraper
Defined in:
lib/parsers/instagram_profile.rb

Overview

Grep instgram profiles

Instance Method Summary collapse

Instance Method Details

#grep_instagram_profile(response) ⇒ Object


5
6
7
8
9
10
# File 'lib/parsers/instagram_profile.rb', line 5

def grep_instagram_profile(response)
  return if response.nil? || response.empty?

  instagram_regex = %r{(?im)(https?:\/\/(?:www\.)?+instagram\.com\/(?!#|%|"|'|(?:explore|p)\/).+?[^"'<>\s?&\/]+)}
  response.scan(instagram_regex).flatten.compact.uniq
end