youku 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/examples/test.rb +15 -8
- data/lib/youku/message.rb +29 -3
- data/lib/youku/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: 78774197fa722d2d9afaa66daf56e481ae685c02
|
4
|
+
data.tar.gz: c70e9a3a4f47af51241a0d78f6e8b3c02e14f951
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee2fb86a7db00b34916d1807ae73503b0359629574010856a2c3e1a4dc0d7c89d2e5b18fbcdb6a6bbd7f9751bf2baf535f1732ebb829b490366bed50ed40436c
|
7
|
+
data.tar.gz: 0b36b446530a01b4370c67858fed8e14394d6b8438133fe3131c224b93cf46248d16585efb3feb7a2d218ba3cc5e8a0d7e0dc74edc1ac5a730f5bc13885fcb93
|
data/examples/test.rb
CHANGED
@@ -3,11 +3,18 @@ require 'youku'
|
|
3
3
|
|
4
4
|
YouKu.set_appkey '40b71bbe320eaf69'
|
5
5
|
|
6
|
-
|
7
|
-
result = YouKu.shows_in_category('电视剧')
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
# YouKu.categories
|
7
|
+
# result = YouKu.shows_in_category('电视剧')
|
8
|
+
# result['total']
|
9
|
+
# result['shows'].first
|
10
|
+
# YouKu.videos_in_show(result['shows'].first['id'])
|
11
|
+
|
12
|
+
YouKu.playlist(21197898)
|
13
|
+
videos = YouKu.videos_in_playlist(21197898)
|
14
|
+
|
15
|
+
|
16
|
+
comments = YouKu.comments_by_video videos['videos'].first['id']
|
17
|
+
|
18
|
+
comment = YouKu.comment comments['comments'].first['id']
|
19
|
+
|
20
|
+
puts YouKu.user comment['user']['id']
|
data/lib/youku/message.rb
CHANGED
@@ -22,7 +22,14 @@ module YouKu
|
|
22
22
|
def self.set_appkey key
|
23
23
|
Message.appkey = key
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
|
+
def self.user user_id
|
27
|
+
user_url = 'https://openapi.youku.com/v2/users/show.json'
|
28
|
+
msg = YouKu::Message.new
|
29
|
+
result = MultiJson.load(msg.send(user_url, {user_id: user_id}))
|
30
|
+
result
|
31
|
+
end
|
32
|
+
|
26
33
|
def self.categories
|
27
34
|
video_category_url = 'https://openapi.youku.com/v2/schemas/video/category.json'
|
28
35
|
msg = YouKu::Message.new
|
@@ -46,10 +53,29 @@ module YouKu
|
|
46
53
|
result
|
47
54
|
end
|
48
55
|
|
56
|
+
def self.comments_by_video video_id, options = {}
|
57
|
+
op = {
|
58
|
+
video_id: video_id,
|
59
|
+
page: 1,
|
60
|
+
count: 30
|
61
|
+
}.merge(options)
|
62
|
+
comment_by_video_url = 'https://openapi.youku.com/v2/comments/by_video.json'
|
63
|
+
msg = YouKu::Message.new
|
64
|
+
result = MultiJson.load(msg.send(comment_by_video_url, op))
|
65
|
+
result
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.comment comment_id
|
69
|
+
comment_url = 'https://openapi.youku.com/v2/comments/show.json'
|
70
|
+
msg = YouKu::Message.new
|
71
|
+
result = MultiJson.load(msg.send(comment_url, {comment_id: comment_id}))
|
72
|
+
result
|
73
|
+
end
|
74
|
+
|
49
75
|
def self.playlist playlist_id
|
50
|
-
|
76
|
+
playlist_url = 'https://openapi.youku.com/v2/playlists/show.json'
|
51
77
|
msg = YouKu::Message.new
|
52
|
-
result = MultiJson.load(msg.send(
|
78
|
+
result = MultiJson.load(msg.send(playlist_url, {playlist_id: playlist_id}))
|
53
79
|
result
|
54
80
|
end
|
55
81
|
|
data/lib/youku/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: youku
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jimxl
|
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
103
|
version: '0'
|
104
104
|
requirements: []
|
105
105
|
rubyforge_project:
|
106
|
-
rubygems_version: 2.0.
|
106
|
+
rubygems_version: 2.0.6
|
107
107
|
signing_key:
|
108
108
|
specification_version: 4
|
109
109
|
summary: open.youku.com 的ruby实现
|