YPBT 0.2.4 → 0.2.5

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: b3eb896c148e353a917eb3092313b07fe930d4a2
4
- data.tar.gz: 1fe174698eef603e55b78fe858e85cec50b9e21e
3
+ metadata.gz: 0cf1c8c3df0011ed0e08f6eda8a4874547f93685
4
+ data.tar.gz: 24f78733d9500b19a9a782fa5bfa14f31e159dbf
5
5
  SHA512:
6
- metadata.gz: aa3bc18521d1586bea0bd6cb783756f79e79d7fff7457c357010df89ff288ea54a258bf0e48bc98cb9d82f587548fa5668d4144059608c47ef31ea4708ddc9da
7
- data.tar.gz: aaa676c788b5ae0b7bfd410e4eb12703db85e17950e00f73ca4a4383c7ed7ef73d71ea21608c0532e99d3f4f02851e4d382a1ef7883738e21bd6a95510bc83f5
6
+ metadata.gz: 1a900dbca5b142760bd8b48524b713bf8b32cd0e95737e8530cc14fd4ae2e926c7696d68fcf67398d9f4b08afff34b7ccc2e7c4a673a937d1013fcca4fbda5ff
7
+ data.tar.gz: 4aad69efeddf805504b79ba6f39b9f45c87338489eb07853a65e9d1b4c6fa82ece2918834929f82a9afe14159cf585d0d7983b15f92d393b0c37a32e242f0566
data/.gitignore CHANGED
@@ -1,4 +1,4 @@
1
- config/credentials.yml
2
- coverage/
3
- Gemfile.lock
4
- *.gem
1
+ config/credentials.yml
2
+ coverage/
3
+ Gemfile.lock
4
+ *.gem
@@ -1,3 +1,3 @@
1
- ---
2
- AllCops:
3
- TargetRubyVersion: 2.3
1
+ ---
2
+ AllCops:
3
+ TargetRubyVersion: 2.3
@@ -1,7 +1,7 @@
1
- language: ruby
2
- rvm:
3
- - 2.3.1
4
- branches:
5
- only:
6
- - master
7
- script: bundle exec rake spec
1
+ language: ruby
2
+ rvm:
3
+ - 2.3.1
4
+ branches:
5
+ only:
6
+ - master
7
+ script: bundle exec rake spec
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- # frozen_string_literal: true
2
- source 'https://rubygems.org'
3
-
4
- gemspec
1
+ # frozen_string_literal: true
2
+ source 'https://rubygems.org'
3
+
4
+ gemspec
data/LICENSE CHANGED
@@ -1,22 +1,22 @@
1
- MIT LICENSE
2
-
3
- Copyright (c) Yi-Min <b37582000@gmail.com>, Yuan-Yu <tearsgundam@gmail.com>,
4
- Kun-Lin <orange6318@hotmail.com>
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy
7
- of this software and associated documentation files (the "Software"), to deal
8
- in the Software without restriction, including without limitation the rights
9
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the Software is
11
- furnished to do so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in
14
- all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- THE SOFTWARE.
1
+ MIT LICENSE
2
+
3
+ Copyright (c) Yi-Min <b37582000@gmail.com>, Yuan-Yu <tearsgundam@gmail.com>,
4
+ Kun-Lin <orange6318@hotmail.com>
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,47 +1,47 @@
1
- # Youtube Progress Bar Tagger
2
- [![Gem Version](https://badge.fury.io/rb/YPBT.svg)](https://badge.fury.io/rb/YPBT)
3
- [![Build Status](https://travis-ci.org/RubyStarts3/YPBT.svg?branch=master)](https://travis-ci.org/RubyStarts3/YPBT)
4
-
5
- Youtube Progress Bar Tagger (YPBT) is a gem that tracks the comments following a youtube movie and captures the time points of popularity.
6
-
7
- ## Installation
8
-
9
- If you are working on a project, add this to your Gemfile: `gem 'YPBT'`
10
-
11
- For ad hoc installation from command line:
12
-
13
- `$ gem install YPBT`
14
-
15
- ## Quick Start
16
- Export your [Youtube api key](https://console.developers.google.com/apis/credentials)
17
- ```
18
-   $ export YOUTUBE_API_KEY='Your_Youtube_API_Key'
19
- ```
20
- Install essential gem
21
- ```
22
- $ bundle install
23
- ```
24
- Then do a basic test for our module
25
- ```
26
-   $ rake spec
27
- ```
28
- Now, try to extract data from YouTube's video
29
- => `https://www.youtube.com/watch?v=[video_id]`
30
- ```
31
- $ YPBT [video_id]
32
- ```
33
- ## Usage
34
- ```ruby
35
- video = YoutubeVideo::Video.find(
36
- video_id: video_id
37
- )
38
-
39
- puts video.title
40
-
41
- video.commentthreads.each. do |comment|
42
- puts comment.author.author_name
43
- puts comment.text_display
44
- puts comment.author.like_count if comment.author.like_count
45
- puts comment.author.author_channel_url
46
- end
47
- ```
1
+ # Youtube Progress Bar Tagger
2
+ [![Gem Version](https://badge.fury.io/rb/YPBT.svg)](https://badge.fury.io/rb/YPBT)
3
+ [![Build Status](https://travis-ci.org/RubyStarts3/YPBT.svg?branch=master)](https://travis-ci.org/RubyStarts3/YPBT)
4
+
5
+ Youtube Progress Bar Tagger (YPBT) is a gem that tracks the comments following a youtube movie and captures the time points of popularity.
6
+
7
+ ## Installation
8
+
9
+ If you are working on a project, add this to your Gemfile: `gem 'YPBT'`
10
+
11
+ For ad hoc installation from command line:
12
+
13
+ `$ gem install YPBT`
14
+
15
+ ## Quick Start
16
+ Export your [Youtube api key](https://console.developers.google.com/apis/credentials)
17
+ ```
18
+   $ export YOUTUBE_API_KEY='Your_Youtube_API_Key'
19
+ ```
20
+ Install essential gem
21
+ ```
22
+ $ bundle install
23
+ ```
24
+ Then do a basic test for our module
25
+ ```
26
+   $ rake spec
27
+ ```
28
+ Now, try to extract data from YouTube's video
29
+ => `https://www.youtube.com/watch?v=[video_id]`
30
+ ```
31
+ $ YPBT [video_id]
32
+ ```
33
+ ## Usage
34
+ ```ruby
35
+ video = YoutubeVideo::Video.find(
36
+ video_id: video_id
37
+ )
38
+
39
+ puts video.title
40
+
41
+ video.commentthreads.each. do |comment|
42
+ puts comment.author.author_name
43
+ puts comment.text_display
44
+ puts comment.author.like_count if comment.author.like_count
45
+ puts comment.author.author_channel_url
46
+ end
47
+ ```
data/Rakefile CHANGED
@@ -1,58 +1,58 @@
1
- # frozen_string_literal: true
2
- require 'rake/testtask'
3
-
4
- task default: :spec
5
-
6
- namespace :credentials do
7
- require 'yaml'
8
-
9
- desc 'generate YOUTUBE_API_KEY to STDOUT'
10
- task :get_youtube_api_key do
11
- credentials = YAML.load(File.read('config/credentials.yml'))
12
- require_relative 'lib/YPBT/youtube_api'
13
- ENV['YOUTUBE_API_KEY'] = credentials[:YOUTUBE_API_KEY]
14
-
15
- puts "YOUTUBE_API_KEY: #{YoutubeVideo::YtApi.api_key}"
16
- end
17
-
18
- desc 'Export sample credentials from file to bash'
19
- task :export do
20
- credentials = YAML.load(File.read('config/credentials.yml'))
21
- puts 'Please run the following in bash:'
22
- puts "export YOUTUBE_API_KEY=#{credentials[:YOUTUBE_API_KEY]}"
23
- end
24
- end
25
-
26
- desc 'run tests'
27
- Rake::TestTask.new(:spec) do |t|
28
- t.pattern = 'spec/*_spec.rb'
29
- t.warning = false
30
- end
31
-
32
- desc 'delete cassette fixtures'
33
- task :wipe do
34
- sh 'rm spec/fixtures/cassettes/*.yml' do |ok, _|
35
- puts(ok ? 'Cassettes deleted' : 'No casseettes found')
36
- end
37
- end
38
-
39
- desc 'quality checks'
40
-
41
- namespace :quality do
42
- desc 'run all quality checks'
43
- task all: [:rubocop, :flog, :flay]
44
-
45
- task :rubocop do
46
- sh 'rubocop'
47
- end
48
-
49
- task :flog do
50
- sh 'flog lib/*.rb'
51
- sh 'flog spec/*.rb'
52
- end
53
-
54
- task :flay do
55
- sh 'flay lib/*.rb'
56
- sh 'flay spec/*.rb'
57
- end
58
- end
1
+ # frozen_string_literal: true
2
+ require 'rake/testtask'
3
+
4
+ task default: :spec
5
+
6
+ namespace :credentials do
7
+ require 'yaml'
8
+
9
+ desc 'generate YOUTUBE_API_KEY to STDOUT'
10
+ task :get_youtube_api_key do
11
+ credentials = YAML.load(File.read('config/credentials.yml'))
12
+ require_relative 'lib/YPBT/youtube_api'
13
+ ENV['YOUTUBE_API_KEY'] = credentials[:YOUTUBE_API_KEY]
14
+
15
+ puts "YOUTUBE_API_KEY: #{YoutubeVideo::YtApi.api_key}"
16
+ end
17
+
18
+ desc 'Export sample credentials from file to bash'
19
+ task :export do
20
+ credentials = YAML.load(File.read('config/credentials.yml'))
21
+ puts 'Please run the following in bash:'
22
+ puts "export YOUTUBE_API_KEY=#{credentials[:YOUTUBE_API_KEY]}"
23
+ end
24
+ end
25
+
26
+ desc 'run tests'
27
+ Rake::TestTask.new(:spec) do |t|
28
+ t.pattern = 'spec/*_spec.rb'
29
+ t.warning = false
30
+ end
31
+
32
+ desc 'delete cassette fixtures'
33
+ task :wipe do
34
+ sh 'rm spec/fixtures/cassettes/*.yml' do |ok, _|
35
+ puts(ok ? 'Cassettes deleted' : 'No casseettes found')
36
+ end
37
+ end
38
+
39
+ desc 'quality checks'
40
+
41
+ namespace :quality do
42
+ desc 'run all quality checks'
43
+ task all: [:rubocop, :flog, :flay]
44
+
45
+ task :rubocop do
46
+ sh 'rubocop'
47
+ end
48
+
49
+ task :flog do
50
+ sh 'flog lib/*.rb'
51
+ sh 'flog spec/*.rb'
52
+ end
53
+
54
+ task :flay do
55
+ sh 'flay lib/*.rb'
56
+ sh 'flay spec/*.rb'
57
+ end
58
+ end
@@ -1,34 +1,34 @@
1
- # frozen_string_literal: true
2
- $LOAD_PATH.push File.expand_path('../lib', __FILE__)
3
- require 'YPBT/version'
4
-
5
- Gem::Specification.new do |s|
6
- s.name = 'YPBT'
7
- s.version = YoutubeVideo::VERSION
8
-
9
- s.summary = 'Gets comment from public Youtube videos'
10
- s.description = 'Youtube Progress Bar Tagger'\
11
- 'extracts comment threads, comments, and '\
12
- 'comment of author from Youtube videos'
13
- s.authors = ['Yi-Min'], ['Yuan-Yu'], ['Kun-Lin']
14
- s.email = ['b37582000@gmail.com'], ['tearsgundam@gmail.com'],
15
- ['orange6318@hotmail.com']
16
-
17
- s.files = `git ls-files`.split("\n")
18
- s.test_files = `git ls-files -- spec/*`.split("\n")
19
- s.executables << 'YPBT'
20
-
21
- s.add_runtime_dependency 'http', '~> 2.0'
22
- s.add_runtime_dependency 'ruby-duration', '~>3.2.3'
23
- s.add_development_dependency 'minitest', '~> 5.9'
24
- s.add_development_dependency 'minitest-rg', '~> 5.2'
25
- s.add_development_dependency 'rake', '~> 11.3'
26
- s.add_development_dependency 'vcr', '~> 3.0'
27
- s.add_development_dependency 'webmock', '~> 2.1'
28
- s.add_development_dependency 'simplecov', '~> 0.12'
29
- s.add_development_dependency 'flog', '~> 4.4'
30
- s.add_development_dependency 'flay', '~> 2.8'
31
- s.add_development_dependency 'rubocop', '~> 0.42'
32
- s.homepage = 'https://github.com/RubyStarts3/YPBT'
33
- s.license = 'MIT'
34
- end
1
+ # frozen_string_literal: true
2
+ $LOAD_PATH.push File.expand_path('../lib', __FILE__)
3
+ require 'YPBT/version'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'YPBT'
7
+ s.version = YoutubeVideo::VERSION
8
+
9
+ s.summary = 'Gets comment from public Youtube videos'
10
+ s.description = 'Youtube Progress Bar Tagger'\
11
+ 'extracts comment threads, comments, and '\
12
+ 'comment of author from Youtube videos'
13
+ s.authors = ['Yi-Min'], ['Yuan-Yu'], ['Kun-Lin']
14
+ s.email = ['b37582000@gmail.com'], ['tearsgundam@gmail.com'],
15
+ ['orange6318@hotmail.com']
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- spec/*`.split("\n")
19
+ s.executables << 'YPBT'
20
+
21
+ s.add_runtime_dependency 'http', '~> 2.0'
22
+ s.add_runtime_dependency 'ruby-duration', '~>3.2.3'
23
+ s.add_development_dependency 'minitest', '~> 5.9'
24
+ s.add_development_dependency 'minitest-rg', '~> 5.2'
25
+ s.add_development_dependency 'rake', '~> 11.3'
26
+ s.add_development_dependency 'vcr', '~> 3.0'
27
+ s.add_development_dependency 'webmock', '~> 2.1'
28
+ s.add_development_dependency 'simplecov', '~> 0.12'
29
+ s.add_development_dependency 'flog', '~> 4.4'
30
+ s.add_development_dependency 'flay', '~> 2.8'
31
+ s.add_development_dependency 'rubocop', '~> 0.42'
32
+ s.homepage = 'https://github.com/RubyStarts3/YPBT'
33
+ s.license = 'MIT'
34
+ end
data/bin/YPBT CHANGED
@@ -1,7 +1,7 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
- $LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w(.. lib))
4
- require 'YPBT'
5
- require_relative '../lib/YPBT/runner.rb'
6
-
7
- puts YoutubeVideo::Runner.run!(ARGV)
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w(.. lib))
4
+ require 'YPBT'
5
+ require_relative '../lib/YPBT/runner.rb'
6
+
7
+ puts YoutubeVideo::Runner.run!(ARGV)
@@ -1,4 +1,4 @@
1
- # frozen_string_literal: true
2
- # call library files
3
- files = Dir.glob(File.join(File.dirname(__FILE__), 'YPBT/*.rb'))
4
- files.each { |lib| require_relative lib }
1
+ # frozen_string_literal: true
2
+ # call library files
3
+ files = Dir.glob(File.join(File.dirname(__FILE__), 'YPBT/*.rb'))
4
+ files.each { |lib| require_relative lib }
@@ -1,15 +1,15 @@
1
- # frozen_string_literal: tru
2
- module YoutubeVideo
3
- # comment's author infomation
4
- class Author
5
- attr_reader :author_name, :author_image_url, :author_channel_url,
6
- :like_count
7
- def initialize(data)
8
- return unless data
9
- @author_name = data['authorDisplayName']
10
- @author_image_url = data['authorProfileImageUrl']
11
- @author_channel_url = data['authorChannelUrl']
12
- @like_count = data['likeCount'].to_i
13
- end
14
- end
15
- end
1
+ # frozen_string_literal: tru
2
+ module YoutubeVideo
3
+ # comment's author infomation
4
+ class Author
5
+ attr_reader :author_name, :author_image_url, :author_channel_url,
6
+ :like_count
7
+ def initialize(data)
8
+ return unless data
9
+ @author_name = data['authorDisplayName']
10
+ @author_image_url = data['authorProfileImageUrl']
11
+ @author_channel_url = data['authorChannelUrl']
12
+ @like_count = data['likeCount'].to_i
13
+ end
14
+ end
15
+ end
@@ -1,33 +1,33 @@
1
- # frozen_string_literal: true
2
- require_relative 'comment'
3
- require_relative 'youtube_api'
4
- require_relative 'author'
5
-
6
- module YoutubeVideo
7
- # signle comment on video's comment threads
8
- class Comment
9
- attr_reader :comment_id, :updated_at, :text_display, :published_at, :author,
10
- :time_tags, :like_count
11
-
12
- def initialize(data: nil)
13
- load_data(data)
14
- end
15
-
16
- def self.find(comment_id:)
17
- comment_data = YoutubeVideo::YtApi.comment_info(comment_id)
18
- new(data: comment_data)
19
- end
20
-
21
- private
22
-
23
- def load_data(comment_data)
24
- @comment_id = comment_data['id']
25
- @like_count = comment_data['likeCount'].to_i
26
- @updated_at = comment_data['updateAt']
27
- @text_display = comment_data['textDisplay']
28
- @published_at = comment_data['publishedAt']
29
- @author = YoutubeVideo::Author.new(comment_data)
30
- @time_tags = YoutubeVideo::Timetag.find(comment: self)
31
- end
32
- end
33
- end
1
+ # frozen_string_literal: true
2
+ require_relative 'comment'
3
+ require_relative 'youtube_api'
4
+ require_relative 'author'
5
+
6
+ module YoutubeVideo
7
+ # signle comment on video's comment threads
8
+ class Comment
9
+ attr_reader :comment_id, :updated_at, :text_display, :published_at, :author,
10
+ :time_tags, :like_count
11
+
12
+ def initialize(data: nil)
13
+ load_data(data)
14
+ end
15
+
16
+ def self.find(comment_id:)
17
+ comment_data = YoutubeVideo::YtApi.comment_info(comment_id)
18
+ new(data: comment_data)
19
+ end
20
+
21
+ private
22
+
23
+ def load_data(comment_data)
24
+ @comment_id = comment_data['id']
25
+ @like_count = comment_data['likeCount'].to_i
26
+ @updated_at = comment_data['updateAt']
27
+ @text_display = comment_data['textDisplay']
28
+ @published_at = comment_data['publishedAt']
29
+ @author = YoutubeVideo::Author.new(comment_data)
30
+ @time_tags = YoutubeVideo::Timetag.find(comment: self)
31
+ end
32
+ end
33
+ end