Sha256: aeb73abfc1020427ebd6167dc0645e3587647a8b13a55358f73850d203585107
Contents?: true
Size: 713 Bytes
Versions: 5
Compression:
Stored size: 713 Bytes
Contents
class DeveloperNewsCliApp::CodeBurstScrapper @@all = [] def get_page Nokogiri::HTML(open("https://codeburst.io/")) end def get_articles self.get_page.css(".js-trackedPost") end def make_article self.get_articles.each do |article| a = DeveloperNewsCliApp::Article.new a.title = article.css("h3").text a.author = article.css(".postMetaInline-authorLockup a").text a.date = article.css("time").text a.url = article.css("a").attribute("href").value a.website = "CodeBurst" a.trailing = article.search(".u-fontSize18").text == "" ? nil : article.search(".u-fontSize18").text @@all << a end end def self.articles @@all end def self.article_count @@all.count end end
Version data entries
5 entries across 5 versions & 1 rubygems