Module: TwitterProfile

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

Overview

Grep twitter profile

Instance Method Summary collapse

Instance Method Details

#grep_twitter_profile(response) ⇒ Object



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

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

  twitter_regex = %r{(?im)(https?:\/\/(?:www\.)?twitter\.com\/(?!\{\{)(?!(?:share|download|search|home|login|privacy)(?:\?|\/|\b)|(?:hashtag|i|javascripts|statuses|#!|intent)\/|(?:#|'|%))[^"'&\?<>\s\\]+)}
  response.scan(twitter_regex).flatten.compact.uniq
end