Class: Omnom::Source::Slashdot::Default

Inherits:
Base
  • Object
show all
Defined in:
lib/omnom/source/slashdot/default.rb

Instance Attribute Summary

Attributes inherited from Base

#config, #feed_key, #key, #options, #settings, #source_id

Instance Method Summary collapse

Methods inherited from Base

#after_initialize, config, configure, cron, every, feed_url, full_key, guid_namespace, icon, icon_from_url, inherited, #initialize, key, required_config, required_options, #update, url

Methods included from ParserMethods

#html_to_text

Constructor Details

This class inherits a constructor from Omnom::Source::Base

Instance Method Details

#get_raw_postsObject



8
9
10
# File 'lib/omnom/source/slashdot/default.rb', line 8

def get_raw_posts
  @page.search('#firehoselist > article')
end

#post_attributes(node) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/omnom/source/slashdot/default.rb', line 12

def post_attributes(node)
  {
    title: node.search('h2.story > span > a').text,
    description: node.search('.body .p > i').inner_html.gsub(/^"|"$/, ''),
    guid: node.attr('data-fhid'),
    url: node.find('h2.story > span > a').attr('href'),
    published_at: node.find('.details time').time(time_zone: 'America/New_York'),
    thumbnail_url: node.find('header > .topic > a img').attr('src'),
    author_name: node.find('.details > a').text,
    author_url: node.find('.details > a').attr('href'),
    comments_count: node.drill([:find, 'footer a.read-more .comments'], :text, :to_i),
    comments_url: node.find('footer a.read-more').attr('href'),
    tags: node.search('.tag-bar .popular.tag').collect { |tag| tag.text }
  }
end