Repository URL to install this package:
|
Version:
1.1.1 ▾
|
module JApiAgent::ContentParser
class StatigramParser < ParserBase
def self.parse(posts)
parsed_posts = []
default_options = { :platform => "Instagram"}
posts.entries.each do |p|
pp = Post.new(default_options)
begin
pp.author = p.author
doc = Nokogiri::HTML(p.summary)
image_tags = doc.xpath('//img')
image_src = image_tags.first['src']
pp.post_image = image_src
pp.content = p.title
pp.published_date = p.published - 17.hours
rescue nil
pp = nil
end
parsed_posts << pp if pp
end
parsed_posts
end
end
end