treccani 0.2 → 0.3
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d61e90479eb0350bd2e913ee7cda4331326e6e48
|
4
|
+
data.tar.gz: a15b26b7f7a1116efea82b2d10a43bf0caefb32e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20f9c7e072fe856a3c3c816355d8597e2520a1b0618aef77949faae6fc898635465f0889661533a6d06a6719bd51c927ca05c77a1c4c5fac49a5240857f141ea
|
7
|
+
data.tar.gz: aaa3c9df725b230088d3952ecd0c630f523aecbe51c657c9ede201db4ff1e4ab63bd2e8f3ca24bfab3ea3bffb207e6839a1164168b05a1343ec7c775d5cac003
|
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
class Enciclopedia < Treccani
|
12
12
|
def get(word)
|
13
|
-
page = Nokogiri::HTML open(
|
13
|
+
page = Nokogiri::HTML open(get_url(word))
|
14
14
|
{}.tap { |result|
|
15
15
|
page = page.xpath '//div[@class="spiega attacco"]/p'
|
16
16
|
result[:lemma] = page.shift.text.strip
|
@@ -23,6 +23,6 @@ class Enciclopedia < Treccani
|
|
23
23
|
def get_url(word)
|
24
24
|
url = Nokogiri::HTML(open("#{@server}/enciclopedia/ricerca/#{word}/")).at_xpath('//ol[@class="listing"]/li/h2/a/@href').to_s
|
25
25
|
raise 'Term not found.' if url.empty?
|
26
|
-
url
|
26
|
+
"#{@server}#{url}"
|
27
27
|
end
|
28
28
|
end
|
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
class Sinonimi < Treccani
|
12
12
|
def get(word)
|
13
|
-
page = Nokogiri::HTML open(
|
13
|
+
page = Nokogiri::HTML open(get_url(word))
|
14
14
|
page.at_xpath('//div[@class="spiega attacco"]/p').text.strip
|
15
15
|
end
|
16
16
|
alias_method :find, :get
|
@@ -18,6 +18,6 @@ class Sinonimi < Treccani
|
|
18
18
|
def get_url(word)
|
19
19
|
url = Nokogiri::HTML(open("#{@server}/vocabolario/ricerca/#{word}/Sinonimi_e_Contrari/")).at_xpath('//li[@class="result fs"]/h2/a/@href').to_s
|
20
20
|
raise 'Term not found.' if url.empty?
|
21
|
-
url
|
21
|
+
"#{@server}#{url}"
|
22
22
|
end
|
23
23
|
end
|
@@ -11,7 +11,7 @@
|
|
11
11
|
class Vocabolario < Treccani
|
12
12
|
def get(word)
|
13
13
|
{}.tap { |result|
|
14
|
-
page = Nokogiri::HTML open(
|
14
|
+
page = Nokogiri::HTML open(get_url(word))
|
15
15
|
wot = page.at_xpath('//div[@class="spiega attacco"]/p').to_s.split '<br><br>'
|
16
16
|
result[:lemma] = wot.shift.remove_tags[0..-4].strip
|
17
17
|
result[:meanings] = wot.join.split(/<strong>[0-9]\.<\/strong>/i).map { |m| m.remove_tags.strip }[1..-1]
|
@@ -22,6 +22,6 @@ class Vocabolario < Treccani
|
|
22
22
|
def get_url(word)
|
23
23
|
url = Nokogiri::HTML(open("#{@server}/vocabolario/tag/#{word}/")).at_xpath('//li[@class="result fs"]/h2/a/@href').to_s
|
24
24
|
raise 'Term not found.' if url.empty?
|
25
|
-
url
|
25
|
+
"#{@server}#{url}"
|
26
26
|
end
|
27
27
|
end
|
data/lib/treccani/version.rb
CHANGED