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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 67127d4a4006a9601902aabf73d9bfd1110d6578
4
- data.tar.gz: 0abea0a938bea6ab9d323afc4bddc1569ce1056a
3
+ metadata.gz: 637bef29f84d5e89e5784e9a12c43917aea361ef
4
+ data.tar.gz: 71b7983ac4d3c2ae7f021c62a08eafbaf62437e0
5
5
  SHA512:
6
- metadata.gz: 01275c6869b398516657082c8c8d07cea78719aaacf4ca78a1604677381ab7ef9ec645dca29e1a6edd6e0e83f56136754d331838d14a3a9e22384b67f69e185d
7
- data.tar.gz: 88c731883d5beaf0c31ce238c812f108587122f288a4a78cf06c5d13329f42411cf75d2780535213b7bb41ba1b226fb172c4b920cd3b5557eef4421e56f5b9fd
6
+ metadata.gz: 4e08843ab70dc832700ebb5633a807252394a6dc5ccbe62f53f4e7abcd1e38cd31297fa02127e1adafb018fc4059770723676908c4453b18e8dbef55ded6cf61
7
+ data.tar.gz: 4c09772f9c540579e25ab07afbc73cbe7e93d4721bc468a2491bc2f6219b0bac59cf38033677ad9eabb9294395e1c506972c4ee5002b1208958f51ec17f5a8a8
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -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
- url = ''
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(url, "Cookie" => @cookie).read
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
- r << {heading: heading, short_text: short_text, pubdate: pubdate}
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
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scotsman_obituaries
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file