youtube_parser 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: a9f07597f46f3a960b11c08eae61b02e11c270c23b4ff2c3c56cc2ee09aba4c3
4
+ data.tar.gz: b274a8867a72688c69bbe1b9b4ec46a82e107be24b9201f56d6f69fbfa117170
5
+ SHA512:
6
+ metadata.gz: b91bc4d8b8d39e1bbeffd081224d7806c9d7de2bafb54f561b495b2e119a74037de5c57107248face916aa863a82a8d939b57432e3b98adc620edce8904dcb5b
7
+ data.tar.gz: 484bdd95c5fc999503a9641589bf1f583fb6b2a22b00a4c06fe483f05cda344d5b68e143b367cf5caaf138f79cf05e41fea84c721b4dc4882ea74c604f59f833
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ .byebug_history
13
+ .DS_Store
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,35 @@
1
+ require: rubocop-rspec
2
+
3
+ AllCops:
4
+ Exclude:
5
+ - 'Rakefile'
6
+ - 'Gemfile'
7
+ - '*.gemspec'
8
+ - '*/*/version.rb'
9
+ - 'bin/*'
10
+ - 'spec/spec_helper.rb'
11
+
12
+ Style/Documentation:
13
+ Enabled: false
14
+ Layout/DotPosition:
15
+ Enabled: false
16
+ Metrics/BlockLength:
17
+ Enabled: false
18
+ Layout/MultilineOperationIndentation:
19
+ EnforcedStyle: indented
20
+ Layout/CaseIndentation:
21
+ EnforcedStyle: end
22
+ Layout/EndAlignment:
23
+ EnforcedStyleAlignWith: start_of_line
24
+ Metrics/CyclomaticComplexity:
25
+ Enabled: false
26
+ Metrics/MethodLength:
27
+ Enabled: false
28
+ Style/FrozenStringLiteralComment:
29
+ Enabled: true
30
+ RSpec/MultipleExpectations:
31
+ Max: 2
32
+ RSpec/ExampleLength:
33
+ Max: 10
34
+ Style/ClassCheck:
35
+ Enabled: false
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.1
7
+ before_install: gem install bundler -v 2.0.1
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at o.vykhor@ukr.net. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in youtube_parser.gemspec
4
+ gemspec
5
+
6
+ gem 'faraday'
7
+ gem 'oj'
8
+ gem 'activesupport'
data/Gemfile.lock ADDED
@@ -0,0 +1,70 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ youtube_parser (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ activesupport (6.0.1)
10
+ concurrent-ruby (~> 1.0, >= 1.0.2)
11
+ i18n (>= 0.7, < 2)
12
+ minitest (~> 5.1)
13
+ tzinfo (~> 1.1)
14
+ zeitwerk (~> 2.2)
15
+ addressable (2.6.0)
16
+ public_suffix (>= 2.0.2, < 4.0)
17
+ byebug (11.0.1)
18
+ concurrent-ruby (1.1.5)
19
+ crack (0.4.3)
20
+ safe_yaml (~> 1.0.0)
21
+ diff-lcs (1.3)
22
+ faraday (0.17.1)
23
+ multipart-post (>= 1.2, < 3)
24
+ hashdiff (0.3.7)
25
+ i18n (1.7.0)
26
+ concurrent-ruby (~> 1.0)
27
+ minitest (5.13.0)
28
+ multipart-post (2.1.1)
29
+ oj (3.9.2)
30
+ public_suffix (3.0.3)
31
+ rake (10.5.0)
32
+ rspec (3.9.0)
33
+ rspec-core (~> 3.9.0)
34
+ rspec-expectations (~> 3.9.0)
35
+ rspec-mocks (~> 3.9.0)
36
+ rspec-core (3.9.0)
37
+ rspec-support (~> 3.9.0)
38
+ rspec-expectations (3.9.0)
39
+ diff-lcs (>= 1.2.0, < 2.0)
40
+ rspec-support (~> 3.9.0)
41
+ rspec-mocks (3.9.0)
42
+ diff-lcs (>= 1.2.0, < 2.0)
43
+ rspec-support (~> 3.9.0)
44
+ rspec-support (3.9.0)
45
+ safe_yaml (1.0.4)
46
+ thread_safe (0.3.6)
47
+ tzinfo (1.2.5)
48
+ thread_safe (~> 0.1)
49
+ webmock (3.0.1)
50
+ addressable (>= 2.3.6)
51
+ crack (>= 0.3.2)
52
+ hashdiff
53
+ zeitwerk (2.2.2)
54
+
55
+ PLATFORMS
56
+ ruby
57
+
58
+ DEPENDENCIES
59
+ activesupport
60
+ bundler (~> 2.0)
61
+ byebug
62
+ faraday
63
+ oj
64
+ rake (~> 10.0)
65
+ rspec (~> 3.0)
66
+ webmock
67
+ youtube_parser!
68
+
69
+ BUNDLED WITH
70
+ 2.0.1
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 o.vykhor
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,48 @@
1
+ # YoutubeParser
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/youtube_parser`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'youtube_parser'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install youtube_parser
22
+
23
+ ## Usage
24
+
25
+ To fetch youtube channel info:
26
+ ```ruby
27
+ require 'youtube_parser'
28
+
29
+ YoutubeParser::Channel.new('https://www.youtube.com/channel/channel_id').info
30
+ ```
31
+
32
+ ## Development
33
+
34
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
35
+
36
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
37
+
38
+ ## Contributing
39
+
40
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/youtube_parser. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
41
+
42
+ ## License
43
+
44
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
45
+
46
+ ## Code of Conduct
47
+
48
+ Everyone interacting in the YoutubeParser project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/youtube_parser/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "youtube_parser"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YoutubeParser
4
+ class BaseParser
5
+ attr_reader :options
6
+
7
+ def initialize(options = {})
8
+ @options = Resource.new(options)
9
+
10
+ required_options.each do |option|
11
+ message = "missing keyword: #{option}"
12
+
13
+ raise ArgumentError, message unless @options.public_send(option)
14
+ end
15
+ end
16
+
17
+ def resource
18
+ @resource ||= Resource.new(info)
19
+ end
20
+
21
+ def info
22
+ raise NotImplementedError
23
+ end
24
+
25
+ def self.options(*opts)
26
+ define_method(:required_options) { opts }
27
+ end
28
+
29
+ private
30
+
31
+ def keys
32
+ return @keys if @keys
33
+
34
+ path = YoutubeParser.root.join('lib/youtube_parser/config/keys.yml')
35
+ @keys = Resource.new(YAML.load_file(path).merge(default_method_value: []))
36
+ end
37
+
38
+ def client
39
+ @client ||= options.client || Client.new(options.attributes)
40
+ end
41
+
42
+ # Default definition
43
+ def required_options
44
+ []
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YoutubeParser
4
+ class Channel < BaseParser
5
+ options :channel_url
6
+
7
+ def info
8
+ @info ||= Resource.new(collect_channel_info)
9
+ end
10
+
11
+ private
12
+
13
+ def collect_channel_info
14
+ data = about_section_info.merge(video_section_info)
15
+ data.select! { |_, v| v.present? }
16
+ end
17
+
18
+ def about_section_info
19
+ @about_section_info ||= section(:about).info
20
+ end
21
+
22
+ def video_section_info
23
+ @video_section_info ||= section(:videos).info
24
+ end
25
+
26
+ def section(title)
27
+ constant_name = "YoutubeParser::Channels::#{title.capitalize}Section"
28
+ opts = { channel_url: options.channel_url, client: client }
29
+ Object.const_get(constant_name).new(opts)
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YoutubeParser
4
+ module Channels
5
+ class AboutSection < BaseParser
6
+ options :channel_url
7
+
8
+ def info
9
+ {
10
+ title: title,
11
+ description: description,
12
+ country: country,
13
+ tags: tags,
14
+ views_count: views_count,
15
+ followers_count: followers_count,
16
+ videos_count: videos_count,
17
+ avatar_url: avatar_url
18
+ }
19
+ end
20
+
21
+ private
22
+
23
+ def title
24
+ section.dig(*keys.title)
25
+ end
26
+
27
+ def description
28
+ descriptions = [section.dig(*keys.description_first),
29
+ section.dig(*keys.description_second)]
30
+ descriptions.compact.join(' ')
31
+ end
32
+
33
+ def country
34
+ section.dig(*keys.country)
35
+ end
36
+
37
+ def tags
38
+ section.dig(*keys.keywords)
39
+ end
40
+
41
+ def avatar_url
42
+ results = section.dig(*keys.avatar) || section.dig(*keys.meta_avatar)
43
+ return if results.nil? || results.empty?
44
+
45
+ results.detect { |t| t&.dig('url') }&.dig('url')
46
+ end
47
+
48
+ def views_count
49
+ views_str = section.dig(*keys.views)&.map(&:values)&.join
50
+ return unless views_str
51
+
52
+ (views_str.gsub(/\D+/, '') || statistics(:views_count))
53
+ end
54
+
55
+ def followers_count
56
+ statistics :followers_count
57
+ end
58
+
59
+ def videos_count
60
+ statistics :videos_count
61
+ end
62
+
63
+ def statistics(title)
64
+ indexes = { videos_count: 1, views_count: 2, followers_count: 3 }
65
+ stats = section.dig(*keys.statistics) || []
66
+
67
+ stats[indexes[title.to_sym].to_i].to_s.gsub(/\D+/, '')
68
+ end
69
+
70
+ def section
71
+ return @section if @section
72
+
73
+ @section = json.dig(*keys.section_tabs)&.detect do |tab|
74
+ tab.dig(*keys.about_section_tab)
75
+ end
76
+ @section = @section&.dig(*keys.about_section_tab) || {}
77
+ end
78
+
79
+ def json
80
+ @json ||= client.get("#{options.channel_url}/about")
81
+ end
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YoutubeParser
4
+ module Channels
5
+ class VideosSection < BaseParser
6
+ options :channel_url
7
+
8
+ def info
9
+ {
10
+ video_ids: video_ids,
11
+ playlist_id: playlist_id
12
+ }
13
+ end
14
+
15
+ private
16
+
17
+ def video_ids
18
+ return @video_ids if @video_ids&.any?
19
+
20
+ sections.each do |section|
21
+ videos = section.dig(*keys.video_section_tabs)
22
+ next unless videos.is_a? Array
23
+
24
+ @video_ids = videos.map { |v| v.dig(*keys.video_ids) }.compact
25
+
26
+ return @video_ids if @video_ids.any?
27
+ end
28
+ end
29
+
30
+ def playlist_id
31
+ return @playlist_id if @playlist_id
32
+
33
+ section = sections.detect { |s| s.dig(*keys.playlist_id) }
34
+ @playlist_id = section&.dig(*keys.playlist_id)
35
+ end
36
+
37
+ def sections
38
+ @sections ||= json.dig(*keys.section_tabs) || []
39
+ end
40
+
41
+ def json
42
+ @json ||= client.get("#{options.channel_url}/videos")
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YoutubeParser
4
+ class Client
5
+ attr_reader :options
6
+
7
+ BASE_URL = 'https://www.youtube.com/'
8
+ DATA_REGEX = /window\[\"ytInitialData\"\]\s*\=\s*(\{[\w\W]+?\})\;/.freeze
9
+
10
+ def initialize(options = {})
11
+ @options = Resource.new(options)
12
+ end
13
+
14
+ def get(endpoint, options = {})
15
+ response = client.get(endpoint, options)
16
+ json_str = response.body[DATA_REGEX, 1]
17
+
18
+ get_json json_str
19
+ end
20
+
21
+ private
22
+
23
+ def client
24
+ opts = { ssl: { verify: false }, request: { timeout: 10 } }
25
+ @client ||= Faraday.new(BASE_URL, opts) do |request|
26
+ request.adapter Faraday.default_adapter
27
+ request.headers['User-Agent'] = options.user_agent if options.user_agent
28
+ request.proxy = proxy if options.proxy
29
+ end
30
+ end
31
+
32
+ def proxy
33
+ URI(options.proxy)
34
+ rescue URI::InvalidURIError
35
+ URI("//#{options.proxy}")
36
+ end
37
+
38
+ def get_json(json_str)
39
+ Oj.load(json_str)
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,24 @@
1
+ channel_url: ['navigationEndpoint', 'browseEndpoint', 'canonicalBaseUrl']
2
+ channel_title: ['title', 'simpleText']
3
+ subscribers_count: ['subscriberCountText', 'simpleText']
4
+ section_tabs: ['contents', 'twoColumnBrowseResultsRenderer', 'tabs']
5
+ about_section_tab: ['tabRenderer', 'content', 'sectionListRenderer',
6
+ 'contents', 0, 'itemSectionRenderer', 'contents', 0,
7
+ 'channelAboutFullMetadataRenderer']
8
+ video_section_tabs: ['tabRenderer', 'content', 'sectionListRenderer',
9
+ 'contents', 0, 'itemSectionRenderer', 'contents', 0, 'gridRenderer', 'items']
10
+ playlist_id: ['tabRenderer', 'content', 'sectionListRenderer', 'subMenu',
11
+ 'channelSubMenuRenderer', 'playAllButton', 'buttonRenderer',
12
+ 'navigationEndpoint', 'watchPlaylistEndpoint', 'playlistId']
13
+ video_ids: ['gridVideoRenderer', 'videoId']
14
+ country: ['country', 'simpleText']
15
+ description_first: ['description', 'simpleText']
16
+ description_second: ['artistBio', 'simpleText']
17
+ meta_avatar: ['metadata', 'channelMetadataRenderer', 'avatar', 'thumbnails']
18
+ avatar: ['avatar', 'thumbnails']
19
+ tags: ['microformat', 'microformatDataRenderer', 'tags']
20
+ views: ['viewCountText', 'runs']
21
+ keywords: ['metadata', 'channelMetadataRenderer', 'keywords']
22
+ tab_renderer: ['tabRenderer']
23
+ title: ['title', 'simpleText']
24
+ statistics: ['networkStatistics', 'statistics']
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YoutubeParser
4
+ class Resource < OpenStruct
5
+ def initialize(hash = {})
6
+ @hash = hash
7
+ @default_method_value = hash.delete(:default_method_value)
8
+
9
+ super(hash)
10
+ end
11
+
12
+ def attributes
13
+ @attributes ||= @hash.transform_keys(&:to_sym)
14
+ end
15
+
16
+ def method_missing(method, *args, &block)
17
+ super_method = super
18
+ return super_method if super_method
19
+
20
+ @default_method_value
21
+ end
22
+
23
+ def respond_to_missing?(method_name, include_private = false)
24
+ @hash.keys.include?(method_name) ||
25
+ @hash.keys.map(&:to_s).include?(method_name) || super
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module YoutubeParser
4
+ VERSION = '0.1.0'
5
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/core_ext'
4
+ require 'uri'
5
+ require 'oj'
6
+ require 'faraday'
7
+ require 'ostruct'
8
+ require 'yaml'
9
+ require 'pathname'
10
+
11
+ require 'youtube_parser/version'
12
+ require 'youtube_parser/resource'
13
+ require 'youtube_parser/client'
14
+ require 'youtube_parser/base_parser'
15
+ require 'youtube_parser/channel'
16
+ require 'youtube_parser/channels/about_section'
17
+ require 'youtube_parser/channels/videos_section'
18
+
19
+ module YoutubeParser
20
+ def self.root
21
+ Pathname.new(Dir.pwd)
22
+ end
23
+ end
@@ -0,0 +1,30 @@
1
+
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'youtube_parser/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'youtube_parser'
8
+ spec.version = YoutubeParser::VERSION
9
+ spec.authors = ['o.vykhor']
10
+ spec.email = ['o.vykhor@ukr.net']
11
+
12
+ spec.summary = %q{Gem for parsing youtube data}
13
+ spec.homepage = 'https://github.com/oleksiivykhor/youtube_parser'
14
+ spec.license = 'MIT'
15
+
16
+ # Specify which files should be added to the gem when it is released.
17
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
18
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
19
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ end
21
+ spec.bindir = 'exe'
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ['lib']
24
+
25
+ spec.add_development_dependency 'bundler', '~> 2.0'
26
+ spec.add_development_dependency 'rake', '~> 10.0'
27
+ spec.add_development_dependency 'rspec', '~> 3.0'
28
+ spec.add_development_dependency 'byebug'
29
+ spec.add_development_dependency 'webmock'
30
+ end
metadata ADDED
@@ -0,0 +1,135 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: youtube_parser
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - o.vykhor
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-12-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: byebug
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: webmock
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description:
84
+ email:
85
+ - o.vykhor@ukr.net
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - ".rspec"
92
+ - ".rubocop.yml"
93
+ - ".travis.yml"
94
+ - CODE_OF_CONDUCT.md
95
+ - Gemfile
96
+ - Gemfile.lock
97
+ - LICENSE.txt
98
+ - README.md
99
+ - Rakefile
100
+ - bin/console
101
+ - bin/setup
102
+ - lib/youtube_parser.rb
103
+ - lib/youtube_parser/base_parser.rb
104
+ - lib/youtube_parser/channel.rb
105
+ - lib/youtube_parser/channels/about_section.rb
106
+ - lib/youtube_parser/channels/videos_section.rb
107
+ - lib/youtube_parser/client.rb
108
+ - lib/youtube_parser/config/keys.yml
109
+ - lib/youtube_parser/resource.rb
110
+ - lib/youtube_parser/version.rb
111
+ - youtube_parser.gemspec
112
+ homepage: https://github.com/oleksiivykhor/youtube_parser
113
+ licenses:
114
+ - MIT
115
+ metadata: {}
116
+ post_install_message:
117
+ rdoc_options: []
118
+ require_paths:
119
+ - lib
120
+ required_ruby_version: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ required_rubygems_version: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ requirements: []
131
+ rubygems_version: 3.0.3
132
+ signing_key:
133
+ specification_version: 4
134
+ summary: Gem for parsing youtube data
135
+ test_files: []