cherrypicker 0.3.13 → 0.3.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/cherrypicker/helpers.rb +16 -4
- data/lib/cherrypicker/version.rb +1 -1
- metadata +1 -1
data/lib/cherrypicker/helpers.rb
CHANGED
@@ -9,7 +9,6 @@ require 'net/http'
|
|
9
9
|
require 'net/https'
|
10
10
|
require 'progressbar'
|
11
11
|
require 'open-uri'
|
12
|
-
require 'progress'
|
13
12
|
|
14
13
|
module Cherrypicker
|
15
14
|
def self.remote_query(url)
|
@@ -62,6 +61,8 @@ module Cherrypicker
|
|
62
61
|
end
|
63
62
|
|
64
63
|
puts "unknown file size for #{@filename} but downloading..." if @size.nil?
|
64
|
+
puts @link.to_s
|
65
|
+
|
65
66
|
http.request(request) do |response|
|
66
67
|
bar = ProgressBar.new((@filename ||= File.basename(uri.path)), @size.to_i) unless @size.nil?
|
67
68
|
bar.format_arguments=[:title, :percentage, :bar, :stat_for_file_transfer] unless @size.nil?
|
@@ -74,7 +75,7 @@ module Cherrypicker
|
|
74
75
|
end
|
75
76
|
end
|
76
77
|
end
|
77
|
-
|
78
|
+
|
78
79
|
@finished = true
|
79
80
|
puts
|
80
81
|
puts "download completed"
|
@@ -89,7 +90,18 @@ module Cherrypicker
|
|
89
90
|
end
|
90
91
|
|
91
92
|
def self.random_agent
|
92
|
-
|
93
|
-
|
93
|
+
useragent = [ "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.3) Gecko/20090913 Firefox/3.5.3",
|
94
|
+
"Mozilla/5.0 (Windows; U; Windows NT 6.1; en; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)",
|
95
|
+
"Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)",
|
96
|
+
"Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.1) Gecko/20090718 Firefox/3.5.1",
|
97
|
+
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/532.1 (KHTML, like Gecko) Chrome/4.0.219.6 Safari/532.1",
|
98
|
+
"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; InfoPath.2)",
|
99
|
+
"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.5.30729; .NET CLR 3.0.30729)",
|
100
|
+
"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; Win64; x64; Trident/4.0)",
|
101
|
+
"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; SV1; .NET CLR 2.0.50727; InfoPath.2)Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)",
|
102
|
+
"Mozilla/4.0 (compatible; MSIE 6.1; Windows XP)",
|
103
|
+
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)",
|
104
|
+
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.50 Safari/534.24"]
|
105
|
+
return useragent[rand(useragent.length)]
|
94
106
|
end
|
95
107
|
end
|
data/lib/cherrypicker/version.rb
CHANGED