YPBT 0.2.9 → 0.2.10
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 +5 -5
- data/.gitignore +4 -4
- data/.rubocop.yml +3 -3
- data/.travis.yml +7 -7
- data/Gemfile +4 -4
- data/LICENSE +22 -22
- data/README.md +47 -47
- data/Rakefile +58 -58
- data/YPBT.gemspec +36 -34
- data/bin/YPBT +7 -7
- data/config/credentials.yml.example +0 -0
- data/lib/YPBT.rb +4 -4
- data/lib/YPBT/author.rb +15 -15
- data/lib/YPBT/comment.rb +33 -33
- data/lib/YPBT/runner.rb +38 -37
- data/lib/YPBT/time_tag.rb +55 -55
- data/lib/YPBT/version.rb +5 -5
- data/lib/YPBT/video.rb +73 -73
- data/lib/YPBT/youtube_api.rb +127 -127
- data/spec/Ytapi_spec.rb +73 -73
- data/spec/comment_spec.rb +30 -30
- data/spec/fixtures/cassettes/youtube_api.yml +0 -0
- data/spec/fixtures/yt_api_results.yml +81 -81
- data/spec/spec_helper.rb +29 -29
- data/spec/time_tag_spec.rb +31 -31
- data/spec/video_spec.rb +61 -61
- metadata +4 -5
data/spec/video_spec.rb
CHANGED
@@ -1,61 +1,61 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require_relative 'spec_helper.rb'
|
3
|
-
|
4
|
-
describe 'Video specifications' do
|
5
|
-
VCR.configure do |c|
|
6
|
-
c.cassette_library_dir = CASSETTES_FOLDER
|
7
|
-
c.hook_into :webmock
|
8
|
-
|
9
|
-
c.filter_sensitive_data('<API_KEY>') { ENV['YOUTUBE_API_KEY'] }
|
10
|
-
c.filter_sensitive_data('<API_KEY_ESCAPED>') do
|
11
|
-
URI.escape(ENV['YOUTUBE_API_KEY'])
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
before do
|
16
|
-
VCR.insert_cassette CASSETTE_FILE, record: :new_episodes
|
17
|
-
end
|
18
|
-
|
19
|
-
after do
|
20
|
-
VCR.eject_cassette
|
21
|
-
end
|
22
|
-
|
23
|
-
describe 'YtApi Credentials' do
|
24
|
-
it 'should be able to get a new api key with ENV credentials' do
|
25
|
-
YoutubeVideo::YtApi.api_key.length.must_be :>, 0
|
26
|
-
end
|
27
|
-
it 'should be able to get a new access token with file credentials' do
|
28
|
-
YoutubeVideo::YtApi.config = { api_key: ENV['YOUTUBE_API_KEY'] }
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'should be able to open a video' do
|
32
|
-
video = YoutubeVideo::Video.find(
|
33
|
-
video_id: TEST_VIDEO_ID
|
34
|
-
)
|
35
|
-
video.title.length.must_be :>, 0
|
36
|
-
video.channel_id.length.must_be :>, 0
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'should have comments' do
|
40
|
-
video = YoutubeVideo::Video.find(video_id: TEST_VIDEO_ID)
|
41
|
-
video.comments.length.must_be :>, 1
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'should have channel information' do
|
45
|
-
video = YoutubeVideo::Video.find(video_id: TEST_VIDEO_ID)
|
46
|
-
video.title.length.must_be :>, 0
|
47
|
-
video.channel_description.length.must_be :>, 0
|
48
|
-
video.channel_image_url.must_match(/https:/)
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'should able to get popular videos' do
|
52
|
-
videos = YoutubeVideo::Video.find_popular(max_results: 25)
|
53
|
-
videos.length.must_be :==, 25
|
54
|
-
end
|
55
|
-
|
56
|
-
it 'should run the executable file' do
|
57
|
-
output = `YPBT #{TEST_VIDEO_ID}`
|
58
|
-
output.split("\n").length.must_be :>, 5
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative 'spec_helper.rb'
|
3
|
+
|
4
|
+
describe 'Video specifications' do
|
5
|
+
VCR.configure do |c|
|
6
|
+
c.cassette_library_dir = CASSETTES_FOLDER
|
7
|
+
c.hook_into :webmock
|
8
|
+
|
9
|
+
c.filter_sensitive_data('<API_KEY>') { ENV['YOUTUBE_API_KEY'] }
|
10
|
+
c.filter_sensitive_data('<API_KEY_ESCAPED>') do
|
11
|
+
URI.escape(ENV['YOUTUBE_API_KEY'])
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
before do
|
16
|
+
VCR.insert_cassette CASSETTE_FILE, record: :new_episodes
|
17
|
+
end
|
18
|
+
|
19
|
+
after do
|
20
|
+
VCR.eject_cassette
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'YtApi Credentials' do
|
24
|
+
it 'should be able to get a new api key with ENV credentials' do
|
25
|
+
YoutubeVideo::YtApi.api_key.length.must_be :>, 0
|
26
|
+
end
|
27
|
+
it 'should be able to get a new access token with file credentials' do
|
28
|
+
YoutubeVideo::YtApi.config = { api_key: ENV['YOUTUBE_API_KEY'] }
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should be able to open a video' do
|
32
|
+
video = YoutubeVideo::Video.find(
|
33
|
+
video_id: TEST_VIDEO_ID
|
34
|
+
)
|
35
|
+
video.title.length.must_be :>, 0
|
36
|
+
video.channel_id.length.must_be :>, 0
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should have comments' do
|
40
|
+
video = YoutubeVideo::Video.find(video_id: TEST_VIDEO_ID)
|
41
|
+
video.comments.length.must_be :>, 1
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should have channel information' do
|
45
|
+
video = YoutubeVideo::Video.find(video_id: TEST_VIDEO_ID)
|
46
|
+
video.title.length.must_be :>, 0
|
47
|
+
video.channel_description.length.must_be :>, 0
|
48
|
+
video.channel_image_url.must_match(/https:/)
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'should able to get popular videos' do
|
52
|
+
videos = YoutubeVideo::Video.find_popular(max_results: 25)
|
53
|
+
videos.length.must_be :==, 25
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'should run the executable file' do
|
57
|
+
output = `YPBT #{TEST_VIDEO_ID}`
|
58
|
+
output.split("\n").length.must_be :>, 5
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
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.10
|
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:
|
13
|
+
date: 2020-10-31 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: http
|
@@ -214,15 +214,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
214
214
|
requirements:
|
215
215
|
- - ">="
|
216
216
|
- !ruby/object:Gem::Version
|
217
|
-
version: '
|
217
|
+
version: '2.6'
|
218
218
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
219
219
|
requirements:
|
220
220
|
- - ">="
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: '0'
|
223
223
|
requirements: []
|
224
|
-
|
225
|
-
rubygems_version: 2.6.8
|
224
|
+
rubygems_version: 3.0.8
|
226
225
|
signing_key:
|
227
226
|
specification_version: 4
|
228
227
|
summary: Gets comment from public Youtube videos
|