-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanalannie.rb
38 lines (32 loc) · 1.01 KB
/
analannie.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# - - coding: utf-8
require "nokogiri"
require "yaml"
unless ARGV[0].nil? then
end
if ARGV.size > 0 and ARGV[0] == "--inv"
mode = "investigation"
end
config = YAML.load_file("company.yaml")
f = File.open("test.txt")
docs = Nokogiri::XML.parse(f)
app_free_download = docs.css("tr > td[class=\"app free\"]:first-child div[class=\"main-info\"]")
case mode
when "investigation" then
app_free_download.each { |game|
gname = game.css("span[class=\"oneline-info title-info\"] a")
company = game.css("span[class=\"oneline-info add-info\"] a")
if !config.has_key?(company.text())
print company.text() + ": \n"
end
}
else
app_free_download.each { |game|
gname = game.css("span[class=\"oneline-info title-info\"] a")
company = game.css("span[class=\"oneline-info add-info\"] a")
if config.has_key?(company.text())
print gname.text() + " " + company.text() + " " + config[company.text()] + "\n"
else
print gname.text() + " " + company.text() + " " + "unknown\n"
end
}
end