YPBT 0.1.4

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.
@@ -0,0 +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'
@@ -0,0 +1,25 @@
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
+
15
+ FIXTURES_FOLDER = 'spec/fixtures'
16
+ CASSETTES_FOLDER = "#{FIXTURES_FOLDER}/cassettes"
17
+ CASSETTE_FILE = 'youtube_api'
18
+ TEST_VIDEO_ID = 'FugHj7MGhss'
19
+ RESULT_FILE = "#{FIXTURES_FOLDER}/yt_api_results.yml"
20
+ YT_RESULT = YAML.load(File.read(RESULT_FILE))
21
+
22
+ unless ENV.key? 'YOUTUBE_API_KEY'
23
+ CREDENTIALS = YAML.load(File.read('config/credentials.yml'))
24
+ ENV['YOUTUBE_API_KEY'] = CREDENTIALS[:YOUTUBE_API_KEY]
25
+ end
@@ -0,0 +1,73 @@
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
+ # @youtube_api = YoutubeVideo::YtApi.new(
18
+ # api_key: ENV['YOUTUBE_API_KEY']
19
+ # )
20
+ end
21
+
22
+ after do
23
+ VCR.eject_cassette
24
+ end
25
+
26
+ describe 'YtApi Credentials' do
27
+ it 'should be able to get a new api key with ENV credentials' do
28
+ YoutubeVideo::YtApi.api_key.length.must_be :>, 0
29
+ end
30
+ end
31
+
32
+ it 'should be able to open a video' do
33
+ video = YoutubeVideo::Video.find(
34
+ video_id: TEST_VIDEO_ID
35
+ )
36
+ video.title.length.must_be :>, 0
37
+ end
38
+
39
+ it 'should get the latest commentThreads from a video' do
40
+ video = YoutubeVideo::Video.find(
41
+ video_id: TEST_VIDEO_ID
42
+ )
43
+ commentthreads = video.commentthreads
44
+ commentthreads.count.must_be :>, 10
45
+ end
46
+
47
+ it 'should get information about comment on the commentThreads' do
48
+ video = YoutubeVideo::Video.find(
49
+ video_id: TEST_VIDEO_ID
50
+ )
51
+
52
+ video.commentthreads.each do |comment|
53
+ comment.comment_id.wont_be_nil
54
+ comment.text_display.wont_be_nil
55
+ end
56
+ end
57
+
58
+ it 'should find all parts of a full comment' do
59
+ comment = YT_RESULT['comment'].first
60
+ retrieved = YoutubeVideo::Comment.find(
61
+ comment_id: comment['id']
62
+ )
63
+
64
+ retrieved.comment_id.must_equal comment['id']
65
+ retrieved.published_at.must_equal comment['snippet']['publishedAt']
66
+ retrieved.updated_at.must_equal comment['snippet']['updateAt']
67
+ retrieved.text_display.must_equal comment['snippet']['textDisplay']
68
+
69
+ retrieved.author.wont_be_nil
70
+ # retrieved.author.author_image_url.must_equal comment['snippet']['authorProfileImageUrl']
71
+ # retrieved.author.author_channel_url.must_equal comment['snippet']['authorChannelUrl']
72
+ end
73
+ end
metadata ADDED
@@ -0,0 +1,213 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: YPBT
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.4
5
+ platform: ruby
6
+ authors:
7
+ - Yi-Min
8
+ - Yuan-Yu
9
+ - Kun-Lin
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2016-10-28 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: http
17
+ requirement: !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - - "~>"
20
+ - !ruby/object:Gem::Version
21
+ version: '2.0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - "~>"
27
+ - !ruby/object:Gem::Version
28
+ version: '2.0'
29
+ - !ruby/object:Gem::Dependency
30
+ name: minitest
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - "~>"
34
+ - !ruby/object:Gem::Version
35
+ version: '5.9'
36
+ type: :development
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '5.9'
43
+ - !ruby/object:Gem::Dependency
44
+ name: minitest-rg
45
+ requirement: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '5.2'
50
+ type: :development
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - "~>"
55
+ - !ruby/object:Gem::Version
56
+ version: '5.2'
57
+ - !ruby/object:Gem::Dependency
58
+ name: rake
59
+ requirement: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - "~>"
62
+ - !ruby/object:Gem::Version
63
+ version: '11.3'
64
+ type: :development
65
+ prerelease: false
66
+ version_requirements: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - "~>"
69
+ - !ruby/object:Gem::Version
70
+ version: '11.3'
71
+ - !ruby/object:Gem::Dependency
72
+ name: vcr
73
+ requirement: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - "~>"
76
+ - !ruby/object:Gem::Version
77
+ version: '3.0'
78
+ type: :development
79
+ prerelease: false
80
+ version_requirements: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - "~>"
83
+ - !ruby/object:Gem::Version
84
+ version: '3.0'
85
+ - !ruby/object:Gem::Dependency
86
+ name: webmock
87
+ requirement: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - "~>"
90
+ - !ruby/object:Gem::Version
91
+ version: '2.1'
92
+ type: :development
93
+ prerelease: false
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - "~>"
97
+ - !ruby/object:Gem::Version
98
+ version: '2.1'
99
+ - !ruby/object:Gem::Dependency
100
+ name: simplecov
101
+ requirement: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - "~>"
104
+ - !ruby/object:Gem::Version
105
+ version: '0.12'
106
+ type: :development
107
+ prerelease: false
108
+ version_requirements: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - "~>"
111
+ - !ruby/object:Gem::Version
112
+ version: '0.12'
113
+ - !ruby/object:Gem::Dependency
114
+ name: flog
115
+ requirement: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - "~>"
118
+ - !ruby/object:Gem::Version
119
+ version: '4.4'
120
+ type: :development
121
+ prerelease: false
122
+ version_requirements: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - "~>"
125
+ - !ruby/object:Gem::Version
126
+ version: '4.4'
127
+ - !ruby/object:Gem::Dependency
128
+ name: flay
129
+ requirement: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - "~>"
132
+ - !ruby/object:Gem::Version
133
+ version: '2.8'
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - "~>"
139
+ - !ruby/object:Gem::Version
140
+ version: '2.8'
141
+ - !ruby/object:Gem::Dependency
142
+ name: rubocop
143
+ requirement: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - "~>"
146
+ - !ruby/object:Gem::Version
147
+ version: '0.42'
148
+ type: :development
149
+ prerelease: false
150
+ version_requirements: !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - "~>"
153
+ - !ruby/object:Gem::Version
154
+ version: '0.42'
155
+ description: Youtube Progress Bar Tagger extracts comment threads, comments, and comment
156
+ of author from Youtube videos
157
+ email:
158
+ - - b37582000@gmail.com
159
+ - - tearsgundam@gmail.com
160
+ - - orange6318@hotmail.com
161
+ executables:
162
+ - YPBT
163
+ extensions: []
164
+ extra_rdoc_files: []
165
+ files:
166
+ - ".gitignore"
167
+ - ".rubocop.yml"
168
+ - Gemfile
169
+ - LICENSE
170
+ - README.md
171
+ - Rakefile
172
+ - YPBT.gemspec
173
+ - bin/YPBT
174
+ - config/credentials.yml.example
175
+ - lib/YPBT.rb
176
+ - lib/YPBT/author.rb
177
+ - lib/YPBT/comment.rb
178
+ - lib/YPBT/version.rb
179
+ - lib/YPBT/video.rb
180
+ - lib/YPBT/youtube_api.rb
181
+ - spec/fixtures/cassettes/youtube_api.yml
182
+ - spec/fixtures/yt_api_results.yml
183
+ - spec/spec_helper.rb
184
+ - spec/video_spec.rb
185
+ homepage: https://github.com/RubyStarts3/YPBT
186
+ licenses:
187
+ - MIT
188
+ metadata: {}
189
+ post_install_message:
190
+ rdoc_options: []
191
+ require_paths:
192
+ - lib
193
+ required_ruby_version: !ruby/object:Gem::Requirement
194
+ requirements:
195
+ - - ">="
196
+ - !ruby/object:Gem::Version
197
+ version: '0'
198
+ required_rubygems_version: !ruby/object:Gem::Requirement
199
+ requirements:
200
+ - - ">="
201
+ - !ruby/object:Gem::Version
202
+ version: '0'
203
+ requirements: []
204
+ rubyforge_project:
205
+ rubygems_version: 2.5.1
206
+ signing_key:
207
+ specification_version: 4
208
+ summary: Gets comment from public Youtube videos
209
+ test_files:
210
+ - spec/fixtures/cassettes/youtube_api.yml
211
+ - spec/fixtures/yt_api_results.yml
212
+ - spec/spec_helper.rb
213
+ - spec/video_spec.rb