scotsman_obituaries 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/scotsman_obituaries.rb +17 -7
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 637bef29f84d5e89e5784e9a12c43917aea361ef
|
4
|
+
data.tar.gz: 71b7983ac4d3c2ae7f021c62a08eafbaf62437e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e08843ab70dc832700ebb5633a807252394a6dc5ccbe62f53f4e7abcd1e38cd31297fa02127e1adafb018fc4059770723676908c4453b18e8dbef55ded6cf61
|
7
|
+
data.tar.gz: 4c09772f9c540579e25ab07afbc73cbe7e93d4721bc468a2491bc2f6219b0bac59cf38033677ad9eabb9294395e1c506972c4ee5002b1208958f51ec17f5a8a8
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/scotsman_obituaries.rb
CHANGED
@@ -25,7 +25,7 @@ class ScotsmanObituaries
|
|
25
25
|
|
26
26
|
@cookie = raw_cookie.to_a.map {|key,val| "%s=%s" % [key, val]}.join '; '
|
27
27
|
|
28
|
-
@url_base = 'http://announce.jpress.co.uk
|
28
|
+
@url_base = 'http://announce.jpress.co.uk'
|
29
29
|
|
30
30
|
end
|
31
31
|
|
@@ -39,24 +39,34 @@ class ScotsmanObituaries
|
|
39
39
|
last_month: 31
|
40
40
|
}
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
url = @url_base + "search?keywords=#{title}&" + \
|
42
|
+
search_url = @url_base + "/search?keywords=#{title}&" + \
|
45
43
|
"date_limit=#{days[date_range.to_sym]}&date=" + \
|
46
44
|
"&type=obit&_fstatus=search&s_source=jpsc_scot"
|
47
45
|
|
48
|
-
s = open(
|
46
|
+
s = open(search_url, "Cookie" => @cookie).read
|
49
47
|
doc = Nokorexi.new(s).to_doc
|
50
48
|
e = doc.at_css '.results'
|
51
49
|
|
52
50
|
e.xpath('li/div[@class="notice"]').inject([]) do |r,notice|
|
51
|
+
|
53
52
|
heading = notice.text('h2/a')
|
54
53
|
short_text = notice.text('p').strip
|
55
54
|
pubdate = Date.parse(notice.\
|
56
55
|
element('meta[@itemprop="datePublished"]').attributes[:content])
|
57
|
-
|
56
|
+
id = notice.element('div/a').attributes[:href][/\/(\d+)\?/,1]
|
57
|
+
|
58
|
+
r << {id: id, heading: heading, short_text: short_text, pubdate: pubdate}
|
58
59
|
end
|
59
60
|
|
60
61
|
end
|
62
|
+
|
63
|
+
def more_info(id)
|
64
|
+
|
65
|
+
url = @url_base + '/edinburgh-evening-news-and-' + \
|
66
|
+
'scotsman-publications/obituary/' + id
|
67
|
+
s = open(url, "Cookie" => @cookie).read
|
68
|
+
Nokorexi.new(s).to_doc.at_css('.notice_text').text('p')
|
69
|
+
|
70
|
+
end
|
61
71
|
|
62
|
-
end
|
72
|
+
end
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|