ruboty-youtube 0.0.2 → 0.0.3

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: 01271da19abfd2f82e2559926460a955ed4045ef
4
- data.tar.gz: cfe2bb7b9da167a6f5c728e634731ac4093cf8a5
3
+ metadata.gz: 936be7ef0fc77c3364df0a6903bcfd1d7620ea93
4
+ data.tar.gz: 23f464843114b392339e8a58cd33d47768843e8d
5
5
  SHA512:
6
- metadata.gz: a46ebbef24baee29293c179d72cc826610afb35fb2db1109ae3daea6d3f714d4d6c91cae12f209b6d8e1bbf5bb3f9267ccf91a1680a75285e3c90faf2fa4ef2d
7
- data.tar.gz: 6886af5e9036d931e6488459b010cf2beed9bbcebaa07b0db78452e69974b919bba21c5b34439ae38d533bfdce8024fd32f211e9d63aa8a88798b7d6e58eba48
6
+ metadata.gz: a0bd2a5ce8c9f7836842630c35f48f77202eb927626f7c45a90aa88258746a77ffa74a25e8931022bb1d1b6d5279e32741d79a816337e40474c3a774e00d0624
7
+ data.tar.gz: 01bb40fd01dadfa942d48db6b51ac10719a6bfd929e0c59bb094bf13be8b10cb81cd68dd53f4a59e1291e06f5eb01bcff5c535177414e4e87045992431a0e84d
data/README.md CHANGED
@@ -16,4 +16,5 @@ gem 'ruboty-youtube'
16
16
  @ruboty yt top <keyword> - Search a movie from YouTube
17
17
  @ruboty yt rand <keyword> - Search a movie randomly from YouTube
18
18
  @ruboty yt pl <keyword> - Search a playlist from YouTube
19
+ @ruboty yt pls <keyword> - Search a playlist randomly from YouTube
19
20
  ```
@@ -1,7 +1,7 @@
1
1
  module Ruboty
2
2
  module Handlers
3
3
  class Youtube < Base
4
- on /yt (?<mode>.+?) (?<keyword>.+)/, name: 'yt', description: 'Search a movie from YouTube'
4
+ on /yt (?<mode>.+?) (?<keyword>.+)/, name: 'yt', description: 'Search from YouTube'
5
5
 
6
6
  def yt(message)
7
7
  if url = search(message[:keyword], message[:mode].to_sym)
@@ -37,7 +37,8 @@ module Ruboty
37
37
  when :top, :rand
38
38
  # when @mode is :top -> videos.length is 1
39
39
  videos.sample['link'][0]['href']
40
- when :pl
40
+ when :pl, :pls
41
+ # when @mode is :pl -> videos.length is 1
41
42
  pl_url = videos.sample['link'][1]['href']
42
43
  page = @agent.get(pl_url)
43
44
  YOUTUBE_URL + page.link_with(href: /\/watch/).href
@@ -48,7 +49,7 @@ module Ruboty
48
49
  case @mode
49
50
  when :top, :rand
50
51
  '/feeds/api/videos'
51
- when :pl
52
+ when :pl, :pls
52
53
  '/feeds/api/playlists/snippets'
53
54
  end
54
55
  end
@@ -76,6 +77,11 @@ module Ruboty
76
77
  v: 2,
77
78
  'max-results' => 1
78
79
  }
80
+ when :pls
81
+ {
82
+ v: 2,
83
+ 'max-results' => 15
84
+ }
79
85
  end
80
86
 
81
87
  default_params.merge(params)
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module Youtube
3
- VERSION = '0.0.2'
3
+ VERSION = '0.0.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruboty-youtube
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - kaihar4
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-13 00:00:00.000000000 Z
11
+ date: 2014-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruboty