Class: Itest5ch::BoardListPage
- Inherits:
-
Object
- Object
- Itest5ch::BoardListPage
- Includes:
- HttpMethods
- Defined in:
- lib/itest5ch/board_list_page.rb
Constant Summary collapse
- BOARDS_URL =
"http://itest.5ch.net/".freeze
Instance Method Summary collapse
-
#all ⇒ Hash<String, Array<Itest5ch::Board>>
Get all boards.
Methods included from HttpMethods
Instance Method Details
#all ⇒ Hash<String, Array<Itest5ch::Board>>
Get all boards
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/itest5ch/board_list_page.rb', line 10 def all doc = Nokogiri::HTML.parse(get_html(BOARDS_URL)) doc.search("//div[@id='bbsmenu']//ul[@class='pure-menu-list']"). reject {|ul| ul["id"] == "history" }.each_with_object({}) do |ul, categories| category_node = ul.at_xpath("li[contains(@class, 'pure-menu-item') and contains(@class, 'pure-menu-selected')]") next unless category_node category_name = category_node.text.strip categories[category_name] = get_boards(ul) end end |