runaworld 0.1.2 → 0.2.0

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: f9d28abda91fb3134be9e8271664eba3a025aaa8293a148b4e8dfb7926d81d1f
4
- data.tar.gz: fbb8ae7744b3acb5eb9f6518b096985e85880d07a581e1763f484f41493d48cc
3
+ metadata.gz: bf61efd4f80d69f3eca26cf5c5f82cfcc0504021db8777396d00859ee725d5e4
4
+ data.tar.gz: 9d71deb28d23deeb0a7c223365832dfaa55ee915879d14f584b2afb229863252
5
5
  SHA512:
6
- metadata.gz: cec9ea9c963cf566a1b71447b283d6714b99a46c103121cdb024821cf4603e8b0d372f27ccbc1a970df7fdeb84ce5bed9a9c68175e6b9afaf7534bc4adedecea
7
- data.tar.gz: 3ab82dd1ba6a184ba36874708471007105473479eb51696bc5939ebe360d1ff0599aea135dc3cfae320608ed7314b9bb285f9f8f94c7a460a4d4abe081e778aa
6
+ metadata.gz: 9190700ee65ee88a2d7edb9fc50da436d5dc699d6ac0a7a17f7b215aa8c25b0c751b26918df339d2de1bd30c4cc5bf313bc534abb9e2d5c2dd3fdff6371d0efa
7
+ data.tar.gz: a8834b658ea8e0000adf33c58fb7f6ef6d85d8bf772570e94d7cbcfb8361630cad878644a5f715dff53c5bd864a3b24ef108fce1d757d68a8370b333c3afe626
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- runaworld (0.1.2)
4
+ runaworld (0.2.0)
5
5
  nokogiri
6
6
  thor
7
7
 
data/README.md CHANGED
@@ -23,7 +23,7 @@ And then execute:
23
23
 
24
24
  $ bundle
25
25
 
26
- それかコレインストール出来る、知らんけど!!!
26
+ それかコレでインストール出来る、知らんけど!!!
27
27
  Or install it yourself as:
28
28
 
29
29
  $ gem install runaworld
@@ -42,13 +42,29 @@ $ runaworld word #ランダムで1つ表示されるよ!!
42
42
 
43
43
  **月ちゃんの動画一覧を見たい??**
44
44
  ```
45
- $ runaworld move_list
45
+ $ runaworld move list
46
46
  ```
47
47
 
48
- ***月ちゃんの動画を1つだけ表示したい???**
48
+ **月ちゃんの動画を1つだけ表示したい???**
49
49
  ```
50
50
  $ runaworld move [NO]
51
- ```
51
+ ```
52
+
53
+ **月ちゃんの動画のタイトルだけ表示したい???**
54
+ ```
55
+ $ runaworld move title [NO]
56
+ ```
57
+
58
+ **月ちゃんの動画のURLだけ表示したい???**
59
+ ```
60
+ $ runaworld move url [NO]
61
+ ```
62
+
63
+ **月ちゃんの最新の動画を調べられるよ!!**
64
+ ```
65
+ $ runaworld move latest
66
+ ```
67
+
52
68
 
53
69
  ## Development
54
70
 
@@ -1,4 +1,5 @@
1
1
  require 'thor'
2
+
2
3
  module Runaworld
3
4
  class Cli < Thor
4
5
  desc "profile", "print profile of kaguya runa"
@@ -23,10 +24,23 @@ module Runaworld
23
24
  Runaworld::Move.get_move_list
24
25
  end
25
26
 
26
- desc "move [NO]", "print each move info"
27
- def move(no = 1)
28
- Runaworld::Move.get_move(no.to_i)
27
+ desc "move ['title' or 'url' or 'list' or 'latest' or NO] [NO]", "print each move info,is title and URL"
28
+ def move(mode = 1, no = 1)
29
+ case mode
30
+ when /^[0-9]+$/
31
+ no = mode
32
+ Runaworld::Move.get_move(no.to_i)
33
+ when 'url'
34
+ Runaworld::Move.get_move_url(no.to_i)
35
+ when 'title'
36
+ Runaworld::Move.get_move_title(no.to_i)
37
+ when 'list'
38
+ Runaworld::Move.get_move_list
39
+ when 'latest'
40
+ Runaworld::Move.get_move_latest
41
+ else
42
+ Runaworld::Move.get_move_list
43
+ end
29
44
  end
30
45
  end
31
46
  end
32
-
@@ -8,18 +8,51 @@ module Runaworld
8
8
  def get_move_list
9
9
  move_list = scraping_channel
10
10
  move_list.each_with_index do |m,i|
11
- print_info(i + 1, m[:title], m[:link])
11
+ print_info(i, m[:title], m[:link])
12
12
  end
13
13
  end
14
14
 
15
15
  def get_move(in_no)
16
- move_no = in_no - 1
16
+ move = get_move_array(in_no)
17
+ begin
18
+ print_info(in_no - 1 , move[:title], move[:link])
19
+ rescue => e
20
+ print_error
21
+ end
22
+ end
23
+
24
+ def get_move_url(in_no)
25
+ move = get_move_array(in_no)
26
+ begin
27
+ puts "https://www.youtube.com#{move[:link]}"
28
+ rescue => e
29
+ print_error
30
+ end
31
+ end
32
+
33
+ def get_move_title(in_no)
34
+ move = get_move_array(in_no)
35
+ begin
36
+ puts "#{move[:title]}"
37
+ rescue => e
38
+ print_error
39
+ end
40
+ end
41
+
42
+ def get_move_latest
17
43
  move_list = scraping_channel
18
- move = move_list[move_no]
19
- print_info(move_no, move[:title], move[:link])
44
+ move_no = move_list.length - 1
45
+ move_latest = move_list.last
46
+ print_info(move_no, move_latest[:title], move_latest[:link])
20
47
  end
21
48
 
22
49
  private
50
+ def get_move_array(in_no)
51
+ move_no = in_no - 1
52
+ move_list = scraping_channel
53
+ return move_list[move_no]
54
+ end
55
+
23
56
  def scraping_channel
24
57
  charset = nil
25
58
 
@@ -40,7 +73,11 @@ module Runaworld
40
73
  def print_info(no, title, link)
41
74
  puts "No.#{no + 1}"
42
75
  puts "タイトル: #{title}"
43
- puts "URL:https://www.youtube.com/#{link}"
76
+ puts "url:https://www.youtube.com#{link}"
77
+ end
78
+
79
+ def print_error
80
+ STDERR.puts "それエラーやないかーい"
44
81
  end
45
82
  end
46
83
  end
@@ -1,3 +1,3 @@
1
1
  module Runaworld
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runaworld
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - '723'
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-01 00:00:00.000000000 Z
11
+ date: 2018-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler