Class: WebPageParser::BbcNewsPageParserFactory
Constant Summary
collapse
- URL_RE =
ORegexp.new("(www|news)\.bbc\.co\.uk/.+/([a-z-]+-)?[0-9-]+(\.stm)?$")
- INVALID_URL_RE =
ORegexp.new("in_pictures|pop_ups|sport1")
Class Method Summary
collapse
add_factory, #can_parse?, #create, factories, inherited, load, parser_for
Class Method Details
.can_parse?(options) ⇒ Boolean
8
9
10
11
12
13
14
15
|
# File 'lib/web-page-parser/parsers/bbc_news_page_parser.rb', line 8
def self.can_parse?(options)
url = options[:url].split('#').first
if INVALID_URL_RE.match(url)
nil
else
URL_RE.match(url)
end
end
|
.create(options = {}) ⇒ Object
17
18
19
|
# File 'lib/web-page-parser/parsers/bbc_news_page_parser.rb', line 17
def self.create(options = {})
BbcNewsPageParserV5.new(options)
end
|