mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 11:11:13 +08:00
Replace Hpricot with Nokogiri
This commit is contained in:
@ -17,17 +17,17 @@ module Oneboxer
|
||||
|
||||
def parse(data)
|
||||
|
||||
hp = Hpricot(data)
|
||||
html_doc = Nokogiri::HTML(data)
|
||||
|
||||
result = {}
|
||||
|
||||
m = hp.at("h1")
|
||||
m = html_doc.at("h1")
|
||||
result[:title] = m.inner_text if m
|
||||
|
||||
m = hp.at("h4 ~ p")
|
||||
m = html_doc.at("h4 ~ p")
|
||||
result[:text] = m.inner_text[0..MAX_TEXT] if m
|
||||
|
||||
m = hp.at(".product img.artwork")
|
||||
m = html_doc.at(".product img.artwork")
|
||||
result[:image] = m['src'] if m
|
||||
|
||||
result
|
||||
|
Reference in New Issue
Block a user