image_scraper 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/image_scraper.gemspec +2 -2
- data/lib/image_scraper/client.rb +2 -1
- data/test/test_image_scraper.rb +4 -4
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
data/image_scraper.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{image_scraper}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["John McAliley"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-07-03}
|
13
13
|
s.description = %q{Simple utility to pull image urls from web page}
|
14
14
|
s.email = %q{john.mcaliley@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/image_scraper/client.rb
CHANGED
@@ -8,7 +8,8 @@ module ImageScraper
|
|
8
8
|
@convert_to_absolute_url = options[:convert_to_absolute_url]
|
9
9
|
@include_css_images = options[:include_css_images]
|
10
10
|
@include_css_data_images = options[:include_css_data_images]
|
11
|
-
|
11
|
+
html = open(url).read
|
12
|
+
@doc = Nokogiri::HTML(html)
|
12
13
|
end
|
13
14
|
|
14
15
|
def image_urls
|
data/test/test_image_scraper.rb
CHANGED
@@ -7,8 +7,8 @@ class TestImageScraper < Test::Unit::TestCase
|
|
7
7
|
should "return list of all image urls on a web page with absolute paths" do
|
8
8
|
images = ["http://upload.wikimedia.org/wikipedia/en/thumb/2/24/Lenna.png/200px-Lenna.png",
|
9
9
|
"http://bits.wikimedia.org/skins-1.17/common/images/magnify-clip.png",
|
10
|
-
"http://bits.wikimedia.org/skins-1.17/vector/images/search-ltr.png?301-
|
11
|
-
"http://
|
10
|
+
"http://bits.wikimedia.org/skins-1.17/vector/images/search-ltr.png?301-3",
|
11
|
+
"http://bits.wikimedia.org/images/wikimedia-button.png",
|
12
12
|
"http://bits.wikimedia.org/skins-1.17/common/images/poweredby_mediawiki_88x31.png"]
|
13
13
|
scraper = ImageScraper::Client.new("http://en.wikipedia.org/wiki/Standard_test_image",:include_css_images=>false)
|
14
14
|
assert_equal images, scraper.image_urls
|
@@ -17,8 +17,8 @@ class TestImageScraper < Test::Unit::TestCase
|
|
17
17
|
should "return list of all image urls on a web page with relative paths" do
|
18
18
|
images = ["http://upload.wikimedia.org/wikipedia/en/thumb/2/24/Lenna.png/200px-Lenna.png",
|
19
19
|
"http://bits.wikimedia.org/skins-1.17/common/images/magnify-clip.png",
|
20
|
-
"http://bits.wikimedia.org/skins-1.17/vector/images/search-ltr.png?301-
|
21
|
-
"/images/wikimedia-button.png",
|
20
|
+
"http://bits.wikimedia.org/skins-1.17/vector/images/search-ltr.png?301-3",
|
21
|
+
"http://bits.wikimedia.org/images/wikimedia-button.png",
|
22
22
|
"http://bits.wikimedia.org/skins-1.17/common/images/poweredby_mediawiki_88x31.png"]
|
23
23
|
scraper = ImageScraper::Client.new("http://en.wikipedia.org/wiki/Standard_test_image",:convert_to_absolute_url=>false,:include_css_images=>false)
|
24
24
|
assert_equal images, scraper.image_urls
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 4
|
9
|
+
version: 0.1.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- John McAliley
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-
|
17
|
+
date: 2011-07-03 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -175,7 +175,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
175
175
|
requirements:
|
176
176
|
- - ">="
|
177
177
|
- !ruby/object:Gem::Version
|
178
|
-
hash:
|
178
|
+
hash: -830537873008219940
|
179
179
|
segments:
|
180
180
|
- 0
|
181
181
|
version: "0"
|