Sha256: f2f3934b8e9f1b8674a5511bff8953db5eefea4e54c4d11d9cccc3e308bc5cae

Contents?: true

Size: 762 Bytes

Versions: 5

Compression:

Stored size: 762 Bytes

Contents

require 'service'

module DiffNews

  class NZZ < Service
    def initialize url
      super url
    end
  
    def self.provider
      'nzz.ch'
    end

    def self.base_url
      'https://www.nzz.ch/'
    end

    def self.valid_url
      /^https?:\/\/(www.)?nzz.ch/
    end

  private   
    def title
      normalize_text(strip_html(@doc.css(".title__name").first))
    rescue
      ''
    end
  
    def teaser
      normalize_text(strip_html(@doc.css(".leadtext").first))
    rescue
      ''
    end
  
    def text
      content = @doc.css("article.content").first
    
      content.css('script').remove
      content.css('.inlinePoll').remove
    
      normalize_text(strip_html(content))
    rescue
      ''
    end

    register_service
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
diff_news-0.9.7 lib/news_service/nzz.rb
diff_news-0.9.6 lib/news_service/nzz.rb
diff_news-0.9.5 lib/news_service/nzz.rb
diff_news-0.9.4 lib/news_service/nzz.rb
diff_news-0.9.3 lib/news_service/nzz.rb