Module: PinterestProfile

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

Overview

Grep pinterest profile

Instance Method Summary collapse

Instance Method Details

#grep_pinterest_profile(response) ⇒ Object



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

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

  pinterest_regex = %r{(?im)(https?:\/\/[\w\.]*pinterest\.com\/(?!"|'|\?|#|cookies(?:"|'')|(?:pin|v3|js|feed)\/)[^"'<>?&\s\/]+)}
  response.scan(pinterest_regex).flatten.compact.uniq
end