Method: Gbbib::GbScrapper.scrape_page
- Defined in:
- lib/gbbib/gb_scrapper.rb
.scrape_page(text) ⇒ Gbbib::HitCollection
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/gbbib/gb_scrapper.rb', line 20 def scrape_page(text) search_html = OpenURI.open_uri( 'http://www.std.gov.cn/search/stdPage?q=' + text ) result = Nokogiri::HTML search_html hits = result.css('.s-title a').map do |h| Hit.new pid: h[:pid], title: h.text, scrapper: self end HitCollection.new hits end |