metainspector 4.3.1 → 4.3.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d08161c6862dd913aaf01445ee57b9032175446
|
4
|
+
data.tar.gz: 6b146d81557fd12e3f1897618450ce7e1a2a817a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 402eeecd7575f88a52937bf37c114049d6d3e90a5e5ac607aef2313e3d13c73bbbcd09c338831a9f93ee2bed7f2dba0b911298f95e980c92fcb011e6a39413f8
|
7
|
+
data.tar.gz: b18a4ae671b7710ef220817b65db730109d88e6af360194eb0f7e8c12ee100ae44111ee8e9fb300eb89ec9e806a2e65c57f2916544f2a1c07c99ddce55bec9ec
|
@@ -35,7 +35,7 @@ module MetaInspector
|
|
35
35
|
# filtered for images that are more square than 10:1 or 1:10
|
36
36
|
def largest()
|
37
37
|
@larget_image ||= begin
|
38
|
-
img_nodes = parsed.search('//img')
|
38
|
+
img_nodes = parsed.search('//img').select{ |img_node| img_node['src'] }
|
39
39
|
sizes = img_nodes.map { |img_node| [URL.absolutify(img_node['src'], base_url), img_node['width'], img_node['height']] }
|
40
40
|
sizes.uniq! { |url, width, height| url }
|
41
41
|
if @download_images
|
@@ -0,0 +1,23 @@
|
|
1
|
+
HTTP/1.1 200 OK
|
2
|
+
Server: nginx/0.7.67
|
3
|
+
Date: Fri, 18 Nov 2011 21:46:46 GMT
|
4
|
+
Content-Type: text/html
|
5
|
+
Connection: keep-alive
|
6
|
+
Last-Modified: Mon, 14 Nov 2011 16:53:18 GMT
|
7
|
+
Content-Length: 4987
|
8
|
+
X-Varnish: 2000423390
|
9
|
+
Age: 0
|
10
|
+
Via: 1.1 varnish
|
11
|
+
|
12
|
+
<html>
|
13
|
+
<head>
|
14
|
+
<title>An example page</title>
|
15
|
+
</head>
|
16
|
+
<body>
|
17
|
+
<img src="/too_narrow" width="10" height="100" />
|
18
|
+
<img src="/smaller" width="10" height="10" />
|
19
|
+
<img src="/largest" width="100" height="100" />
|
20
|
+
<img width="100" height="10" />
|
21
|
+
<img src="/smallest" width="1" height="1" />
|
22
|
+
</body>
|
23
|
+
</html>
|
@@ -88,6 +88,13 @@ describe MetaInspector do
|
|
88
88
|
|
89
89
|
expect(page.images.best).to eq("http://example.com/100x100")
|
90
90
|
end
|
91
|
+
|
92
|
+
it "should find image when some img tag has no src attribute" do
|
93
|
+
page = MetaInspector.new('http://example.com/malformed_image_in_html')
|
94
|
+
|
95
|
+
expect(page.images.best).to eq("http://example.com/largest")
|
96
|
+
end
|
97
|
+
|
91
98
|
end
|
92
99
|
|
93
100
|
describe "images.owner_suggested" do
|
data/spec/spec_helper.rb
CHANGED
@@ -36,6 +36,7 @@ FakeWeb.register_uri(:get, "http://example.com/no-content-type", :response => fi
|
|
36
36
|
# Used to test largest image in page logic
|
37
37
|
FakeWeb.register_uri(:get, "http://example.com/largest_image_in_html", :response => fixture_file("largest_image_in_html.response"))
|
38
38
|
FakeWeb.register_uri(:get, "http://example.com/largest_image_using_image_size", :response => fixture_file("largest_image_using_image_size.response"))
|
39
|
+
FakeWeb.register_uri(:get, "http://example.com/malformed_image_in_html", :response => fixture_file("malformed_image_in_html.response"))
|
39
40
|
FakeWeb.register_uri(:get, "http://example.com/10x10", :response => fixture_file("10x10.jpg.response"))
|
40
41
|
FakeWeb.register_uri(:get, "http://example.com/100x100", :response => fixture_file("100x100.jpg.response"))
|
41
42
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metainspector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.3.
|
4
|
+
version: 4.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jaime Iniesta
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -276,6 +276,7 @@ files:
|
|
276
276
|
- spec/fixtures/largest_image_in_html.response
|
277
277
|
- spec/fixtures/largest_image_using_image_size.response
|
278
278
|
- spec/fixtures/malformed_href.response
|
279
|
+
- spec/fixtures/malformed_image_in_html.response
|
279
280
|
- spec/fixtures/markupvalidator_faqs.response
|
280
281
|
- spec/fixtures/meta_tags.response
|
281
282
|
- spec/fixtures/no-content-type.response
|