Skip to content

Instantly share code, notes, and snippets.

@sasha1sum
Last active December 18, 2015 00:18
Show Gist options
  • Save sasha1sum/5695567 to your computer and use it in GitHub Desktop.
Save sasha1sum/5695567 to your computer and use it in GitHub Desktop.
Script to take a package name and return it's title from play.google.com. Also a script which takes a filename with a list of packages and uninstalls them.
#!/usr/bin/ruby
require 'nokogiri'
require 'open-uri'
class PlayEntry
def initialize(package)
@package = package
url = "https://play.google.com/store/apps/details?id=#{package}"
@doc = Nokogiri::HTML open(url)
rescue
@doc = Nokogiri::HTML ""
end
def title
node = @doc.css("h1.doc-banner-title").first
node.text unless node.nil?
end
end
ARGV.each do |package|
package = package.strip
entry = PlayEntry.new package
puts "#{entry.title}\t(#{package})"
end
#!/usr/bin/ruby
# takes a filename which contains a list of packages to uninstall
File.open(ARGV.first).each do |package|
package = package.strip
print "Uninstalling #{package}..."
STDOUT.flush
puts `adb uninstall #{package}`
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment