babymetal 0.1.7 → 0.1.8

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: 48999bd8f289868b82a352aa680740db08fe694c
4
- data.tar.gz: 372fc8a63411fffe2f2d5ea3745f8c10a4046d6d
3
+ metadata.gz: 564449e4cbc72086b34ceb4c4331196ebe9c235e
4
+ data.tar.gz: 7794eaa240d447d968cb832f1de35ba2f49c85f4
5
5
  SHA512:
6
- metadata.gz: c6b9e4572bf1423916551a3a91155d5568a93559e0c80d2c32ee378b8f1bda5b1401f0aaead815c7a907ade0d60bf1c445ccc8c1437267750bb64782f264f14c
7
- data.tar.gz: 76981880224c7619a5ee2e62d309e05523042c36750d32301abc5e0f642833375c36c0780d6acd742822a5fa2b180dcc40d18af5fe9b9545254b442bbe21707a
6
+ metadata.gz: ed8b0098b4d0c731b0333428a11433d4f440189d1309be71a8e63e66e2a0ff5d24888181394ee74a502bfe02258cf0b37e1719a7aa3691eaafafcd24ab1329a1
7
+ data.tar.gz: df497224447ac2229a64e93affb621952244553baf514450930bdeb2b4db10078130be7cfd0cfc9771270405458a9596ccbb9585d83c44405ce0a612758836e9
data/Gemfile CHANGED
@@ -3,3 +3,4 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in babymetal.gemspec
4
4
  gemspec
5
5
 
6
+ gem "nokogiri"
data/README.md CHANGED
@@ -23,12 +23,17 @@ Or install it yourself as:
23
23
  ```ruby
24
24
  require "babymetal"
25
25
 
26
+ # URLs
26
27
  Babymetal::homepage
27
28
  Babymetal::youtube
28
29
  Babymetal::facebook
29
30
  Babymetal::instagram
30
31
  Babymetal::twitter
31
32
 
33
+ # BABYMETAL Official Site News
34
+ japanese_news = Babymetal::news
35
+ english_news = Babymetal::news("en")
36
+
32
37
  su_metal = Babymetal::SuMetal.new
33
38
  yui_metal = Babymetal::YuiMetal.new
34
39
  moa_metal = Babymetal::MoaMetal.new
@@ -5,9 +5,34 @@ require "babymetal/yui_metal"
5
5
  require "babymetal/moa_metal"
6
6
  require "babymetal/member"
7
7
  require "date"
8
+ require "open-uri"
9
+ require "nokogiri"
8
10
 
9
11
  module Babymetal
10
12
  def self.shout
11
13
  Babymetal::Member.new.shout
12
14
  end
15
+
16
+ def self.news(lang = "ja")
17
+ lang = "en" if lang != "ja"
18
+ base_url = { "ja" => "http://www.babymetal.jp", "en" => "http://www.babymetal.com" }
19
+ res = OpenURI.open_uri("#{base_url[lang]}/news")
20
+
21
+ news = []
22
+ html = Nokogiri::HTML.parse(res.read, nil, "UTF-8")
23
+ html.xpath('//div[@class="contents_column_box"]').each do |node|
24
+ date = node.xpath('div[@class="column_under_right_line"]').text
25
+ .gsub(/Posted : (\d{4})\.(\d{2})\.(\d{2})/,'\1-\2-\3')
26
+
27
+ title = node.xpath('div[@class="contents_title"]').text
28
+
29
+ url = node.xpath("div/div/div/a/@data-url").to_s
30
+ .gsub "http://www.en.babymetal.jp", base_url["en"]
31
+
32
+ news.push( {date: date, title: title, url: url} ) if date != ""
33
+ end
34
+
35
+ news
36
+ end
37
+
13
38
  end
@@ -1,3 +1,3 @@
1
1
  module Babymetal
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: babymetal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hondallica
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-13 00:00:00.000000000 Z
11
+ date: 2016-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler