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/Ytapi_spec.rb
CHANGED
@@ -1,73 +1,73 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require_relative 'spec_helper.rb'
|
3
|
-
|
4
|
-
describe 'YtApi 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
|
-
end
|
31
|
-
|
32
|
-
describe 'YtApi functions' do
|
33
|
-
it 'should be able to find video by video id' do
|
34
|
-
YoutubeVideo::YtApi.video_info(TEST_VIDEO_ID).must_be_instance_of Hash
|
35
|
-
end
|
36
|
-
|
37
|
-
it 'should be able find comment by comment id' do
|
38
|
-
result = YoutubeVideo::YtApi.comment_info(TEST_COMMENT_ID)
|
39
|
-
result.must_be_instance_of Hash
|
40
|
-
result['id'].must_equal TEST_COMMENT_ID
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'should be able find comments by video id' do
|
44
|
-
next_page_token, comments = YoutubeVideo::YtApi
|
45
|
-
.video_comments_info(TEST_VIDEO_ID)
|
46
|
-
next_page_token.must_be_instance_of String
|
47
|
-
comments.must_be_instance_of Array
|
48
|
-
comments.length.must_be :>, 1
|
49
|
-
comments[0].must_be_instance_of Hash
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'should be able find comments that contain time tags by video_id' do
|
53
|
-
comments = YoutubeVideo::YtApi.time_tags_info(TEST_VIDEO_ID)
|
54
|
-
comments.must_be_instance_of Array
|
55
|
-
comments.length.must_be :>, 1
|
56
|
-
comments[0].must_be_instance_of Hash
|
57
|
-
comments[0]['textDisplay'].must_match(/[0-9]+:\d+/)
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'should be able to resolve channel' do
|
61
|
-
channel_info = YoutubeVideo::YtApi.channel_info(TEST_CHANEL_ID)
|
62
|
-
channel_info.must_be_instance_of Hash
|
63
|
-
channel_info['title'].length.must_be :>, 0
|
64
|
-
channel_info['description'].length.must_be :>, 0
|
65
|
-
channel_info['image_url'].must_match(/https:/)
|
66
|
-
end
|
67
|
-
|
68
|
-
it 'should be able to find popular videos' do
|
69
|
-
popular_videos = YoutubeVideo::YtApi.popular_videos_info
|
70
|
-
popular_videos.length.must_be :==, 25
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative 'spec_helper.rb'
|
3
|
+
|
4
|
+
describe 'YtApi 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
|
+
end
|
31
|
+
|
32
|
+
describe 'YtApi functions' do
|
33
|
+
it 'should be able to find video by video id' do
|
34
|
+
YoutubeVideo::YtApi.video_info(TEST_VIDEO_ID).must_be_instance_of Hash
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'should be able find comment by comment id' do
|
38
|
+
result = YoutubeVideo::YtApi.comment_info(TEST_COMMENT_ID)
|
39
|
+
result.must_be_instance_of Hash
|
40
|
+
result['id'].must_equal TEST_COMMENT_ID
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'should be able find comments by video id' do
|
44
|
+
next_page_token, comments = YoutubeVideo::YtApi
|
45
|
+
.video_comments_info(TEST_VIDEO_ID)
|
46
|
+
next_page_token.must_be_instance_of String
|
47
|
+
comments.must_be_instance_of Array
|
48
|
+
comments.length.must_be :>, 1
|
49
|
+
comments[0].must_be_instance_of Hash
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'should be able find comments that contain time tags by video_id' do
|
53
|
+
comments = YoutubeVideo::YtApi.time_tags_info(TEST_VIDEO_ID)
|
54
|
+
comments.must_be_instance_of Array
|
55
|
+
comments.length.must_be :>, 1
|
56
|
+
comments[0].must_be_instance_of Hash
|
57
|
+
comments[0]['textDisplay'].must_match(/[0-9]+:\d+/)
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'should be able to resolve channel' do
|
61
|
+
channel_info = YoutubeVideo::YtApi.channel_info(TEST_CHANEL_ID)
|
62
|
+
channel_info.must_be_instance_of Hash
|
63
|
+
channel_info['title'].length.must_be :>, 0
|
64
|
+
channel_info['description'].length.must_be :>, 0
|
65
|
+
channel_info['image_url'].must_match(/https:/)
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'should be able to find popular videos' do
|
69
|
+
popular_videos = YoutubeVideo::YtApi.popular_videos_info
|
70
|
+
popular_videos.length.must_be :==, 25
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
data/spec/comment_spec.rb
CHANGED
@@ -1,30 +1,30 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require_relative 'spec_helper.rb'
|
3
|
-
|
4
|
-
describe 'comment 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 'comment functions' do
|
24
|
-
it 'should has the abilit to find by comment id' do
|
25
|
-
comment = YoutubeVideo::Comment.find(comment_id: TEST_COMMENT_ID)
|
26
|
-
comment.must_be_instance_of YoutubeVideo::Comment
|
27
|
-
comment.comment_id.must_equal TEST_COMMENT_ID
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative 'spec_helper.rb'
|
3
|
+
|
4
|
+
describe 'comment 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 'comment functions' do
|
24
|
+
it 'should has the abilit to find by comment id' do
|
25
|
+
comment = YoutubeVideo::Comment.find(comment_id: TEST_COMMENT_ID)
|
26
|
+
comment.must_be_instance_of YoutubeVideo::Comment
|
27
|
+
comment.comment_id.must_equal TEST_COMMENT_ID
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
File without changes
|
@@ -1,81 +1,81 @@
|
|
1
|
-
---
|
2
|
-
video:
|
3
|
-
publishedAt: '2016-10-10T03:17:07.000Z'
|
4
|
-
channelId: UCYE8GO8URXHt3eLkqeo3uSw
|
5
|
-
title: 'FULL: Second Presidential Debate - Donald Trump vs Hillary Clinton - Washington
|
6
|
-
University 10/9/2016'
|
7
|
-
description: "WATCH: Final Presidential Debate - Donald Trump vs Hillary Clinton:
|
8
|
-
https://www.youtube.com/watch?v=dGQGwIr47YY\n\nWATCH: Third - Last Presidential
|
9
|
-
Debate - Donald Trump vs Hillary Clinton: https://www.youtube.com/watch?v=dGQGwIr47YY\n\nClick
|
10
|
-
Here To Go Straight To The Livestream Page!\n\n----------------------------------------------------------------------------------------------\n\nWATCH
|
11
|
-
LIVE: Second Presidential Debate - Donald Trump vs Hillary Clinton - St. Louis,
|
12
|
-
MO (10/9/2016) - Donald Trump & Hillary Clinton 2nd Presidential Debate at Washington
|
13
|
-
University (October 9, 2016) - Trump Clinton debate\n\nSecond Debate trump vs
|
14
|
-
clinton\n\nModerator: Martha Raddatz, Chief Global Affairs Correspondent and Co-Anchor
|
15
|
-
of \"This Week,\" ABC \n\nDonald Trump vs Hillary Clinton Second Presidential
|
16
|
-
Debate In Washington University in St. Louis, St. Louis, MO October 9th 2016 HQ
|
17
|
-
HD~Live Trump vs Clinton Second Presidential Debate 2016 HD~LIVE Stream: Donald
|
18
|
-
Trump vs Hillary Clinton Second Presidential Debate at the Washington University
|
19
|
-
in St. Louis, St. Louis, MO 10/9/2016\nTrump Clinton Debate\nThe 2nd Presidential
|
20
|
-
Debate\nSecond Presidential Debate 2016\nFULL Second Presidential Debate: Donald
|
21
|
-
Trump vs Hillary Clinton 10/09/2016 - St. Louis, MO\nDonald Trump vs Hillary Clinton
|
22
|
-
- Second Presidential Debate - St. Louis, MO (10/9/16)\nthe second presidential
|
23
|
-
debate between Hillary Clinton and Donald Trump\nLIVE Stream: Donald Trump vs
|
24
|
-
Hillary Clinton Second Presidential Debate In Washington University in St. Louis,
|
25
|
-
St. Louis, MO 10/9/2016 HQ HD\nLIVE Stream: Donald Trump vs Hillary Clinton Second
|
26
|
-
Presidential Debate In Washington University in St. Louis, St. Louis, MO 10/9/2016
|
27
|
-
HD\nLIVE Stream: Donald Trump vs Hillary Clinton Second Presidential Debate In
|
28
|
-
Washington University in St. Louis, St. Louis, MO October 9th 2016\nLive Trump
|
29
|
-
vs Clinton Second Presidential Debate 2016 HD LIVE Stream: Donald Trump vs Hillary
|
30
|
-
Clinton Second Presidential Debate at the Washington University in St. Louis,
|
31
|
-
St. Louis, MO 10/9/2016 LIVE Stream: Donald Trump vs Hillary Clinton Second Presidential
|
32
|
-
Debate at the Washington University in St. Louis, St. Louis, MO 10/9/2016\n\nWATCH
|
33
|
-
LIVESTREAM LIVE HQ Donald Trump vs Hillary Clinton 1st Presidential Debate at
|
34
|
-
the Washington University in St. Louis\nMonday, September 26, 2016\nSecond presidential
|
35
|
-
debate\nModerator: Lester Holt, Anchor, NBC Nightly News\nLocation: Washington
|
36
|
-
University, Hempstead, MO\n\n\nTV Channels – Each debate will be broadcast live
|
37
|
-
on C-SPAN, ABC, CBS, FOX and NBC, as well as all cable news channels including
|
38
|
-
CNN, Fox News and MSNBC among others.\n\nFull Videos – Click the “Watch Full Video
|
39
|
-
Link” below on each debate to watch the entire debate video.\n\nLIVE Stream: Donald
|
40
|
-
Trump vs Hillary Clinton Second Presidential Debate In St. Louis 9-26-2016 HQ
|
41
|
-
HD \n\nLIVE Stream: Donald Trump Hillary Clinton Second Presidential Debate In
|
42
|
-
St. Louis 9-26-2016 HQ HD\n\nLIVE Stream: Donald Trump vs Hillary Clinton Second
|
43
|
-
Presidential Debate In St. Louis 9-26-16 HQ HD\n\nLIVE Stream: Donald Trump vs
|
44
|
-
Hillary Clinton Second Presidential Debate In St. Louis September 26th 2016 HQ
|
45
|
-
HD\n\nLive Trump vs Hillary Second Presidential Debate 2016 HD\n\nLIVE Stream:
|
46
|
-
Donald Trump vs Hillary Clinton Second Presidential Debate at the Washington University,
|
47
|
-
Hempstead, MO\n\nLIVE Stream: Donald Trump vs Hillary Clinton Second Presidential
|
48
|
-
Debate at the Washington University, Hempstead\n\nLIVE Stream: Trump vs Clinton
|
49
|
-
Second Presidential Debate at the Washington University, Hempstead 9/26/16 HD\n\nLIVE
|
50
|
-
Stream: Donald Trump vs Hillary Clinton Second Presidential Debate at the Washington
|
51
|
-
University 9-26-2016 HD\n\nTAGS: Live Stream, Donald Trump, Hillary Clinton, Second
|
52
|
-
Presidential Debate 2016, Trump live debate,\nlive trump debate 2016, live hillary
|
53
|
-
clinton debate 2016,\nlive trump vs hillary debate 2016, live stream donald trump
|
54
|
-
debates hillary clinton,\nwatch live presidential debate 2016, live Washington
|
55
|
-
University, live hempstead,\nlive St. Louis debate 2016, livestream hillary vs
|
56
|
-
trump debate, lester holt,\nfull Second presidential debate, live debate trump
|
57
|
-
vs hillary, live 2016 debate\n\nDonald Trump Rally \nHillary Clinton Speech\nDonald
|
58
|
-
Trump Speech \nHillary Clinton Rally \nTim Kaine Rally Speech Live Event \n\nPresidential
|
59
|
-
Debate\n2016 Presidential Debate\nTrump Clinton Debate\nKaine Pence debate\n\nPresidential
|
60
|
-
Debate\n2016 Presidential Debate\n\n#Debates #Debates2016 #debatenight #donaldtrump
|
61
|
-
#trump2016 #trump #TrumpPence16 #TrumpRally #trumptrain #politics #trump4prez
|
62
|
-
#makeamericagreatagain #VoteTrump2016 #TrumpHasMyVote #teamtrump #vote4trump #votetrump
|
63
|
-
#trumpforpresident #americaSecond #trumphasmysupport #Debate #PresidentialDebate
|
64
|
-
#SecondPresidentialdebate #HillaryClinton #Hillary #Clinton #Clinton2016 #ClintonKaine
|
65
|
-
#Hofstra"
|
66
|
-
comment:
|
67
|
-
- kind: youtube#comment
|
68
|
-
etag: '"sZ5p5Mo8dPpfIzLYQBF8QIQJym0/71aCrHudnqoJbPiRhOTyHKhiOiU"'
|
69
|
-
id: z13ryv5pynjvtfgst23iy5uxhsrkvzzfz
|
70
|
-
snippet:
|
71
|
-
authorDisplayName: leevihermanni
|
72
|
-
authorProfileImageUrl: https://lh4.googleusercontent.com/-bzwXkvW61w8/AAAAAAAAAAI/AAAAAAAAAE4/G9k7waSjzVg/photo.jpg?sz=50
|
73
|
-
authorChannelUrl: http://www.youtube.com/channel/UC8DJocIvsARy4NCaO3Pl1ZA
|
74
|
-
authorChannelId:
|
75
|
-
value: UC8DJocIvsARy4NCaO3Pl1ZA
|
76
|
-
textDisplay: "go to watch my trump vs clinton rap battle\uFEFF"
|
77
|
-
canRate: false
|
78
|
-
viewerRating: none
|
79
|
-
likeCount: 1
|
80
|
-
publishedAt: '2016-10-25T11:35:25.000Z'
|
81
|
-
updatedAt: '2016-10-25T11:35:25.000Z'
|
1
|
+
---
|
2
|
+
video:
|
3
|
+
publishedAt: '2016-10-10T03:17:07.000Z'
|
4
|
+
channelId: UCYE8GO8URXHt3eLkqeo3uSw
|
5
|
+
title: 'FULL: Second Presidential Debate - Donald Trump vs Hillary Clinton - Washington
|
6
|
+
University 10/9/2016'
|
7
|
+
description: "WATCH: Final Presidential Debate - Donald Trump vs Hillary Clinton:
|
8
|
+
https://www.youtube.com/watch?v=dGQGwIr47YY\n\nWATCH: Third - Last Presidential
|
9
|
+
Debate - Donald Trump vs Hillary Clinton: https://www.youtube.com/watch?v=dGQGwIr47YY\n\nClick
|
10
|
+
Here To Go Straight To The Livestream Page!\n\n----------------------------------------------------------------------------------------------\n\nWATCH
|
11
|
+
LIVE: Second Presidential Debate - Donald Trump vs Hillary Clinton - St. Louis,
|
12
|
+
MO (10/9/2016) - Donald Trump & Hillary Clinton 2nd Presidential Debate at Washington
|
13
|
+
University (October 9, 2016) - Trump Clinton debate\n\nSecond Debate trump vs
|
14
|
+
clinton\n\nModerator: Martha Raddatz, Chief Global Affairs Correspondent and Co-Anchor
|
15
|
+
of \"This Week,\" ABC \n\nDonald Trump vs Hillary Clinton Second Presidential
|
16
|
+
Debate In Washington University in St. Louis, St. Louis, MO October 9th 2016 HQ
|
17
|
+
HD~Live Trump vs Clinton Second Presidential Debate 2016 HD~LIVE Stream: Donald
|
18
|
+
Trump vs Hillary Clinton Second Presidential Debate at the Washington University
|
19
|
+
in St. Louis, St. Louis, MO 10/9/2016\nTrump Clinton Debate\nThe 2nd Presidential
|
20
|
+
Debate\nSecond Presidential Debate 2016\nFULL Second Presidential Debate: Donald
|
21
|
+
Trump vs Hillary Clinton 10/09/2016 - St. Louis, MO\nDonald Trump vs Hillary Clinton
|
22
|
+
- Second Presidential Debate - St. Louis, MO (10/9/16)\nthe second presidential
|
23
|
+
debate between Hillary Clinton and Donald Trump\nLIVE Stream: Donald Trump vs
|
24
|
+
Hillary Clinton Second Presidential Debate In Washington University in St. Louis,
|
25
|
+
St. Louis, MO 10/9/2016 HQ HD\nLIVE Stream: Donald Trump vs Hillary Clinton Second
|
26
|
+
Presidential Debate In Washington University in St. Louis, St. Louis, MO 10/9/2016
|
27
|
+
HD\nLIVE Stream: Donald Trump vs Hillary Clinton Second Presidential Debate In
|
28
|
+
Washington University in St. Louis, St. Louis, MO October 9th 2016\nLive Trump
|
29
|
+
vs Clinton Second Presidential Debate 2016 HD LIVE Stream: Donald Trump vs Hillary
|
30
|
+
Clinton Second Presidential Debate at the Washington University in St. Louis,
|
31
|
+
St. Louis, MO 10/9/2016 LIVE Stream: Donald Trump vs Hillary Clinton Second Presidential
|
32
|
+
Debate at the Washington University in St. Louis, St. Louis, MO 10/9/2016\n\nWATCH
|
33
|
+
LIVESTREAM LIVE HQ Donald Trump vs Hillary Clinton 1st Presidential Debate at
|
34
|
+
the Washington University in St. Louis\nMonday, September 26, 2016\nSecond presidential
|
35
|
+
debate\nModerator: Lester Holt, Anchor, NBC Nightly News\nLocation: Washington
|
36
|
+
University, Hempstead, MO\n\n\nTV Channels – Each debate will be broadcast live
|
37
|
+
on C-SPAN, ABC, CBS, FOX and NBC, as well as all cable news channels including
|
38
|
+
CNN, Fox News and MSNBC among others.\n\nFull Videos – Click the “Watch Full Video
|
39
|
+
Link” below on each debate to watch the entire debate video.\n\nLIVE Stream: Donald
|
40
|
+
Trump vs Hillary Clinton Second Presidential Debate In St. Louis 9-26-2016 HQ
|
41
|
+
HD \n\nLIVE Stream: Donald Trump Hillary Clinton Second Presidential Debate In
|
42
|
+
St. Louis 9-26-2016 HQ HD\n\nLIVE Stream: Donald Trump vs Hillary Clinton Second
|
43
|
+
Presidential Debate In St. Louis 9-26-16 HQ HD\n\nLIVE Stream: Donald Trump vs
|
44
|
+
Hillary Clinton Second Presidential Debate In St. Louis September 26th 2016 HQ
|
45
|
+
HD\n\nLive Trump vs Hillary Second Presidential Debate 2016 HD\n\nLIVE Stream:
|
46
|
+
Donald Trump vs Hillary Clinton Second Presidential Debate at the Washington University,
|
47
|
+
Hempstead, MO\n\nLIVE Stream: Donald Trump vs Hillary Clinton Second Presidential
|
48
|
+
Debate at the Washington University, Hempstead\n\nLIVE Stream: Trump vs Clinton
|
49
|
+
Second Presidential Debate at the Washington University, Hempstead 9/26/16 HD\n\nLIVE
|
50
|
+
Stream: Donald Trump vs Hillary Clinton Second Presidential Debate at the Washington
|
51
|
+
University 9-26-2016 HD\n\nTAGS: Live Stream, Donald Trump, Hillary Clinton, Second
|
52
|
+
Presidential Debate 2016, Trump live debate,\nlive trump debate 2016, live hillary
|
53
|
+
clinton debate 2016,\nlive trump vs hillary debate 2016, live stream donald trump
|
54
|
+
debates hillary clinton,\nwatch live presidential debate 2016, live Washington
|
55
|
+
University, live hempstead,\nlive St. Louis debate 2016, livestream hillary vs
|
56
|
+
trump debate, lester holt,\nfull Second presidential debate, live debate trump
|
57
|
+
vs hillary, live 2016 debate\n\nDonald Trump Rally \nHillary Clinton Speech\nDonald
|
58
|
+
Trump Speech \nHillary Clinton Rally \nTim Kaine Rally Speech Live Event \n\nPresidential
|
59
|
+
Debate\n2016 Presidential Debate\nTrump Clinton Debate\nKaine Pence debate\n\nPresidential
|
60
|
+
Debate\n2016 Presidential Debate\n\n#Debates #Debates2016 #debatenight #donaldtrump
|
61
|
+
#trump2016 #trump #TrumpPence16 #TrumpRally #trumptrain #politics #trump4prez
|
62
|
+
#makeamericagreatagain #VoteTrump2016 #TrumpHasMyVote #teamtrump #vote4trump #votetrump
|
63
|
+
#trumpforpresident #americaSecond #trumphasmysupport #Debate #PresidentialDebate
|
64
|
+
#SecondPresidentialdebate #HillaryClinton #Hillary #Clinton #Clinton2016 #ClintonKaine
|
65
|
+
#Hofstra"
|
66
|
+
comment:
|
67
|
+
- kind: youtube#comment
|
68
|
+
etag: '"sZ5p5Mo8dPpfIzLYQBF8QIQJym0/71aCrHudnqoJbPiRhOTyHKhiOiU"'
|
69
|
+
id: z13ryv5pynjvtfgst23iy5uxhsrkvzzfz
|
70
|
+
snippet:
|
71
|
+
authorDisplayName: leevihermanni
|
72
|
+
authorProfileImageUrl: https://lh4.googleusercontent.com/-bzwXkvW61w8/AAAAAAAAAAI/AAAAAAAAAE4/G9k7waSjzVg/photo.jpg?sz=50
|
73
|
+
authorChannelUrl: http://www.youtube.com/channel/UC8DJocIvsARy4NCaO3Pl1ZA
|
74
|
+
authorChannelId:
|
75
|
+
value: UC8DJocIvsARy4NCaO3Pl1ZA
|
76
|
+
textDisplay: "go to watch my trump vs clinton rap battle\uFEFF"
|
77
|
+
canRate: false
|
78
|
+
viewerRating: none
|
79
|
+
likeCount: 1
|
80
|
+
publishedAt: '2016-10-25T11:35:25.000Z'
|
81
|
+
updatedAt: '2016-10-25T11:35:25.000Z'
|
data/spec/spec_helper.rb
CHANGED
@@ -1,29 +1,29 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'simplecov'
|
3
|
-
SimpleCov.start
|
4
|
-
|
5
|
-
require 'yaml'
|
6
|
-
require 'minitest/autorun'
|
7
|
-
require 'minitest/rg'
|
8
|
-
require 'vcr'
|
9
|
-
require 'webmock'
|
10
|
-
require './lib/YPBT/comment.rb'
|
11
|
-
require './lib/YPBT/video.rb'
|
12
|
-
require './lib/YPBT/author.rb'
|
13
|
-
require './lib/YPBT/youtube_api.rb'
|
14
|
-
require_relative '../lib/YPBT'
|
15
|
-
|
16
|
-
FIXTURES_FOLDER = 'spec/fixtures'
|
17
|
-
CASSETTES_FOLDER = "#{FIXTURES_FOLDER}/cassettes"
|
18
|
-
CASSETTE_FILE = 'youtube_api'
|
19
|
-
TEST_VIDEO_ID = 'vJOkR0Xz958'
|
20
|
-
TEST_COMMENT_ID = 'z13dwdepqxvdvvmbj04chpaxmuvbwjxhsr40k'
|
21
|
-
TEST_CHANEL_ID = 'UCQU5uVTG8h9LToACKrm1LMA'
|
22
|
-
RESULT_FILE = "#{FIXTURES_FOLDER}/yt_api_results.yml"
|
23
|
-
YT_RESULT = YAML.load(File.read(RESULT_FILE))
|
24
|
-
|
25
|
-
unless ENV.key? 'YOUTUBE_API_KEY'
|
26
|
-
CREDENTIALS = YAML.load(File.read('config/credentials.yml'))
|
27
|
-
ENV['YOUTUBE_API_KEY'] = CREDENTIALS[:YOUTUBE_API_KEY]
|
28
|
-
ENV['YT_VIDEO_ID'] = CREDENTIALS[:YT_VIDEO_ID]
|
29
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'simplecov'
|
3
|
+
SimpleCov.start
|
4
|
+
|
5
|
+
require 'yaml'
|
6
|
+
require 'minitest/autorun'
|
7
|
+
require 'minitest/rg'
|
8
|
+
require 'vcr'
|
9
|
+
require 'webmock'
|
10
|
+
require './lib/YPBT/comment.rb'
|
11
|
+
require './lib/YPBT/video.rb'
|
12
|
+
require './lib/YPBT/author.rb'
|
13
|
+
require './lib/YPBT/youtube_api.rb'
|
14
|
+
require_relative '../lib/YPBT'
|
15
|
+
|
16
|
+
FIXTURES_FOLDER = 'spec/fixtures'
|
17
|
+
CASSETTES_FOLDER = "#{FIXTURES_FOLDER}/cassettes"
|
18
|
+
CASSETTE_FILE = 'youtube_api'
|
19
|
+
TEST_VIDEO_ID = 'vJOkR0Xz958'
|
20
|
+
TEST_COMMENT_ID = 'z13dwdepqxvdvvmbj04chpaxmuvbwjxhsr40k'
|
21
|
+
TEST_CHANEL_ID = 'UCQU5uVTG8h9LToACKrm1LMA'
|
22
|
+
RESULT_FILE = "#{FIXTURES_FOLDER}/yt_api_results.yml"
|
23
|
+
YT_RESULT = YAML.load(File.read(RESULT_FILE))
|
24
|
+
|
25
|
+
unless ENV.key? 'YOUTUBE_API_KEY'
|
26
|
+
CREDENTIALS = YAML.load(File.read('config/credentials.yml'))
|
27
|
+
ENV['YOUTUBE_API_KEY'] = CREDENTIALS[:YOUTUBE_API_KEY]
|
28
|
+
ENV['YT_VIDEO_ID'] = CREDENTIALS[:YT_VIDEO_ID]
|
29
|
+
end
|
data/spec/time_tag_spec.rb
CHANGED
@@ -1,31 +1,31 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require_relative 'spec_helper.rb'
|
3
|
-
|
4
|
-
describe 'time_tag 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 'time_tag functions' do
|
24
|
-
it 'should able find time tag from comment text' do
|
25
|
-
comment = YoutubeVideo::Comment.find(comment_id: TEST_COMMENT_ID)
|
26
|
-
tags = YoutubeVideo::Timetag.find(comment: comment)
|
27
|
-
tags.must_be_instance_of Array
|
28
|
-
tags.length.must_be :==, 3
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative 'spec_helper.rb'
|
3
|
+
|
4
|
+
describe 'time_tag 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 'time_tag functions' do
|
24
|
+
it 'should able find time tag from comment text' do
|
25
|
+
comment = YoutubeVideo::Comment.find(comment_id: TEST_COMMENT_ID)
|
26
|
+
tags = YoutubeVideo::Timetag.find(comment: comment)
|
27
|
+
tags.must_be_instance_of Array
|
28
|
+
tags.length.must_be :==, 3
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|