Class: ScraperGooglePlay::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/scraper_google_play/base.rb

Direct Known Subclasses

App, Category, Search

Instance Method Summary collapse

Instance Method Details

#exist?(url) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/scraper_google_play/base.rb', line 3

def exist?(url)
  uri = URI("#{url}")
status_code = Net::HTTP.get_response(uri).code
case status_code
when '200'
  return true
when '404'
  return false
else
  return false
end
end

#list_packname_with_page(page) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/scraper_google_play/base.rb', line 16

def list_packname_with_page(page)
  return nil if page.nil?
  apps = []
  page.search('.id-card-list.card-list .card.apps').each do |elm|
    apps << elm.attr('data-docid')
  end
  apps   
end