yahoo_news 0.1.1 → 0.1.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
  SHA256:
3
- metadata.gz: 013cc6109e6cfdac550200af036d83fad3fa3e4653e64b4e7bd807fe11de33e2
4
- data.tar.gz: 10210205c43c9e637874522765b2b2751e591b601628b9b562e4ef896d36d001
3
+ metadata.gz: 9630dd23228d9544465804a30fd47299eba9c9c2f635c2fc4519b6737f62e06d
4
+ data.tar.gz: be913b49abe5cd3fc0a88cca9fc78a1bb7555aa9b258efbd01786ee995cb1e6a
5
5
  SHA512:
6
- metadata.gz: 0b178e840a262d53232b035dd15d551fd9c28f982be2d349a4afd94bd5a75303fb0e004d1ef6088fb36c4165517ed497d72a2f6ff46b4fc5edf3a1c6cb6ea212
7
- data.tar.gz: b0238adb499fcd1fba6e9b6bc761b844a39ea9090a2d8251c81f5a8bd6b37d10a4ae5f6a4a094f178a0477d8f1be1ecd7c6126bb3ad1e8925c9f812bcaa738f2
6
+ metadata.gz: d7c84b97553e151fe95150ad5678fa63b9a7d8f7e662ab4fb89613edce868ea0d6d16fc37aab2b7db2557439b24c37b8281e260d0b17e7f18b1002fc0bd33964
7
+ data.tar.gz: 773283f88a058c6c87234cc34e9f493d2768ba132b0a14c8aa3f117aeaadf983db29a9cd0ef802732dda7a7a54cb9f114b38bce15fa801791fcdc84a66d5dbf5
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- yahoo_news (0.1.1)
4
+ yahoo_news (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -8,27 +8,24 @@ module YahooNews
8
8
  file = open(input_url)
9
9
  str = file.read
10
10
 
11
- # get date
12
- str_date = str.match(/\d+時\d+分/)
11
+ # get time
12
+ str_time = str.match(/\d+時\d+分更新/)
13
13
 
14
14
  # news_table
15
- str = str.match(/<a href="https:\/\/news\.yahoo.co\.jp\/pickup\/\d+">.*<img src=".+><\/a><\/td><\/tr><tr><td>/)
15
+ str = str.match(%r(<a href="https://news.yahoo.co.jp/pickup/\d+">.*<img src=".+></a></td></tr><tr><td>))
16
16
 
17
17
  # get urls
18
- str_urls = URI.extract(str[0],['https'])
18
+ urls = URI.extract(str[0],['https'])
19
19
 
20
20
  # get article_titles
21
- str_titles = str[0].gsub!(/<("[^"]*"|'[^']*'|[^'">])*>/, "")
22
- str_titles = str_titles.split("・")
21
+ titles = str[0].gsub!(/<("[^"]*"|'[^']*'|[^'">])*>/, "")
22
+ titles = titles.split("・")
23
23
 
24
24
  # Make it hash structure.
25
- output_news = []
26
- for i in 0..str_urls.size-1 do
27
- output_news[i] = {"#{str_titles[i]}" => "#{str_urls[i]}"}
28
- end
25
+ output_news = titles.map.with_index { |title, i| { title: title, url: urls[i] } }
29
26
 
30
27
  # output news!
31
- puts str_date
28
+ puts str_time
32
29
  puts output_news
33
30
  end
34
31
  end
@@ -1,3 +1,3 @@
1
1
  module YahooNews
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yahoo_news
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - "“kubota-ryotaro”"