youku_video_utility 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/lib/youku_video_utility.rb +43 -0
- metadata +43 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MDdjYTA2MzMwZmJjOTQ4N2RjMDMxNTU3NWVlZDY1ZTVmOWJkM2Y1Ng==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
N2MwYjZkOGMyYTM3NmU4ZWU1MzVlODUwMzc5YTI5NmI1MzliY2NjOQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NzM4Y2U3OTExZTZmNWNkZjIwMTRjNTI2MjliOTI5ZjMwNTc3MDE0NWQ1MjUw
|
10
|
+
NmRiZTQ5Y2EzNWI1OTY4ZDYyN2E3OGVjOTliNTU4MzBjOWJlOTNlMGMyNzY1
|
11
|
+
ZDhlNTA3NjRmMzNkMmY4ZjQ2ZDdlZDJjNzY2ODBiNzgwNmRlYmM=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZWZkN2QwMDg5M2U5YjkwM2Y3OGY1MmIwNmZlMTQxMjQ3NmM0MjU5MjRjNmRl
|
14
|
+
YTJlMzFiOTU0ZWNiZjU5M2I0YmEzYzZlMzkzZjU3Y2E1NjM5MzBjMjZkZmFl
|
15
|
+
NzIzMzU4NTc0ZDA3YjE5YWRkOTVlOWE0ZWY5ZTJlYTJkY2UzOWM=
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'base64'
|
2
|
+
class YoukuVideoUtility
|
3
|
+
def self.get_encoded_video_id_from_integer integer
|
4
|
+
shifted_integer = Integer(integer) << 2 rescue ''
|
5
|
+
encoded_video_id = Base64.encode64 "#{shifted_integer}"
|
6
|
+
if encoded_video_id != ''
|
7
|
+
result = "X#{encoded_video_id}".chomp
|
8
|
+
else
|
9
|
+
result = "INVALID: #{integer}"
|
10
|
+
end
|
11
|
+
result
|
12
|
+
end
|
13
|
+
def self.get_encoded_show_id_from_integer integer
|
14
|
+
shifted_integer = Integer(integer) << 2 rescue ''
|
15
|
+
encoded_show_id = Base64.encode64 "#{shifted_integer}"
|
16
|
+
if encoded_show_id != ''
|
17
|
+
result = encoded_show_id.chomp
|
18
|
+
else
|
19
|
+
result = "INVALID: #{integer}"
|
20
|
+
end
|
21
|
+
result
|
22
|
+
end
|
23
|
+
|
24
|
+
def get_extra_info show_id
|
25
|
+
host = '10.103.88.54'
|
26
|
+
url = '/show.show'
|
27
|
+
query = {
|
28
|
+
:query => {
|
29
|
+
:ft => 'json',
|
30
|
+
:q => "showid:#{show_id}",
|
31
|
+
:fd => "showid pk_odshow showname showtotal_vv showcategory
|
32
|
+
avg_rating showsubtitle show_thumburl show_vthumburl completed episode_total
|
33
|
+
episode_last releasedate_youku lastepisode_videoid showdesc
|
34
|
+
"
|
35
|
+
}
|
36
|
+
}
|
37
|
+
response = HTTParty.get("http://#{host}#{url}", query)
|
38
|
+
return nil if response.code >= 400
|
39
|
+
json = JSON.parse response.body
|
40
|
+
return nil if json['results'].blank? || json['results'].first.blank?
|
41
|
+
return json['results'].first
|
42
|
+
end
|
43
|
+
end
|
metadata
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: youku_video_utility
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Siwei
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-12-20 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: youku video utility
|
14
|
+
email: shensiwei@youku.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/youku_video_utility.rb
|
20
|
+
homepage: http://rubygems.org/gems/youku_video_utility
|
21
|
+
licenses: []
|
22
|
+
metadata: {}
|
23
|
+
post_install_message:
|
24
|
+
rdoc_options: []
|
25
|
+
require_paths:
|
26
|
+
- lib
|
27
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ! '>='
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '0'
|
32
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ! '>='
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
requirements: []
|
38
|
+
rubyforge_project:
|
39
|
+
rubygems_version: 2.0.7
|
40
|
+
signing_key:
|
41
|
+
specification_version: 4
|
42
|
+
summary: youku video utility
|
43
|
+
test_files: []
|