Class: Scraper
- Inherits:
-
Object
- Object
- Scraper
- Defined in:
- lib/scraper.rb
Constant Summary collapse
- @@BasePath =
"https://reddit.com"
- @@html =
nil
Class Method Summary collapse
Class Method Details
.scrape_categories ⇒ Object
5 6 7 8 |
# File 'lib/scraper.rb', line 5 def self.scrape_categories @@html = Nokogiri::HTML(open(@@BasePath, 'User-Agent' => 'NoobyDooby')) category_list = @@html.css('#header ul.tabmenu li a') end |
.scrape_selected_category(link) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/scraper.rb', line 10 def self.scrape_selected_category(link) puts "link = #{link}" @@html = Nokogiri::HTML(open(link, 'User-Agent' => 'NoobyDooby')) post_list = @@html.css('.thing.link') end |