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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0cf1c8c3df0011ed0e08f6eda8a4874547f93685
4
- data.tar.gz: 24f78733d9500b19a9a782fa5bfa14f31e159dbf
3
+ metadata.gz: 43f54063dd749b5b5c31a8e4b85fd50bd2efe7a8
4
+ data.tar.gz: 62b33af22bbcfa1f8761fae1909777b8df6aba73
5
5
  SHA512:
6
- metadata.gz: 1a900dbca5b142760bd8b48524b713bf8b32cd0e95737e8530cc14fd4ae2e926c7696d68fcf67398d9f4b08afff34b7ccc2e7c4a673a937d1013fcca4fbda5ff
7
- data.tar.gz: 4aad69efeddf805504b79ba6f39b9f45c87338489eb07853a65e9d1b4c6fa82ece2918834929f82a9afe14159cf585d0d7983b15f92d393b0c37a32e242f0566
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module YoutubeVideo
4
- VERSION = '0.2.5'
4
+ VERSION = '0.2.6'
5
5
  end
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 @channel_title
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 @channel_image_url
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 @channel_description
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
@@ -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['snippet']
69
- {
70
- 'title' => channel_data['title'],
71
- 'description' => channel_data['description'],
72
- 'image_url' => channel_data['thumbnails']['default']['url']
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
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.5
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-11-26 00:00:00.000000000 Z
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.5.1
225
+ rubygems_version: 2.6.8
226
226
  signing_key:
227
227
  specification_version: 4
228
228
  summary: Gets comment from public Youtube videos