geo-spider 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/geo-spider/extractors/postcode.rb +12 -4
- data/lib/geo-spider/site.rb +1 -1
- data/lib/geo-spider/version.rb +1 -1
- metadata +2 -2
@@ -11,12 +11,20 @@ module GeoSpider
|
|
11
11
|
REGEXP = /(GIR 0AA|[A-PR-UWYZ]([0-9]{1,2}|([A-HK-Y][0-9]|[A-HK-Y][0-9]([0-9]|[ABEHMNPRV-Y]))|[0-9][A-HJKS-UW])(\s*)[0-9][ABD-HJLNP-UW-Z]{2})/i
|
12
12
|
|
13
13
|
def locations
|
14
|
-
results = @element.
|
14
|
+
results = @element.inner_html.scan(REGEXP)
|
15
15
|
results = results.map(&:first)
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
locations = []
|
18
|
+
|
19
|
+
results.each do |result|
|
20
|
+
begin
|
21
|
+
p = geocoder.locate(result)
|
22
|
+
locations << Location.new(:latitude => p.latitude, :longitude => p.longitude, :title => result)
|
23
|
+
rescue Graticule::Error
|
24
|
+
next
|
25
|
+
end
|
26
|
+
|
27
|
+
return locations
|
20
28
|
end
|
21
29
|
end
|
22
30
|
|
data/lib/geo-spider/site.rb
CHANGED
@@ -28,7 +28,7 @@ module GeoSpider
|
|
28
28
|
seen << url
|
29
29
|
next_links = (page.internal_links - seen - queue) # only add internal links that we've not seen or already have queued.
|
30
30
|
queue.concat(next_links)
|
31
|
-
rescue
|
31
|
+
rescue Timeout::Error => e
|
32
32
|
next
|
33
33
|
end
|
34
34
|
end
|
data/lib/geo-spider/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geo-spider
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Taylor
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-10-01 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|