Class: IdsPlease::Parsers::Odnoklassniki

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

Constant Summary collapse

MASK =
/odnoklassniki|ok\.ru/i

Class Method Summary collapse

Methods inherited from Base

interact, to_sym, valid_id_regex

Class Method Details



8
9
10
11
12
13
14
15
16
# File 'lib/ids_please/parsers/odnoklassniki.rb', line 8

def parse_link(link)
  if matched = link.path.match(/\/(\d{2,})/)
    matched[1]
  elsif link.path =~ /\/about\//
    link.path.split('/')[-2]
  elsif link.path.split('/').size >= 3
    link.path.split('/')[2]
  end
end