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 +4 -4
- data/Gemfile +1 -0
- data/README.md +5 -0
- data/lib/babymetal.rb +25 -0
- data/lib/babymetal/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 564449e4cbc72086b34ceb4c4331196ebe9c235e
|
4
|
+
data.tar.gz: 7794eaa240d447d968cb832f1de35ba2f49c85f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed8b0098b4d0c731b0333428a11433d4f440189d1309be71a8e63e66e2a0ff5d24888181394ee74a502bfe02258cf0b37e1719a7aa3691eaafafcd24ab1329a1
|
7
|
+
data.tar.gz: df497224447ac2229a64e93affb621952244553baf514450930bdeb2b4db10078130be7cfd0cfc9771270405458a9596ccbb9585d83c44405ce0a612758836e9
|
data/Gemfile
CHANGED
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
|
data/lib/babymetal.rb
CHANGED
@@ -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
|
data/lib/babymetal/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2016-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|