ruboty-youtube 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ruboty/handlers/youtube.rb +4 -4
- data/lib/ruboty/youtube/client.rb +4 -4
- data/lib/ruboty/youtube/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d46ea0b0bed1c945769613484e04633aeb0dc62
|
4
|
+
data.tar.gz: dbd26c4376260c0d5e795f33318894cba49f0c21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba47cddfb48053e29e48a518176f3fe71ba1e258b1177bcc70c274fd2abb94186610fc778ee978813999d0474fd90a5b7d1d8a2d0690d563900f4a5e8ed04956
|
7
|
+
data.tar.gz: 97e91dcb45c239c64ceb7beea49c410d29fcec3709b786a06093eebf83c626d2a628691004a14f5dd6dbab07c09d6e5ac481cc2f6d0942075889f500239c25bc
|
@@ -7,15 +7,15 @@ module Ruboty
|
|
7
7
|
result =
|
8
8
|
if message[:target]
|
9
9
|
Ruboty::Youtube::Client.new(
|
10
|
-
message[:
|
10
|
+
message[:target].to_sym,
|
11
11
|
message[:mode].to_sym,
|
12
|
-
message[:
|
12
|
+
message[:keyword]
|
13
13
|
).search
|
14
14
|
else
|
15
15
|
Ruboty::Youtube::Client.new(
|
16
|
-
|
16
|
+
:video,
|
17
17
|
message[:mode].to_sym,
|
18
|
-
:
|
18
|
+
message[:keyword]
|
19
19
|
).search
|
20
20
|
end
|
21
21
|
|
@@ -8,14 +8,14 @@ module Ruboty
|
|
8
8
|
class Client
|
9
9
|
YOUTUBE_URL = 'https://www.youtube.com'
|
10
10
|
|
11
|
-
def initialize(
|
11
|
+
def initialize(target, mode, query)
|
12
12
|
@conn = Faraday.new(url: YOUTUBE_URL, ssl: { verify: false }) do |faraday|
|
13
13
|
faraday.request :url_encoded
|
14
14
|
faraday.adapter Faraday.default_adapter
|
15
15
|
end
|
16
|
-
@query = query
|
17
|
-
@mode = mode
|
18
16
|
@target = target
|
17
|
+
@mode = mode
|
18
|
+
@query = query
|
19
19
|
end
|
20
20
|
|
21
21
|
def search
|
@@ -38,7 +38,7 @@ module Ruboty
|
|
38
38
|
case @mode
|
39
39
|
when :top
|
40
40
|
YOUTUBE_URL + result.first
|
41
|
-
when:rand
|
41
|
+
when :rand
|
42
42
|
YOUTUBE_URL + result.sample
|
43
43
|
end
|
44
44
|
end
|