Class: IdsPlease::Parsers::Blogger

Inherits:
Base
  • Object
show all
Defined in:
lib/ids_please/parsers/blogger.rb

Constant Summary collapse

MASK =
/blogspot|blogger/i

Class Method Summary collapse

Methods inherited from Base

to_sym, valid_id_regex

Class Method Details

.interact(links) ⇒ Object



7
8
9
10
11
# File 'lib/ids_please/parsers/blogger.rb', line 7

def self.interact(links)
  links.map do |link|
    parse_link(link)
  end.compact
end


13
14
15
16
17
18
19
20
21
22
# File 'lib/ids_please/parsers/blogger.rb', line 13

def self.parse_link(link)
  query = CGI.parse(link.query) if link.query && !link.query.empty?

  if query && !query['blogID'].empty?
    query['blogID'].first.split('#').first
  else
    return if link.host.sub('.blogspot.com', '') == link.host
    link.host.sub('.blogspot.com', '')
  end
end