YPBT 0.2.5 → 0.2.6
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/.gitignore +0 -0
- data/.rubocop.yml +0 -0
- data/.travis.yml +0 -0
- data/Gemfile +0 -0
- data/LICENSE +0 -0
- data/README.md +0 -0
- data/Rakefile +0 -0
- data/YPBT.gemspec +0 -0
- data/bin/YPBT +0 -0
- data/config/credentials.yml.example +0 -0
- data/lib/YPBT.rb +0 -0
- data/lib/YPBT/author.rb +0 -0
- data/lib/YPBT/comment.rb +0 -0
- data/lib/YPBT/runner.rb +0 -0
- data/lib/YPBT/time_tag.rb +0 -0
- data/lib/YPBT/version.rb +1 -1
- data/lib/YPBT/video.rb +8 -6
- data/lib/YPBT/youtube_api.rb +8 -6
- data/spec/Ytapi_spec.rb +0 -0
- data/spec/comment_spec.rb +0 -0
- data/spec/fixtures/cassettes/youtube_api.yml +0 -0
- data/spec/fixtures/yt_api_results.yml +0 -0
- data/spec/spec_helper.rb +0 -0
- data/spec/time_tag_spec.rb +0 -0
- data/spec/video_spec.rb +0 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43f54063dd749b5b5c31a8e4b85fd50bd2efe7a8
|
4
|
+
data.tar.gz: 62b33af22bbcfa1f8761fae1909777b8df6aba73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f98c1faa3b4907050e956bf8c3ade30848e2d43f4206cce03f89c07404669ccdfaeea2d2a40193ed04ea37466009212af93f5a12563455c1f640a1cd4f6e01d4
|
7
|
+
data.tar.gz: bb97550fc3dba0570833539fd8e66bc88118b4eea104aa7bd482b258cea08b1c0b289c90364f506012a44091a9b561c13c562bb6613db39c8daf62a5acf1566a
|
data/.gitignore
CHANGED
File without changes
|
data/.rubocop.yml
CHANGED
File without changes
|
data/.travis.yml
CHANGED
File without changes
|
data/Gemfile
CHANGED
File without changes
|
data/LICENSE
CHANGED
File without changes
|
data/README.md
CHANGED
File without changes
|
data/Rakefile
CHANGED
File without changes
|
data/YPBT.gemspec
CHANGED
File without changes
|
data/bin/YPBT
CHANGED
File without changes
|
File without changes
|
data/lib/YPBT.rb
CHANGED
File without changes
|
data/lib/YPBT/author.rb
CHANGED
File without changes
|
data/lib/YPBT/comment.rb
CHANGED
File without changes
|
data/lib/YPBT/runner.rb
CHANGED
File without changes
|
data/lib/YPBT/time_tag.rb
CHANGED
File without changes
|
data/lib/YPBT/version.rb
CHANGED
data/lib/YPBT/video.rb
CHANGED
@@ -17,6 +17,7 @@ module YoutubeVideo
|
|
17
17
|
@like_count = data['statistics']['likeCount'].to_i
|
18
18
|
@view_count = data['statistics']['viewCount'].to_i
|
19
19
|
@duration = data['contentDetails']['duration']
|
20
|
+
@is_channel = false
|
20
21
|
end
|
21
22
|
|
22
23
|
def comments
|
@@ -27,17 +28,17 @@ module YoutubeVideo
|
|
27
28
|
end
|
28
29
|
|
29
30
|
def channel_title
|
30
|
-
load_channel_info unless @
|
31
|
+
load_channel_info unless @is_channel
|
31
32
|
@channel_title
|
32
33
|
end
|
33
34
|
|
34
35
|
def channel_image_url
|
35
|
-
load_channel_info unless @
|
36
|
+
load_channel_info unless @is_channel
|
36
37
|
@channel_image_url
|
37
38
|
end
|
38
39
|
|
39
40
|
def channel_description
|
40
|
-
load_channel_info unless @
|
41
|
+
load_channel_info unless @is_channel
|
41
42
|
@channel_description
|
42
43
|
end
|
43
44
|
|
@@ -55,9 +56,10 @@ module YoutubeVideo
|
|
55
56
|
|
56
57
|
def load_channel_info
|
57
58
|
channel_data = YtApi.channel_info @channel_id
|
58
|
-
@channel_title = channel_data['title']
|
59
|
-
@channel_image_url = channel_data['image_url']
|
60
|
-
@channel_description = channel_data['description']
|
59
|
+
@channel_title = channel_data['title'] if channel_data
|
60
|
+
@channel_image_url = channel_data['image_url'] if channel_data
|
61
|
+
@channel_description = channel_data['description'] if channel_data
|
62
|
+
@is_channel = true
|
61
63
|
end
|
62
64
|
end
|
63
65
|
end
|
data/lib/YPBT/youtube_api.rb
CHANGED
@@ -65,12 +65,14 @@ module YoutubeVideo
|
|
65
65
|
key: api_key,
|
66
66
|
part: 'snippet',
|
67
67
|
fields: fields })
|
68
|
-
channel_data = JSON.parse(channel_response.to_s)['items'].first
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
68
|
+
channel_data = JSON.parse(channel_response.to_s)['items'].first
|
69
|
+
if channel_data
|
70
|
+
{
|
71
|
+
'title' => channel_data['snippet']['title'],
|
72
|
+
'description' => channel_data['snippet']['description'],
|
73
|
+
'image_url' => channel_data['snippet']['thumbnails']['default']['url']
|
74
|
+
}
|
75
|
+
end
|
74
76
|
end
|
75
77
|
|
76
78
|
def self.extract_comment(comment_threads)
|
data/spec/Ytapi_spec.rb
CHANGED
File without changes
|
data/spec/comment_spec.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
data/spec/spec_helper.rb
CHANGED
File without changes
|
data/spec/time_tag_spec.rb
CHANGED
File without changes
|
data/spec/video_spec.rb
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: YPBT
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yi-Min
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-
|
13
|
+
date: 2016-12-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: http
|
@@ -222,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
222
222
|
version: '0'
|
223
223
|
requirements: []
|
224
224
|
rubyforge_project:
|
225
|
-
rubygems_version: 2.
|
225
|
+
rubygems_version: 2.6.8
|
226
226
|
signing_key:
|
227
227
|
specification_version: 4
|
228
228
|
summary: Gets comment from public Youtube videos
|