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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 15d8cf14d9ff693a5be790b8a6d9d41a91f3e8c6
4
- data.tar.gz: 41f6dfbaa1761e0533777c025a6325435f15f0af
3
+ metadata.gz: 78774197fa722d2d9afaa66daf56e481ae685c02
4
+ data.tar.gz: c70e9a3a4f47af51241a0d78f6e8b3c02e14f951
5
5
  SHA512:
6
- metadata.gz: 4ef6cff84db2576d92f474fb77abd6076123cdcd312dd2b3003905eb29392fa28758d7760c1116883cb76f99593942e0e97acacfc244998dcdbd5387ebf0e839
7
- data.tar.gz: 5509f53e6d7e5b1fe18cb2e7f4d91a9622b3f2f36967608e6a109ed8ae535899ef14aa718df13de648e66082acc3275ad034d25ff69571a63c22c9d0fffcd392
6
+ metadata.gz: ee2fb86a7db00b34916d1807ae73503b0359629574010856a2c3e1a4dc0d7c89d2e5b18fbcdb6a6bbd7f9751bf2baf535f1732ebb829b490366bed50ed40436c
7
+ data.tar.gz: 0b36b446530a01b4370c67858fed8e14394d6b8438133fe3131c224b93cf46248d16585efb3feb7a2d218ba3cc5e8a0d7e0dc74edc1ac5a730f5bc13885fcb93
@@ -3,11 +3,18 @@ require 'youku'
3
3
 
4
4
  YouKu.set_appkey '40b71bbe320eaf69'
5
5
 
6
- puts YouKu.categories
7
- result = YouKu.shows_in_category('电视剧')
8
- puts result['total']
9
- puts result['shows'].first
10
- puts YouKu.videos_in_show(result['shows'].first['id'])
11
-
12
- puts YouKu.playlist(21197898)
13
- puts YouKu.videos_in_playlist(21197898)
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']
@@ -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
- videos_in_playlist_url = 'https://openapi.youku.com/v2/playlists/show.json'
76
+ playlist_url = 'https://openapi.youku.com/v2/playlists/show.json'
51
77
  msg = YouKu::Message.new
52
- result = MultiJson.load(msg.send(videos_in_playlist_url, {playlist_id: playlist_id}))
78
+ result = MultiJson.load(msg.send(playlist_url, {playlist_id: playlist_id}))
53
79
  result
54
80
  end
55
81
 
@@ -1,3 +1,3 @@
1
1
  module Youku
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
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.3
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.3
106
+ rubygems_version: 2.0.6
107
107
  signing_key:
108
108
  specification_version: 4
109
109
  summary: open.youku.com 的ruby实现