Module: GooglePlay
- Defined in:
- lib/google-play.rb
Overview
TODO: Build whitelist of types to search for and check type on submit. Also add pagination
Class Method Summary collapse
Class Method Details
.info(id, type) ⇒ Object
16 17 18 19 |
# File 'lib/google-play.rb', line 16 def self.info(id,type) doc = Nokogiri::HTML(open("https://play.google.com/store/#{URI.escape(type)}/details?id=#{URI.escape(id)}")) return PlayResult.new(id,type,doc.css('h1.doc-banner-title').text) end |
.search(query, type, page) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/google-play.rb', line 8 def self.search(query,type,page) results = Array.new doc = Nokogiri::HTML(open("https://play.google.com/store/search?q=#{URI.escape(query)}&c=#{URI.escape(type)}")) doc.css('ul.search-results-list li.search-results-item').each{ |list| results << SearchResult.new(query,type,list) } return results end |
.top(type) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/google-play.rb', line 20 def self.top(type) results = Array.new if type == "music" url = "https://play.google.com/store/music/collection/topselling_paid_album" else type == "movie" url = "https://play.google.com/store/movies/collection/topselling_paid" end doc = Nokogiri::HTML(open(url)) doc.css('ul.container-snippet-list li').each{ |list| results << TopResult.new(type,list) } return results end |